Skip to content

Commit a921c19

Browse files
committedSep 13, 2016
Remove deprecated members and fix TODOs for QgsFeatureRenderer
1 parent f55d7d3 commit a921c19

20 files changed

+51
-382
lines changed
 

‎doc/api_break.dox

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,17 @@ None will need to be modified, as the method will return an empty geometry if th
552552
\subsection qgis_api_break_3_0_QgsFeatureRendererV2 QgsFeatureRendererV2
553553

554554
<ul>
555-
<li>The method capabilities() returns QgsFeatureRendererV2::Capabilities flags instead of an integer. The two are binary compatible.
555+
<li>The method capabilities() returns QgsFeatureRendererV2::Capabilities flags instead of an integer. The two are binary compatible.</li>
556+
<li>symbolForFeature( QgsFeature& feature ) has been removed. The symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) method should be used instead (previously available as symbolForFeature2 in PyQGIS bindings). symbolForFeature has been made pure virtual.</li>
557+
<li>originalSymbolForFeature( QgsFeature& feature ) has been removed. The symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) method should be used instead (previously available as originalSymbolForFeature2 in PyQGIS bindings).</li>
558+
<li>startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer ) was removed. This function has had no effect since QGIS 2.4</li>
559+
<li>symbols() has been removed. The symbols( QgsRenderContext& context ) method should be used instead (previously available as symbols2 in PyQGIS bindings).</li>
560+
<li>writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) was removed. writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) should be used instead.</li>
561+
<li>rotationField() and setRotationField() were removed. Data defined properties for QgsSymbolLayer should be used instead.</li>
562+
<li>willRenderFeature( QgsFeature& feat ) has been removed. The willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as willRenderFeature2 in PyQGIS bindings).</li>
563+
<li>symbolsForFeature( QgsFeature& feat ) has been removed. The symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as symbolsForFeature2 in PyQGIS bindings).</li>
564+
<li>originalSymbolsForFeature( QgsFeature& feat ) has been removed. The originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as originalSymbolsForFeature2 in PyQGIS bindings).</li>
565+
<li>copyPaintEffect() was removed. copyRendererData() should be used instead.</li>
556566
</ul>
557567

558568
\subsection qgis_api_break_3_0_QgsFields QgsFields

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer
5050
virtual ~QgsCategorizedSymbolRenderer();
5151

5252
//! @note available in python as symbolForFeature2
53-
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
53+
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
5454

5555
//! @note available in python as originalSymbolForFeature2
56-
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
56+
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
5757

5858
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
5959

@@ -73,7 +73,7 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer
7373
virtual QString filter( const QgsFields& fields = QgsFields() );
7474

7575
//! @note available in python as symbols2
76-
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
76+
virtual QgsSymbolList symbols( QgsRenderContext& context );
7777

7878
/** Update all the symbols but leave categories and colors. This method also sets the source
7979
* symbol for the renderer.
@@ -168,9 +168,6 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer
168168
*/
169169
void updateColorRamp( QgsColorRamp* ramp /Transfer/, bool inverted = false );
170170

171-
void setRotationField( const QString& fieldOrExpression ) /Deprecated/;
172-
QString rotationField() const /Deprecated/;
173-
174171
void setSizeScaleField( const QString& fieldOrExpression );
175172
QString sizeScaleField() const;
176173

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
9494
virtual ~QgsGraduatedSymbolRenderer();
9595

9696
//! @note labelForLowerUpper in python bindings
97-
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
97+
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
9898
//! @note originalSymbolForFeature2 in python bindings
99-
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
99+
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
100100

101101
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
102102

@@ -114,7 +114,7 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
114114
virtual QgsFeatureRenderer::Capabilities capabilities();
115115

116116
//! @note symbol2 in python bindings
117-
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
117+
virtual QgsSymbolList symbols( QgsRenderContext& context );
118118

119119
QString classAttribute() const;
120120
void setClassAttribute( const QString& attr );
@@ -299,9 +299,6 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
299299
//! @note added in 2.10
300300
void setGraduatedMethod( GraduatedMethod method );
301301

