Skip to content

Commit 57275ce

Browse files
committedSep 25, 2015
Revert "Add methods for retrieving extra parameters from symbol render"
This reverts commit fe9461b. The commit was originally added for a label based feature which needed to be reworked after recent labeling changes. Reverting this commit to avoid polluting the API.
1 parent abf4e12 commit 57275ce

File tree

11 files changed

+7
-231
lines changed

11 files changed

+7
-231
lines changed
 

‎python/core/symbology-ng/qgsrendererv2.sip

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,6 @@ class QgsFeatureRendererV2
263263
*/
264264
void setForceRasterRender( bool forceRaster );
265265

266-
/** Returns the result of the feature rendering operation. This should only be
267-
* called immediately after a rendering operation (eg calling renderFeature).
268-
* @note added in QGIS 2.12
269-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 renderFeature
270-
* will return a QgsRenderResult object
271-
*/
272-
// TODO - QGIS 3.0. Remove and make renderFeature return a QgsRenderResult
273-
const QgsRenderResult& renderResult() const;
274-
275266
protected:
276267
QgsFeatureRendererV2( QString type );
277268

@@ -300,16 +291,6 @@ class QgsFeatureRendererV2
300291
*/
301292
void copyPaintEffect( QgsFeatureRendererV2 *destRenderer ) const;
302293

303-
/** Sets the result of the symbol rendering operation. Subclasses should call
304-
* this method after rendering a feature and update the render result to reflect
305-
* to actual result of the feature render.
306-
* @note added in QGIS 2.12
307-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the renderFeature method
308-
* will return a QgsRenderResult object
309-
*/
310-
// TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
311-
void setRenderResult( const QgsRenderResult& result );
312-
313294
private:
314295
QgsFeatureRendererV2( const QgsFeatureRendererV2 & );
315296
QgsFeatureRendererV2 & operator=( const QgsFeatureRendererV2 & );

‎python/core/symbology-ng/qgssymbollayerv2.sip

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,6 @@ class QgsSymbolLayerV2
260260
*/
261261
void setPaintEffect( QgsPaintEffect* effect /Transfer/);
262262

263-
/** Returns the result of the symbol rendering operation. This should only be
264-
* called immediately after a rendering operation (eg calling renderPoint).
265-
* @note added in QGIS 2.12
266-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
267-
* will return a QgsRenderResult object
268-
*/
269-
// TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
270-
const QgsRenderResult& renderResult() const;
271-
272263
protected:
273264
QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );
274265

@@ -315,16 +306,6 @@ class QgsSymbolLayerV2
315306
*/
316307
void copyPaintEffect( QgsSymbolLayerV2* destLayer ) const;
317308

318-
/** Sets the result of the symbol rendering operation. Subclasses should call
319-
* this method after rendering a symbol and update the render result to reflect
320-
* to actual result of the symbol render.
321-
* @note added in QGIS 2.12
322-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
323-
* will return a QgsRenderResult object
324-
*/
325-
// TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
326-
void setRenderResult( const QgsRenderResult& result );
327-
328309
};
329310

330311
//////////////////////

‎python/core/symbology-ng/qgssymbolv2.sip

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,6 @@
11

22
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
33

4-
/** \ingroup core
5-
* \class QgsRenderResult
6-
* \brief A simple container for the results of a rendering operation
7-
* \note Added in version 2.12
8-
*/
9-
10-
class QgsRenderResult
11-
{
12-
%TypeHeaderCode
13-
#include <qgssymbolv2.h>
14-
%End
15-
public:
16-
17-
/** Constructor for QgsRenderResult
18-
* @param symbolRendered initial value for symbolRendered member
19-
*/
20-
QgsRenderResult( bool symbolRendered );
21-
22-
/** Bounds of rendered symbol shape.
23-
* @note only implemented for marker symbol types
24-
*/
25-
QRectF symbolBounds;
26-
27-
//! True if a symbol was rendered during the render operation
28-
bool symbolRendered;
29-
30-
/** Unites the render result with another QgsRenderResult object
31-
* @param other other render result
32-
*/
33-
void unite( const QgsRenderResult& other );
34-
};
35-
36-
374
class QgsSymbolV2
385
{
396
%TypeHeaderCode
@@ -196,15 +163,6 @@ class QgsSymbolV2
196163
void setLayer( const QgsVectorLayer* layer );
197164
const QgsVectorLayer* layer() const;
198165

199-
/** Returns the result of the symbol rendering operation. This should only be
200-
* called immediately after a rendering operation (eg calling renderPoint).
201-
* @note added in QGIS 2.12
202-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
203-
* will return a QgsRenderResult object
204-
*/
205-
// TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
206-
const QgsRenderResult& renderResult() const;
207-
208166
protected:
209167
QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers /Transfer/ ); // can't be instantiated
210168

