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
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class QgsRuleBasedRenderer : QgsFeatureRenderer
8888
bool needsGeometry() const;
8989

9090
//! @note available in python bindings as symbol2
91-
QgsSymbolList symbols( const QgsRenderContext& context = QgsRenderContext() ) /PyName=symbols2/;
91+
QgsSymbolList symbols( const QgsRenderContext& context = QgsRenderContext() );
9292

9393
//! @note not available in python bindings
9494
// QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = "" ) const;

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class QgsSingleSymbolRenderer : QgsFeatureRenderer
1010
virtual ~QgsSingleSymbolRenderer();
1111

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

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

1818
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
1919

@@ -24,9 +24,6 @@ class QgsSingleSymbolRenderer : QgsFeatureRenderer
2424
QgsSymbol* symbol() const;
2525
void setSymbol( QgsSymbol* s /Transfer/ );
2626

27-
void setRotationField( const QString& fieldOrExpression ) /Deprecated/;
28-
QString rotationField() const /Deprecated/;
29-
3027
void setSizeScaleField( const QString& fieldOrExpression );
3128
QString sizeScaleField() const;
3229

@@ -44,7 +41,7 @@ class QgsSingleSymbolRenderer : QgsFeatureRenderer
4441
virtual QgsFeatureRenderer::Capabilities capabilities();
4542

4643
//! @note available in python as symbol2
47-
virtual QgsSymbolList symbols( QgsRenderContext& context ) /PyName=symbols2/;
44+
virtual QgsSymbolList symbols( QgsRenderContext& context );
4845

4946
//! create renderer from XML element
5047
static QgsFeatureRenderer* create( QDomElement& element ) /Factory/;

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -936,27 +936,6 @@ void QgsCategorizedSymbolRenderer::updateColorRamp( QgsColorRamp* ramp, bool inv
936936
}
937937
}
938938

939-
void QgsCategorizedSymbolRenderer::setRotationField( const QString& fieldOrExpression )
940-
{
941-
if ( mSourceSymbol && mSourceSymbol->type() == QgsSymbol::Marker )
942-
{
943-
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSourceSymbol.data() );
944-
s->setDataDefinedAngle( QgsDataDefined( fieldOrExpression ) );
945-
}
946-
}
947-
948-
QString QgsCategorizedSymbolRenderer::rotationField() const
949-
{
950-
if ( mSourceSymbol && mSourceSymbol->type() == QgsSymbol::Marker )
951-
{
952-
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSourceSymbol.data() );
953-
QgsDataDefined ddAngle = s->dataDefinedAngle();
954-
return ddAngle.useExpression() ? ddAngle.expressionString() : ddAngle.field();
955-
}
956-
957-
return QString();
958-
}
959-
960939
void QgsCategorizedSymbolRenderer::setSizeScaleField( const QString& fieldOrExpression )
961940
{
962941
mSizeScale.reset( QgsSymbolLayerUtils::fieldOrExpressionToExpression( fieldOrExpression ) );

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
202202
*/
203203
void updateColorRamp( QgsColorRamp* ramp, bool inverted = false );
204204

205-
Q_DECL_DEPRECATED void setRotationField( const QString& fieldOrExpression ) override;
206-
Q_DECL_DEPRECATED QString rotationField() const override;
207-
208205
void setSizeScaleField( const QString& fieldOrExpression );
209206
QString sizeScaleField() const;
210207

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,28 +1428,6 @@ void QgsGraduatedSymbolRenderer::updateSymbols( QgsSymbol *sym )
14281428
setSourceSymbol( sym->clone() );
14291429
}
14301430