302-
void setRotationField( const QString& fieldOrExpression ) /Deprecated/;
303-
QString rotationField() const /Deprecated/;
304-
305302
void setSizeScaleField( const QString& fieldOrExpression );
306303
QString sizeScaleField() const;
307304

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class QgsHeatmapRenderer : QgsFeatureRenderer
1414
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
1515
virtual void stopRender( QgsRenderContext& context );
1616
//! @note symbolForFeature2 in python bindings
17-
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
17+
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
1818
//! @note symbol2 in python bindings
19-
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
19+
virtual QgsSymbolList symbols( QgsRenderContext& context );
2020
virtual QString dump() const;
2121
virtual QList<QString> usedAttributes();
2222
static QgsFeatureRenderer* create( QDomElement& element ) /Factory/;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,23 @@ class QgsInvertedPolygonRenderer : QgsFeatureRenderer
4545
/** Proxy that will call this method on the embedded renderer.
4646
* @note available in python bindings as symbol2
4747
*/
48-
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
48+
virtual QgsSymbolList symbols( QgsRenderContext& context );
4949
/** Proxy that will call this method on the embedded renderer.
5050
* @note available in python bindings as symbolForFeature2
5151
*/
52-
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
52+
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
5353
/** Proxy that will call this method on the embedded renderer.
5454
* @note available in python bindings as originalSymbolForFeature2
5555
*/
56-
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
56+
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context );
5757
/** Proxy that will call this method on the embedded renderer.
5858
* @note available in python bindings as symbolsForFeature
5959
*/
60-
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature/;
60+
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
6161
/** Proxy that will call this method on the embedded renderer.
6262
* @note available in python bindings as originalSymbolsForFeature2
6363
*/
64-
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;
64+
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
6565
/** Proxy that will call this method on the embedded renderer. */
6666
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize );
6767
/** Proxy that will call this method on the embedded renderer.
@@ -71,7 +71,7 @@ class QgsInvertedPolygonRenderer : QgsFeatureRenderer
7171
/** Proxy that will call this method on the embedded renderer.
7272
* @note available in python bindings as willRenderFeature2
7373
*/
74-
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;
74+
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
7575

7676
/** Creates a renderer out of an XML, for loading*/
7777
static QgsFeatureRenderer* create( QDomElement& element ) /Factory/;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class QgsNullSymbolRenderer : QgsFeatureRenderer
2727
virtual QList<QString> usedAttributes();
2828
virtual QString dump() const;
2929
virtual QgsFeatureRenderer* clone() const /Factory/;
30-
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
30+
virtual QgsSymbolList symbols( QgsRenderContext& context );
3131

3232
/** Creates a null renderer from XML element.
3333
* @param element DOM element

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@ class QgsPointDisplacementRenderer : QgsFeatureRenderer
3030
/** Proxy that will call this method on the embedded renderer.
3131
@note available in python as symbols2
3232
*/
33-
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
33+
virtual QgsSymbolList symbols( QgsRenderContext& context );
3434
/** Proxy that will call this method on the embedded renderer.
3535
@note available in python as symbolForFeature2
3636
*/
37-
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
37+
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
3838
/** Proxy that will call this method on the embedded renderer.
3939
@note available in python as originalSymbolForFeature2
4040
*/
41-
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
41+
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context );
4242
/** Proxy that will call this method on the embedded renderer.
4343
@note available in python as symbolsForFeature2
4444
*/
45-
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature2/;
45+
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
4646
/** Proxy that will call this method on the embedded renderer.
4747
@note available in python as originalSymbolsForFeature2
4848
*/
49-
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;
49+
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
5050
/** Proxy that will call this method on the embedded renderer.
5151
@note available in python as willRenderFeature2
5252
*/
53-
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;
53+
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
5454

5555
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
5656

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

Lines changed: 7 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -64,46 +64,23 @@ class QgsFeatureRenderer
6464

6565
QString type() const;
6666

67-
/** To be overridden
68-
*
69-
* Must be called between startRender() and stopRender() calls.
70-
* @param feature feature
71-
* @return returns pointer to symbol or 0 if symbol was not found
72-
* @deprecated use symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead
73-
*/
74-
virtual QgsSymbol* symbolForFeature( QgsFeature& feature ) /Deprecated/;
75-
7667
/** To be overridden
7768
*
7869
* Must be called between startRender() and stopRender() calls.
7970
* @param feature feature
8071
* @param context render context
8172
* @return returns pointer to symbol or 0 if symbol was not found
8273
* @note added in QGIS 2.12
83-
* @note available in Python bindings as symbolForFeature2
84-
*/
85-
// TODO - QGIS 3.0 make pure virtual when above method is removed
86-
// TODO - QGIS 3.0 change PyName to symbolForFeature when deprecated method is removed
87-
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
88-
89-
/**
90-
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
91-
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
92-
* of a symbol for use in rendering.
93-
* @note added in 2.6
94-
* @deprecated use originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead
9574
*/
96-
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature ) /Deprecated/;
75+
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) = 0;
9776

9877
/**
9978
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
10079
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
10180
* of a symbol for use in rendering.
10281
* @note added in 2.12
103-
* @note available in Python bindings as originalSymbolForFeature2
10482
*/
105-
//TODO - QGIS 3.0 change PyName to originalSymbolForFeature when deprecated method is removed
106-
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
83+
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
10784

10885
/**
10986
* Return legend keys matching a specified feature.
@@ -120,9 +97,6 @@ class QgsFeatureRenderer
12097
*/
12198
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) = 0;
12299