‎src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -541,18 +541,15 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
541541
}
542542
}
543543

544-
QgsRenderResult result( true );
545544
if ( mUsingCache )
546545
{
547546
//QgsDebugMsg( QString("XXX using cache") );
548547
// we will use cached image
549548
QImage &img = context.selected() ? mSelCache : mCache;
550549
double s = img.width() / context.renderContext().rasterScaleFactor();
551-
QRectF imgRect( point.x() - s / 2.0 + off.x(),
552-
point.y() - s / 2.0 + off.y(),
553-
s, s );
554-
p->drawImage( imgRect, img );
555-
result.symbolBounds = imgRect;
550+
p->drawImage( QRectF( point.x() - s / 2.0 + off.x(),
551+
point.y() - s / 2.0 + off.y(),
552+
s, s ), img );
556553
}
557554
else
558555
{
@@ -609,25 +606,11 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
609606
p->setBrush( context.selected() ? mSelBrush : mBrush );
610607
p->setPen( context.selected() ? mSelPen : mPen );
611608

612-
QRectF boundingRect;
613609
if ( !mPolygon.isEmpty() )
614-
{
615-
QPolygonF transformed = transform.map( mPolygon );
616-
boundingRect = transformed.boundingRect();
617-
p->drawPolygon( transformed );
618-
619-
}
610+
p->drawPolygon( transform.map( mPolygon ) );
620611
else
621-
{
622-
QPainterPath transformed = transform.map( mPath );
623-
boundingRect = transformed.boundingRect();
624-
p->drawPath( transformed );
625-
}
626-
//adjust bounding rect for pen width
627-
result.symbolBounds = boundingRect.adjusted( -mPen.widthF() / 2.0, -mPen.widthF() / 2.0,
628-
mPen.widthF() / 2.0, mPen.widthF() / 2.0 );
612+
p->drawPath( transform.map( mPath ) );
629613
}
630-
setRenderResult( result );
631614
}
632615

633616

‎src/core/symbology-ng/qgsrendererv2.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ QgsFeatureRendererV2::QgsFeatureRendererV2( QString type )
218218
, mCurrentVertexMarkerSize( 3 )
219219
, mPaintEffect( 0 )
220220
, mForceRaster( false )
221-
, mRenderResult( QgsRenderResult( true ) )
222221
{
223222
mPaintEffect = QgsPaintEffectRegistry::defaultStack();
224223
mPaintEffect->setEnabled( false );
@@ -271,13 +270,9 @@ bool QgsFeatureRendererV2::renderFeature( QgsFeature& feature, QgsRenderContext&
271270
{
272271
QgsSymbolV2* symbol = symbolForFeature( feature, context );
273272
if ( symbol == NULL )
274-
{
275-
setRenderResult( QgsRenderResult( false ) );
276273
return false;
277-
}
278274

279275
renderFeatureWithSymbol( feature, symbol, context, layer, selected, drawVertexMarker );
280-
setRenderResult( symbol->renderResult() );
281276
return true;
282277
}
283278

@@ -815,8 +810,3 @@ void QgsFeatureRendererV2::convertSymbolRotation( QgsSymbolV2 * symbol, const QS
815810
s->setDataDefinedAngle( dd );
816811
}
817812
}
818-
819-
void QgsFeatureRendererV2::setRenderResult( const QgsRenderResult& result )
820-
{
821-
mRenderResult = result;
822-
}

‎src/core/symbology-ng/qgsrendererv2.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,6 @@ class CORE_EXPORT QgsFeatureRendererV2
311311
*/
312312
void setForceRasterRender( bool forceRaster ) { mForceRaster = forceRaster; }
313313

314-
/** Returns the result of the feature rendering operation. This should only be
315-
* called immediately after a rendering operation (eg calling renderFeature).
316-
* @note added in QGIS 2.12
317-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 renderFeature
318-
* will return a QgsRenderResult object
319-
*/
320-
// TODO - QGIS 3.0. Remove and make renderFeature return a QgsRenderResult
321-
const QgsRenderResult& renderResult() const { return mRenderResult; }
322-
323314
protected:
324315
QgsFeatureRendererV2( QString type );
325316

@@ -370,20 +361,8 @@ class CORE_EXPORT QgsFeatureRendererV2
370361
*/
371362
static void convertSymbolRotation( QgsSymbolV2 * symbol, const QString & field );
372363

373-
/** Sets the result of the symbol rendering operation. Subclasses should call
374-
* this method after rendering a feature and update the render result to reflect
375-
* to actual result of the feature render.
376-
* @note added in QGIS 2.12
377-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the renderFeature method
378-
* will return a QgsRenderResult object
379-
*/
380-
// TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
381-
void setRenderResult( const QgsRenderResult& result );
382-
383364
private:
384365
Q_DISABLE_COPY( QgsFeatureRendererV2 )
385-
386-
QgsRenderResult mRenderResult;
387366
};
388367