1431-
void QgsGraduatedSymbolRenderer::setRotationField( const QString& fieldOrExpression )
1432-
{
1433-
if ( mSourceSymbol->type() == QgsSymbol::Marker )
1434-
{
1435-
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSourceSymbol.data() );
1436-
s->setDataDefinedAngle( QgsDataDefined( fieldOrExpression ) );
1437-
}
1438-
1439-
}
1440-
1441-
QString QgsGraduatedSymbolRenderer::rotationField() const
1442-
{
1443-
if ( mSourceSymbol->type() == QgsSymbol::Marker )
1444-
{
1445-
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSourceSymbol.data() );
1446-
QgsDataDefined ddAngle = s->dataDefinedAngle();
1447-
return ddAngle.useExpression() ? ddAngle.expressionString() : ddAngle.field();
1448-
}
1449-
1450-
return QString();
1451-
}
1452-
14531431
void QgsGraduatedSymbolRenderer::setSizeScaleField( const QString& fieldOrExpression )
14541432
{
14551433
mSizeScale.reset( QgsSymbolLayerUtils::fieldOrExpressionToExpression( fieldOrExpression ) );

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
354354
//! @note added in 2.10
355355
void setGraduatedMethod( GraduatedMethod method ) { mGraduatedMethod = method; }
356356

357-
Q_DECL_DEPRECATED void setRotationField( const QString& fieldOrExpression ) override;
358-
Q_DECL_DEPRECATED QString rotationField() const override;
359-
360357
void setSizeScaleField( const QString& fieldOrExpression );
361358
QString sizeScaleField() const;
362359

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

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,6 @@ void QgsFeatureRenderer::copyRendererData( QgsFeatureRenderer* destRenderer ) co
7070
destRenderer->mOrderByEnabled = mOrderByEnabled;
7171
}
7272

73-
void QgsFeatureRenderer::copyPaintEffect( QgsFeatureRenderer *destRenderer ) const
74-
{
75-
if ( !destRenderer || !mPaintEffect )
76-
return;
77-
78-
destRenderer->setPaintEffect( mPaintEffect->clone() );
79-
}
80-
8173
QgsFeatureRenderer::QgsFeatureRenderer( const QString& type )
8274
: mType( type )
8375
, mUsingSymbolLevels( false )
@@ -101,30 +93,7 @@ QgsFeatureRenderer* QgsFeatureRenderer::defaultRenderer( QgsWkbTypes::GeometryTy
10193
return new QgsSingleSymbolRenderer( QgsSymbol::defaultSymbol( geomType ) );
10294
}
10395

104-
QgsSymbol* QgsFeatureRenderer::symbolForFeature( QgsFeature& feature )
105-
{
106-
QgsRenderContext context;
107-
context.setExpressionContext( QgsExpressionContextUtils::createFeatureBasedContext( feature, QgsFields() ) );
108-
return symbolForFeature( feature, context );
109-
}
110-
111-
QgsSymbol* QgsFeatureRenderer::symbolForFeature( QgsFeature &feature, QgsRenderContext &context )
112-
{
113-
Q_UNUSED( context );
114-
// base method calls deprecated symbolForFeature to maintain API
115-
Q_NOWARN_DEPRECATED_PUSH
116-
return symbolForFeature( feature );
117-
Q_NOWARN_DEPRECATED_POP
118-
}
119-
120-
QgsSymbol *QgsFeatureRenderer::originalSymbolForFeature( QgsFeature &feature )
121-
{
122-
Q_NOWARN_DEPRECATED_PUSH
123-
return symbolForFeature( feature );
124-
Q_NOWARN_DEPRECATED_POP
125-
}
126-
127-
QgsSymbol *QgsFeatureRenderer::originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context )
96+
QgsSymbol* QgsFeatureRenderer::originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context )
12897
{
12998
return symbolForFeature( feature, context );
13099
}
@@ -136,11 +105,6 @@ QSet< QString > QgsFeatureRenderer::legendKeysForFeature( QgsFeature& feature, Q
136105
return QSet< QString >();
137106
}
138107

139-
void QgsFeatureRenderer::startRender( QgsRenderContext& context, const QgsVectorLayer* vlayer )
140-
{
141-
startRender( context, vlayer->fields() );
142-
}
143-
144108
bool QgsFeatureRenderer::filterNeedsGeometry() const
145109
{
146110
return false;
@@ -166,23 +130,6 @@ QString QgsFeatureRenderer::dump() const
166130
return "UNKNOWN RENDERER\n";
167131
}
168132