123-
//! @deprecated since 2.4 - not using QgsVectorLayer directly anymore
124-
virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer ) /Deprecated/;
125-
126100
/**
127101
* Needs to be called when a render cycle has finished to clean up.
128102
*/
@@ -186,18 +160,12 @@ class QgsFeatureRenderer
186160
//! returns bitwise OR-ed capabilities of the renderer
187161
virtual QgsFeatureRenderer::Capabilities capabilities();
188162

189-
/** For symbol levels
190-
* @deprecated use symbols( QgsRenderContext& context ) instead
191-
*/
192-
virtual QgsSymbolList symbols() /Deprecated/;
193163

194164
/** Returns list of symbols used by the renderer.
195165
* @param context render context
196166
* @note added in QGIS 2.12
197-
* @note available in Python bindings as symbols2
198167
*/
199-
//TODO - QGIS 3.0 change PyName to symbols when deprecated method is removed
200-
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
168+
virtual QgsSymbolList symbols( QgsRenderContext& context );
201169

202170
bool usingSymbolLevels() const;
203171
void setUsingSymbolLevels( bool usingSymbolLevels );
@@ -208,9 +176,6 @@ class QgsFeatureRenderer
208176
//! store renderer info to XML element
209177
virtual QDomElement save( QDomDocument& doc );
210178

211-
//! create the SLD UserStyle element following the SLD v1.1 specs
212-
//! @deprecated since 2.8 - use the other override with styleName
213-
virtual QDomElement writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) const /Deprecated/;
214179
//! create the SLD UserStyle element following the SLD v1.1 specs with the given name
215180
//! @note added in 2.8
216181
virtual QDomElement writeSld( QDomDocument& doc, const QString& styleName ) const;
@@ -268,60 +233,24 @@ class QgsFeatureRenderer
268233
//! set type and size of editing vertex markers for subsequent rendering
269234
void setVertexMarkerAppearance( int type, int size );
270235

271-
//! return rotation field name (or empty string if not set or not supported by renderer)
272-
//! @deprecated use the symbol's methods instead
273-
virtual QString rotationField() const /Deprecated/;
274-
275-
//! sets rotation field of renderer (if supported by the renderer)
276-
//! @deprecated use the symbol's methods instead
277-
virtual void setRotationField( const QString& fieldName ) /Deprecated/;
278-
279-
/** Returns whether the renderer will render a feature or not.
280-
* Must be called between startRender() and stopRender() calls.
281-
* Default implementation uses symbolForFeature().
282-
* @deprecated use willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) instead
283-
*/
284-
virtual bool willRenderFeature( QgsFeature& feat ) /Deprecated/;
285-
286236
/** Returns whether the renderer will render a feature or not.
287237
* Must be called between startRender() and stopRender() calls.
288238
* Default implementation uses symbolForFeature().
289239
* @note added in QGIS 2.12
290-
* @note available in Python bindings as willRenderFeature2
291-
*/
292-
//TODO - QGIS 3.0 change PyName to willRenderFeature when deprecated method is removed
293-
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;
294-
295-
/** Returns list of symbols used for rendering the feature.
296-
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
297-
* to use symbolForFeature()
298-
* @deprecated use symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead
299240
*/
300-
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat ) /Deprecated/;
241+
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
301242

302243
/** Returns list of symbols used for rendering the feature.
303244
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
304245
* to use symbolForFeature()
305246
* @note added in QGIS 2.12
306-
* @note available in Python bindings as symbolsForFeature2
307247
*/
308-
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
309-
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature2/;
248+
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
310249

311250
/** Equivalent of originalSymbolsForFeature() call
312251
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
313-
* @note added in 2.6
314-
* @deprecated use originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead
315-
*/
316-
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat ) /Deprecated/;
317-
318-
/** Equivalent of originalSymbolsForFeature() call
319-
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
320-
* @note added in 2.12
321-
* @note available in Python bindings as originalSymbolsForFeature2
322-
*/
323-
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
324-
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;
252+
* @note added in 2.12 */
253+
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
325254

326255
/** Allows for a renderer to modify the extent of a feature request prior to rendering
327256
* @param extent reference to request's filter extent. Modify extent to change the
@@ -443,12 +372,6 @@ class QgsFeatureRenderer
443372
*/
444373
void copyRendererData( QgsFeatureRenderer *destRenderer ) const;
445374

446-
/** Copies paint effect of this renderer to another renderer
447-
* @param destRenderer destination renderer for copied effect
448-
* @deprecated use copyRendererData instead
449-
*/
450-
void copyPaintEffect( QgsFeatureRenderer *destRenderer ) const /Deprecated/;
451-
452375
/** @note this function is used to convert old sizeScale expresssions to symbol
453376
* level DataDefined size
454377
*/

0 commit comments

Comments
 (0)
Please sign in to comment.