389368
// for some reason SIP compilation fails if these lines are not included:

‎src/core/symbology-ng/qgsrulebasedrendererv2.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,6 @@ bool QgsRuleBasedRendererV2::renderFeature( QgsFeature& feature,
816816
{
817817
Q_UNUSED( layer );
818818

819-
setRenderResult( QgsRenderResult( false ) );
820-
821819
int flags = ( selected ? FeatIsSelected : 0 ) | ( drawVertexMarker ? FeatDrawMarkers : 0 );
822820
mCurrentFeatures.append( FeatureToRender( feature, flags ) );
823821

@@ -876,10 +874,6 @@ void QgsRuleBasedRendererV2::stopRender( QgsRenderContext& context )
876874
{
877875
int flags = job->ftr.flags;
878876
renderFeatureWithSymbol( job->ftr.feat, job->symbol, context, i, flags & FeatIsSelected, flags & FeatDrawMarkers );
879-
880-
QgsRenderResult newRenderResult = job->symbol->renderResult();
881-
newRenderResult.unite( renderResult() );
882-
setRenderResult( newRenderResult );
883877
}
884878
}
885879
}

‎src/core/symbology-ng/qgssymbollayerv2.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ QgsSymbolLayerV2::QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked )
334334
, mLocked( locked )
335335
, mRenderingPass( 0 )
336336
, mPaintEffect( 0 )
337-
, mRenderResult( QgsRenderResult( true ) )
338337
{
339338
mPaintEffect = QgsPaintEffectRegistry::defaultStack();
340339
mPaintEffect->setEnabled( false );
@@ -483,11 +482,6 @@ void QgsSymbolLayerV2::copyPaintEffect( QgsSymbolLayerV2 *destLayer ) const
483482
destLayer->setPaintEffect( mPaintEffect->clone() );
484483
}
485484

486-
void QgsSymbolLayerV2::setRenderResult( const QgsRenderResult& result )
487-
{
488-
mRenderResult = result;
489-
}
490-
491485
QgsMarkerSymbolLayerV2::QgsMarkerSymbolLayerV2( bool locked )
492486
: QgsSymbolLayerV2( QgsSymbolV2::Marker, locked )
493487
, mAngle( 0 )

‎src/core/symbology-ng/qgssymbollayerv2.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,6 @@ class CORE_EXPORT QgsSymbolLayerV2
247247
*/
248248
void setPaintEffect( QgsPaintEffect* effect );
249249

250-
/** Returns the result of the symbol rendering operation. This should only be
251-
* called immediately after a rendering operation (eg calling renderPoint).
252-
* @note added in QGIS 2.12
253-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
254-
* will return a QgsRenderResult object
255-
*/
256-
// TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
257-
const QgsRenderResult& renderResult() const { return mRenderResult; }
258-
259250
protected:
260251
QgsSymbolLayerV2( QgsSymbolV2::SymbolType type, bool locked = false );
261252

@@ -316,16 +307,6 @@ class CORE_EXPORT QgsSymbolLayerV2
316307
*/
317308
void copyPaintEffect( QgsSymbolLayerV2* destLayer ) const;
318309

319-
/** Sets the result of the symbol rendering operation. Subclasses should call
320-
* this method after rendering a symbol and update the render result to reflect
321-
* to actual result of the symbol render.
322-
* @note added in QGIS 2.12
323-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
324-
* will return a QgsRenderResult object
325-
*/
326-
// TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
327-
void setRenderResult( const QgsRenderResult& result );
328-
329310
static const QString EXPR_SIZE;
330311
static const QString EXPR_ANGLE;
331312
static const QString EXPR_NAME;
@@ -384,10 +365,6 @@ class CORE_EXPORT QgsSymbolLayerV2
384365
static const QString EXPR_OFFSET_ALONG_LINE;
385366
static const QString EXPR_HORIZONTAL_ANCHOR_POINT;
386367
static const QString EXPR_VERTICAL_ANCHOR_POINT;
387-
388-
private:
389-
390-
QgsRenderResult mRenderResult;
391368
};
392369

393370
//////////////////////