169-
QgsSymbolList QgsFeatureRenderer::symbols()
170-
{
171-
QgsRenderContext context;
172-
return symbols( context );
173-
}
174-
175-
QgsSymbolList QgsFeatureRenderer::symbols( QgsRenderContext &context )
176-
{
177-
Q_UNUSED( context );
178-
179-
//base implementation calls deprecated method to maintain API
180-
Q_NOWARN_DEPRECATED_PUSH
181-
return symbols();
182-
Q_NOWARN_DEPRECATED_POP
183-
}
184-
185-
186133
QgsFeatureRenderer* QgsFeatureRenderer::load( QDomElement& element )
187134
{
188135
// <renderer-v2 type=""> ... </renderer-v2>
@@ -326,12 +273,6 @@ QgsFeatureRenderer* QgsFeatureRenderer::loadSld( const QDomNode &node, QgsWkbTyp
326273
return r;
327274
}
328275

329-
QDomElement QgsFeatureRenderer::writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) const
330-
{
331-
QgsStringMap props;
332-
return writeSld( doc, layer.name(), props );
333-
}
334-
335276
QDomElement QgsFeatureRenderer::writeSld( QDomDocument& doc, const QString& styleName, QgsStringMap props ) const
336277
{
337278
QDomElement userStyleElem = doc.createElement( "UserStyle" );
@@ -402,13 +343,6 @@ void QgsFeatureRenderer::setVertexMarkerAppearance( int type, int size )
402343
mCurrentVertexMarkerSize = size;
403344
}
404345

405-
bool QgsFeatureRenderer::willRenderFeature( QgsFeature &feat )
406-
{
407-
Q_NOWARN_DEPRECATED_PUSH
408-
return nullptr != symbolForFeature( feat );
409-
Q_NOWARN_DEPRECATED_POP
410-
}
411-
412346
bool QgsFeatureRenderer::willRenderFeature( QgsFeature &feat, QgsRenderContext &context )
413347
{
414348
return nullptr != symbolForFeature( feat, context );
@@ -442,16 +376,6 @@ void QgsFeatureRenderer::renderVertexMarkerPolygon( QPolygonF& pts, QList<QPolyg
442376
}
443377
}
444378

445-
QgsSymbolList QgsFeatureRenderer::symbolsForFeature( QgsFeature& feat )
446-
{
447-
QgsSymbolList lst;
448-
Q_NOWARN_DEPRECATED_PUSH
449-
QgsSymbol* s = symbolForFeature( feat );
450-
Q_NOWARN_DEPRECATED_POP
451-
if ( s ) lst.append( s );
452-
return lst;
453-
}
454-
455379
QgsSymbolList QgsFeatureRenderer::symbolsForFeature( QgsFeature &feat, QgsRenderContext &context )
456380
{
457381
QgsSymbolList lst;
@@ -460,16 +384,6 @@ QgsSymbolList QgsFeatureRenderer::symbolsForFeature( QgsFeature &feat, QgsRender
460384
return lst;
461385
}
462386

463-
QgsSymbolList QgsFeatureRenderer::originalSymbolsForFeature( QgsFeature& feat )
464-
{
465-
QgsSymbolList lst;
466-
Q_NOWARN_DEPRECATED_PUSH
467-
QgsSymbol* s = originalSymbolForFeature( feat );
468-
Q_NOWARN_DEPRECATED_POP
469-
if ( s ) lst.append( s );
470-
return lst;
471-
}
472-
473387
QgsSymbolList QgsFeatureRenderer::originalSymbolsForFeature( QgsFeature &feat, QgsRenderContext &context )
474388
{
475389
QgsSymbolList lst;

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

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -91,45 +91,22 @@ class CORE_EXPORT QgsFeatureRenderer
9191

9292
QString type() const { return mType; }
9393

94-
/** To be overridden
95-
*
96-
* Must be called between startRender() and stopRender() calls.
97-
* @param feature feature
98-
* @return returns pointer to symbol or 0 if symbol was not found
99-
* @deprecated use symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead
100-
*/
101-
Q_DECL_DEPRECATED virtual QgsSymbol* symbolForFeature( QgsFeature& feature );
102-
10394
/** To be overridden
10495
*
10596
* Must be called between startRender() and stopRender() calls.
10697
* @param feature feature
10798
* @param context render context
10899
* @return returns pointer to symbol or 0 if symbol was not found
109100
* @note added in QGIS 2.12
110-
* @note available in Python bindings as symbolForFeature2
111-
*/
112-
// TODO - QGIS 3.0 make pure virtual when above method is removed
113-
// TODO - QGIS 3.0 change PyName to symbolForFeature when deprecated method is removed
114-
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
115-
116-
/**
117-
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
118-
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
119-
* of a symbol for use in rendering.
120-
* @note added in 2.6
121-
* @deprecated use originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead
122101
*/
123-
Q_DECL_DEPRECATED virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature );
102+
virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) = 0;
124103

125104
/**
126105
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
127106
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
128107
* of a symbol for use in rendering.
129108
* @note added in 2.12
130-
* @note available in Python bindings as originalSymbolForFeature2
131109
*/
132-
//TODO - QGIS 3.0 change PyName to originalSymbolForFeature when deprecated method is removed
133110
virtual QgsSymbol* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
134111

135112
/**
@@ -147,9 +124,6 @@ class CORE_EXPORT QgsFeatureRenderer
147124
*/
148125
virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) = 0;
149126

150-
//! @deprecated since 2.4 - not using QgsVectorLayer directly anymore
151-
Q_DECL_DEPRECATED virtual void startRender( QgsRenderContext& context, const QgsVectorLayer* vlayer );
152-
153127
/**
154128
* Needs to be called when a render cycle has finished to clean up.
155129
*/
@@ -236,18 +210,11 @@ class CORE_EXPORT QgsFeatureRenderer
236210
*/
237211
virtual Capabilities capabilities() { return 0; }
238212

239-
/** For symbol levels
240-
* @deprecated use symbols( QgsRenderContext& context ) instead
241-
*/
242-
Q_DECL_DEPRECATED virtual QgsSymbolList symbols();
243-
244213
/** Returns list of symbols used by the renderer.
245214
* @param context render context
246215
* @note added in QGIS 2.12
247-
* @note available in Python bindings as symbols2
248216
*/
249-
//TODO - QGIS 3.0 change PyName to symbols when deprecated method is removed
250-
virtual QgsSymbolList symbols( QgsRenderContext& context );
217+
virtual QgsSymbolList symbols( QgsRenderContext& context ) { Q_UNUSED( context ); return QgsSymbolList(); }
251218

252219
bool usingSymbolLevels() const { return mUsingSymbolLevels; }
253220
void setUsingSymbolLevels( bool usingSymbolLevels ) { mUsingSymbolLevels = usingSymbolLevels; }
@@ -258,9 +225,6 @@ class CORE_EXPORT QgsFeatureRenderer
258225
//! store renderer info to XML element
259226
virtual QDomElement save( QDomDocument& doc );
260227

261-
//! create the SLD UserStyle element following the SLD v1.1 specs
262-
//! @deprecated since 2.8 - use the other override with styleName
263-
Q_DECL_DEPRECATED virtual QDomElement writeSld( QDomDocument& doc, const QgsVectorLayer &layer ) const;
264228
//! create the SLD UserStyle element following the SLD v1.1 specs with the given name
265229
//! @note added in 2.8
266230
virtual QDomElement writeSld( QDomDocument& doc, const QString& styleName, QgsStringMap props = QgsStringMap() ) const;
@@ -322,59 +286,24 @@ class CORE_EXPORT QgsFeatureRenderer
322286
//! set type and size of editing vertex markers for subsequent rendering
323287
void setVertexMarkerAppearance( int type, int size );
324288

325-
//! return rotation field name (or empty string if not set or not supported by renderer)
326-
//! @deprecated use the symbol's methods instead
327-
Q_DECL_DEPRECATED virtual QString rotationField() const { return QString(); }
328-
329-
//! sets rotation field of renderer (if supported by the renderer)
330-
//! @deprecated use the symbol's methods instead
331-
Q_DECL_DEPRECATED virtual void setRotationField( const QString& fieldName ) { Q_UNUSED( fieldName ); }
332-
333-
/** Returns whether the renderer will render a feature or not.
334-
* Must be called between startRender() and stopRender() calls.
335-
* Default implementation uses symbolForFeature().
336-
* @deprecated use willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) instead
337-
*/
338-
Q_DECL_DEPRECATED virtual bool willRenderFeature( QgsFeature& feat );
339-
340289
/** Returns whether the renderer will render a feature or not.
341290
* Must be called between startRender() and stopRender() calls.
342291
* Default implementation uses symbolForFeature().
343292
* @note added in QGIS 2.12
344-
* @note available in Python bindings as willRenderFeature2
345293
*/
346-
//TODO - QGIS 3.0 change PyName to willRenderFeature when deprecated method is removed
347294
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
348295

349-
/** Returns list of symbols used for rendering the feature.
350-
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
351-
* to use symbolForFeature()
352-
* @deprecated use symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead
353-
*/
354-
Q_DECL_DEPRECATED virtual QgsSymbolList symbolsForFeature( QgsFeature& feat );
355-
356296
/** Returns list of symbols used for rendering the feature.
357297
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
358298
* to use symbolForFeature()
359299
* @note added in QGIS 2.12
360-
* @note available in Python bindings as symbolsForFeature2
361300
*/
362-
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
363301
virtual QgsSymbolList symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
364302