‎src/core/symbology-ng/qgssymbolv2.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ QgsSymbolV2::QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers )
8181
, mRenderHints( 0 )
8282
, mClipFeaturesToExtent( true )
8383
, mLayer( 0 )
84-
, mRenderResult( QgsRenderResult( true ) )
8584
{
8685

8786
// check they're all correct symbol layers
@@ -832,8 +831,6 @@ void QgsMarkerSymbolV2::renderPointUsingLayer( QgsMarkerSymbolLayerV2* layer, co
832831
{
833832
layer->renderPoint( point, context );
834833
}
835-
836-
mRenderResult = layer->renderResult();
837834
}
838835

839836
void QgsMarkerSymbolV2::renderPoint( const QPointF& point, const QgsFeature* f, QgsRenderContext& context, int layer, bool selected )
@@ -849,13 +846,10 @@ void QgsMarkerSymbolV2::renderPoint( const QPointF& point, const QgsFeature* f,
849846
return;
850847
}
851848

852-
QgsRenderResult combinedResult( false );
853849
for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it )
854850
{
855851
renderPointUsingLayer(( QgsMarkerSymbolLayerV2* ) * it, point, symbolContext );
856-
combinedResult.unite(( *it )->renderResult() );
857852
}
858-
mRenderResult = combinedResult;
859853
}
860854

861855
QgsSymbolV2* QgsMarkerSymbolV2::clone() const
@@ -1038,8 +1032,6 @@ void QgsLineSymbolV2::renderPolylineUsingLayer( QgsLineSymbolLayerV2 *layer, con
10381032
{
10391033
layer->renderPolyline( points, context );
10401034
}
1041-
1042-
mRenderResult = layer->renderResult();
10431035
}
10441036

10451037

@@ -1120,8 +1112,6 @@ void QgsFillSymbolV2::renderPolygonUsingLayer( QgsSymbolLayerV2* layer, const QP
11201112
(( QgsLineSymbolLayerV2* )layer )->renderPolygonOutline( points, rings, context );
11211113
}
11221114
}
1123-
1124-
mRenderResult = layer->renderResult();
11251115
}
11261116

11271117
QRectF QgsFillSymbolV2::polygonBounds( const QPolygonF& points, const QList<QPolygonF>* rings ) const

‎src/core/symbology-ng/qgssymbolv2.h

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,6 @@ class QgsDataDefined;
4545

4646
typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List;
4747

48-
49-
/** \ingroup core
50-
* \class QgsRenderResult
51-
* \brief A simple container for the results of a rendering operation
52-
* \note Added in version 2.12
53-
*/
54-
55-
class QgsRenderResult
56-
{
57-
public:
58-
59-
/** Constructor for QgsRenderResult
60-
* @param symbolRendered initial value for symbolRendered member
61-
*/
62-
QgsRenderResult( bool symbolRendered )
63-
: symbolRendered( symbolRendered )
64-
{ }
65-
66-
/** Bounds of rendered symbol shape.
67-
* @note only implemented for marker symbol types
68-
*/
69-
QRectF symbolBounds;
70-
71-
//! True if a symbol was rendered during the render operation
72-
bool symbolRendered;
73-
74-
/** Unites the render result with another QgsRenderResult object
75-
* @param other other render result
76-
*/
77-
void unite( const QgsRenderResult& other )
78-
{
79-
symbolRendered = symbolRendered || other.symbolRendered;
80-
if ( !symbolBounds.isValid() )
81-
symbolBounds = other.symbolBounds;
82-
else
83-
symbolBounds = symbolBounds.united( other.symbolBounds );
84-
}
85-
};
86-
87-
88-
//////////////////////
89-
9048
class CORE_EXPORT QgsSymbolV2
9149
{
9250
public:
@@ -263,15 +221,6 @@ class CORE_EXPORT QgsSymbolV2
263221
void setLayer( const QgsVectorLayer* layer ) { mLayer = layer; }
264222
const QgsVectorLayer* layer() const { return mLayer; }
265223

266-
/** Returns the result of the symbol rendering operation. This should only be
267-
* called immediately after a rendering operation (eg calling renderPoint).
268-
* @note added in QGIS 2.12
269-
* @note this is a temporary method until QGIS 3.0. For QGIS 3.0 the render methods
270-
* will return a QgsRenderResult object
271-
*/
272-
// TODO - QGIS 3.0. Remove and make renderPoint, etc return a QgsRenderResult
273-
const QgsRenderResult& renderResult() const { return mRenderResult; }
274-
275224
protected:
276225
QgsSymbolV2( SymbolType type, QgsSymbolLayerV2List layers ); // can't be instantiated
277226

@@ -292,8 +241,6 @@ class CORE_EXPORT QgsSymbolV2
292241

293242
const QgsVectorLayer* mLayer; //current vectorlayer
294243

295-
QgsRenderResult mRenderResult;
296-
297244
};
298245

299246
///////////////////////
@@ -352,9 +299,11 @@ class CORE_EXPORT QgsSymbolV2RenderContext
352299
};
353300

354301

302+
355303
//////////////////////
356304

357305

306+
358307
class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2
359308
{
360309
public:

0 commit comments

Comments
 (0)
Please sign in to comment.