365-
/** Equivalent of originalSymbolsForFeature() call
366-
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
367-
* @note added in 2.6
368-
* @deprecated use originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead
369-
*/
370-
Q_DECL_DEPRECATED virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat );
371-
372303
/** Equivalent of originalSymbolsForFeature() call
373304
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
374305
* @note added in 2.12
375-
* @note available in Python bindings as originalSymbolsForFeature2
376306
*/
377-
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
378307
virtual QgsSymbolList originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
379308

380309
/** Allows for a renderer to modify the extent of a feature request prior to rendering
@@ -497,12 +426,6 @@ class CORE_EXPORT QgsFeatureRenderer
497426
*/
498427
void copyRendererData( QgsFeatureRenderer *destRenderer ) const;
499428

500-
/** Copies paint effect of this renderer to another renderer
501-
* @param destRenderer destination renderer for copied effect
502-
* @deprecated use copyRendererData instead
503-
*/
504-
Q_DECL_DEPRECATED void copyPaintEffect( QgsFeatureRenderer *destRenderer ) const;
505-
506429
QString mType;
507430

508431
bool mUsingSymbolLevels;

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -154,27 +154,6 @@ void QgsSingleSymbolRenderer::setSymbol( QgsSymbol* s )
154154
mSymbol.reset( s );
155155
}
156156

157-
void QgsSingleSymbolRenderer::setRotationField( const QString& fieldOrExpression )
158-
{
159-
if ( mSymbol->type() == QgsSymbol::Marker )
160-
{
161-
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSymbol.data() );
162-
s->setDataDefinedAngle( QgsDataDefined( fieldOrExpression ) );
163-
}
164-
}
165-
166-
QString QgsSingleSymbolRenderer::rotationField() const
167-
{
168-
if ( mSymbol->type() == QgsSymbol::Marker )
169-
{
170-
QgsMarkerSymbol * s = static_cast<QgsMarkerSymbol *>( mSymbol.data() );
171-
QgsDataDefined ddAngle = s->dataDefinedAngle();
172-
return ddAngle.useExpression() ? ddAngle.expressionString() : ddAngle.field();
173-
}
174-
175-
return QString();
176-
}
177-
178157
void QgsSingleSymbolRenderer::setSizeScaleField( const QString& fieldOrExpression )
179158
{
180159
mSizeScale.reset( QgsSymbolLayerUtils::fieldOrExpressionToExpression( fieldOrExpression ) );

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ class CORE_EXPORT QgsSingleSymbolRenderer : public QgsFeatureRenderer
4848
QgsSymbol* symbol() const;
4949
void setSymbol( QgsSymbol* s );
5050

51-
Q_DECL_DEPRECATED void setRotationField( const QString& fieldOrExpression ) override;
52-
Q_DECL_DEPRECATED QString rotationField() const override;
53-
5451
void setSizeScaleField( const QString& fieldOrExpression );
5552
QString sizeScaleField() const;
5653

‎tests/src/python/test_qgsgraduatedsymbolrenderer.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def dumpGraduatedRenderer(r):
144144
rstr = rstr + dumpColorRamp(r.sourceColorRamp())
145145
rstr = rstr + str(r.invertedColorRamp()) + ':'
146146
rstr = rstr + dumpRangeList(r.ranges())
147-
rstr = rstr + r.rotationField() + ':'
148147
rstr = rstr + r.sizeScaleField() + ':'
149148
rstr = rstr + str(r.scaleMethod()) + ':'
150149
return rstr
@@ -315,13 +314,6 @@ def testQgsGraduatedSymbolRenderer_1(self):
315314
self.assertFalse(renderer.invertedColorRamp(),
316315
"Get/set renderer inverted color ramp")
317316

318-
value = '"value"*2'
319-
exp = QgsSymbolLayerUtils.fieldOrExpressionToExpression(value)
320-
valuestr = QgsSymbolLayerUtils.fieldOrExpressionFromExpression(exp)
321-
renderer.setRotationField(value)
322-
self.assertEqual(valuestr, renderer.rotationField(),
323-
"Get/set renderer rotation field")
324-
325317
value = '"value"*3'
326318
exp = QgsSymbolLayerUtils.fieldOrExpressionToExpression(value)
327319
valuestr = QgsSymbolLayerUtils.fieldOrExpressionFromExpression(exp)
@@ -353,7 +345,7 @@ def testQgsGraduatedSymbolRenderer_1(self):
353345
self.assertEqual(renderer.minSymbolSize(), 2)
354346
refSizes = [2, (13 + 2) * .5, 13]
355347
ctx = QgsRenderContext()
356-
for idx, symbol in enumerate(renderer.symbols2(ctx)):
348+
for idx, symbol in enumerate(renderer.symbols(ctx)):
357349
self.assertEqual(symbol.size(), refSizes[idx])
358350

359351
def testQgsGraduatedSymbolRenderer_2(self):
@@ -462,18 +454,6 @@ def testQgsGraduatedSymbolRenderer_3(self):
462454

463455
# Test retrieving data values from a layer
464456
ml = createMemoryLayer((1.2, 0.5, 5.0, 1.0, 1.0, 1.2))
465-
# ... by attribute
466-
renderer.setClassAttribute("value")
467-
self.assertEqual(renderer.classAttribute(), "value", "Error in set/get classAttribute")
468-
data = renderer.getDataValues(ml)
469-
datastr = ':'.join([str(x) for x in data])
470-
self.assertEqual(datastr, '1.2:0.5:5.0:1.0:1.0:1.2', "Error returning field data")
471-
# ... by expression
472-
renderer.setClassAttribute('"value"*"value"')
473-
self.assertEqual(renderer.classAttribute(), '"value"*"value"', "Error in set/get classAttribute")
474-
data = renderer.getDataValues(ml)
475-
datastr = ':'.join([str(x) for x in data])
476-
self.assertEqual(datastr, '1.44:0.25:25.0:1.0:1.0:1.44', "Error returning field expression")
477457

478458
renderer.setClassAttribute("value")
479459
# Equal interval calculations

‎tests/src/python/test_qgssymbolexpressionvariables.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
QgsMultiRenderChecker,
3737
QgsSingleSymbolRenderer,
3838
QgsFillSymbol,
39+
QgsRenderContext
3940
)
4041

4142
from qgis.testing import unittest, start_app
@@ -69,7 +70,7 @@ def testPartNum(self):
6970
sym1 = QgsFillSymbol.createSimple({'color': '#fdbf6f'})
7071

7172
renderer = QgsSingleSymbolRenderer(sym1)
72-
renderer.symbols()[0].symbolLayers()[0].setDataDefinedProperty('color', 'color_rgb( (@geometry_part_num - 1) * 200, 0, 0 )')
73+
renderer.symbols(QgsRenderContext())[0].symbolLayers()[0].setDataDefinedProperty('color', 'color_rgb( (@geometry_part_num - 1) * 200, 0, 0 )')
7374
self.layer.setRenderer(renderer)
7475

7576
# Setup rendering check
@@ -85,7 +86,7 @@ def testPartCount(self):
8586
sym1 = QgsFillSymbol.createSimple({'color': '#fdbf6f'})
8687

8788
renderer = QgsSingleSymbolRenderer(sym1)
88-
renderer.symbols()[0].symbolLayers()[0].setDataDefinedProperty('color', 'color_rgb( (@geometry_part_count - 1) * 200, 0, 0 )')
89+
renderer.symbols(QgsRenderContext())[0].symbolLayers()[0].setDataDefinedProperty('color', 'color_rgb( (@geometry_part_count - 1) * 200, 0, 0 )')
8990
self.layer.setRenderer(renderer)
9091

9192
# Setup rendering check
@@ -101,7 +102,7 @@ def testSymbolColor(self):
101102
sym1 = QgsFillSymbol.createSimple({'color': '#ff0000'})
102103

103104
renderer = QgsSingleSymbolRenderer(sym1)
104-
renderer.symbols()[0].symbolLayers()[0].setDataDefinedProperty('color', 'set_color_part( @symbol_color, \'value\', "Value" * 4)')
105+
renderer.symbols(QgsRenderContext())[0].symbolLayers()[0].setDataDefinedProperty('color', 'set_color_part( @symbol_color, \'value\', "Value" * 4)')
105106
self.layer.setRenderer(renderer)
106107

107108
# Setup rendering check

0 commit comments

Comments
 (0)
Please sign in to comment.