Skip to content
Permalink
Browse files

Really fix #13545

I'm not sure what sip voodoo is preventing the bindings from
calling methods in the base class, so for QGIS <3.0 I've aliased
all the new signatures and will rename them back for 3.0
  • Loading branch information
nyalldawson committed Oct 12, 2015
1 parent ae85376 commit f9559003d441459d2d43e8b91990aa58984607d8
@@ -45,9 +45,9 @@ class QgsCategorizedSymbolRendererV2 : QgsFeatureRendererV2

virtual ~QgsCategorizedSymbolRendererV2();

virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;

virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;

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

@@ -64,7 +64,7 @@ class QgsCategorizedSymbolRendererV2 : QgsFeatureRendererV2
//! returns bitwise OR-ed capabilities of the renderer
virtual int capabilities();

virtual QgsSymbolV2List symbols( QgsRenderContext& context );
virtual QgsSymbolV2List symbols( QgsRenderContext& context ) /PyName=symbols2/;
void updateSymbols( QgsSymbolV2 * sym );

const QgsCategoryList& categories() const;
@@ -87,9 +87,9 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2

virtual ~QgsGraduatedSymbolRendererV2();

virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;

virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;

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

@@ -106,7 +106,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2
//! returns bitwise OR-ed capabilities of the renderer
virtual int capabilities();

virtual QgsSymbolV2List symbols( QgsRenderContext& context );
virtual QgsSymbolV2List symbols( QgsRenderContext& context ) /PyName=symbols2/;

QString classAttribute() const;
void setClassAttribute( const QString& attr );
@@ -13,8 +13,8 @@ class QgsHeatmapRenderer : QgsFeatureRendererV2
virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
virtual void stopRender( QgsRenderContext& context );
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2List symbols( QgsRenderContext& context );
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
virtual QgsSymbolV2List symbols( QgsRenderContext& context ) /PyName=symbols2/;
virtual QString dump() const;
virtual QList<QString> usedAttributes();
static QgsFeatureRendererV2* create( QDomElement& element ) /Factory/;
@@ -41,23 +41,23 @@ class QgsInvertedPolygonRenderer : QgsFeatureRendererV2
/** Proxy that will call this method on the embedded renderer. */
virtual int capabilities();
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2List symbols( QgsRenderContext& context );
virtual QgsSymbolV2List symbols( QgsRenderContext& context ) /PyName=symbols2/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context );
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize );
/** Proxy that will call this method on the embedded renderer.
@note not available in python bindings
*/
// virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = "" );
/** Proxy that will call this method on the embedded renderer. */
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;

/** Creates a renderer out of an XML, for loading*/
static QgsFeatureRendererV2* create( QDomElement& element ) /Factory/;
@@ -28,17 +28,17 @@ class QgsPointDisplacementRenderer : QgsFeatureRendererV2
/** Proxy that will call this method on the embedded renderer. */
virtual int capabilities();
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2List symbols( QgsRenderContext& context );
virtual QgsSymbolV2List symbols( QgsRenderContext& context ) /PyName=symbols2/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context );
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature2/;
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;
/** Proxy that will call this method on the embedded renderer. */
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;

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

@@ -72,9 +72,10 @@ class QgsFeatureRendererV2
* @param context render context
* @return returns pointer to symbol or 0 if symbol was not found
* @note added in QGIS 2.12
* @note available in Python bindings as symbolForFeature2
*/
//TODO - make pure virtual when above method is removed
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
//TODO - QGIS 3.0 change PyName to symbolForFeature when deprecated method is removed
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;

/**
* Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
@@ -89,8 +90,10 @@ class QgsFeatureRendererV2
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
* of a symbol for use in rendering.
* @note added in 2.12
* @note available in Python bindings as originalSymbolForFeature2
*/
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
//TODO - QGIS 3.0 change PyName to originalSymbolForFeature when deprecated method is removed
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;

virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) = 0;

@@ -130,8 +133,10 @@ class QgsFeatureRendererV2
/** Returns list of symbols used by the renderer.
* @param context render context
* @note added in QGIS 2.12
* @note available in Python bindings as symbols2
*/
virtual QgsSymbolV2List symbols( QgsRenderContext& context );
//TODO - QGIS 3.0 change PyName to symbols when deprecated method is removed
virtual QgsSymbolV2List symbols( QgsRenderContext& context ) /PyName=symbols2/;

bool usingSymbolLevels() const;
void setUsingSymbolLevels( bool usingSymbolLevels );
@@ -209,28 +214,37 @@ class QgsFeatureRendererV2
* Must be called between startRender() and stopRender() calls.
* Default implementation uses symbolForFeature().
* @note added in QGIS 2.12
* @note available in Python bindings as willRenderFeature2
*/
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );
//TODO - QGIS 3.0 change PyName to willRenderFeature when deprecated method is removed
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/;

//! return list of symbols used for rendering the feature.
//! For renderers that do not support MoreSymbolsPerFeature it is more efficient
//! to use symbolForFeature()
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat ) /Deprecated/;

//! return list of symbols used for rendering the feature.
//! For renderers that do not support MoreSymbolsPerFeature it is more efficient
//! to use symbolForFeature()
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
/** Returns list of symbols used for rendering the feature.
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
* to use symbolForFeature()
* @note added in QGIS 2.12
* @note available in Python bindings as symbolsForFeature2
*/
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature2/;

//! Equivalent of originalSymbolsForFeature() call
//! extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
//! @note added in 2.6
virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat ) /Deprecated/;

//! Equivalent of originalSymbolsForFeature() call
//! extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
//! @note added in 2.6
virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );
/** Equivalent of originalSymbolsForFeature() call
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
* @note added in 2.12
* @note available in Python bindings as originalSymbolsForFeature2
*/
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=originalSymbolsForFeature2/;

/** Allows for a renderer to modify the extent of a feature request prior to rendering
* @param extent reference to request's filter extent. Modify extent to change the
@@ -67,7 +67,7 @@ class QgsRuleBasedRendererV2 : QgsFeatureRendererV2
~Rule();
QString dump( int offset = 0 ) const;
QSet<QString> usedAttributes();
QgsSymbolV2List symbols( const QgsRenderContext& context = QgsRenderContext() );
QgsSymbolV2List symbols( const QgsRenderContext& context = QgsRenderContext() ) /PyName=symbols2/;
//! @note not available in python bindings
// QgsLegendSymbolList legendSymbolItems();
//! @note added in 2.6
@@ -9,9 +9,9 @@ class QgsSingleSymbolRendererV2 : QgsFeatureRendererV2

virtual ~QgsSingleSymbolRendererV2();

virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=symbolForFeature2/;

virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) /PyName=originalSymbolForFeature2/;

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

@@ -41,7 +41,7 @@ class QgsSingleSymbolRendererV2 : QgsFeatureRendererV2
//! returns bitwise OR-ed capabilities of the renderer
virtual int capabilities();

virtual QgsSymbolV2List symbols( QgsRenderContext& context );
virtual QgsSymbolV2List symbols( QgsRenderContext& context ) /PyName=symbols2/;

//! create renderer from XML element
static QgsFeatureRendererV2* create( QDomElement& element ) /Factory/;
@@ -92,8 +92,10 @@ class CORE_EXPORT QgsFeatureRendererV2
* @param context render context
* @return returns pointer to symbol or 0 if symbol was not found
* @note added in QGIS 2.12
* @note available in Python bindings as symbolForFeature2
*/
//TODO - make pure virtual when above method is removed
//TODO - QGIS 3.0 make pure virtual when above method is removed
//TODO - QGIS 3.0 change PyName to symbolForFeature when deprecated method is removed
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );

/**
@@ -109,7 +111,9 @@ class CORE_EXPORT QgsFeatureRendererV2
* symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
* of a symbol for use in rendering.
* @note added in 2.12
* @note available in Python bindings as originalSymbolForFeature2
*/
//TODO - QGIS 3.0 change PyName to originalSymbolForFeature when deprecated method is removed
virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context );

/**
@@ -168,7 +172,9 @@ class CORE_EXPORT QgsFeatureRendererV2
/** Returns list of symbols used by the renderer.
* @param context render context
* @note added in QGIS 2.12
* @note available in Python bindings as symbols2
*/
//TODO - QGIS 3.0 change PyName to symbols when deprecated method is removed
virtual QgsSymbolV2List symbols( QgsRenderContext& context );

bool usingSymbolLevels() const { return mUsingSymbolLevels; }
@@ -251,27 +257,36 @@ class CORE_EXPORT QgsFeatureRendererV2
* Must be called between startRender() and stopRender() calls.
* Default implementation uses symbolForFeature().
* @note added in QGIS 2.12
* @note available in Python bindings as willRenderFeature2
*/
//TODO - QGIS 3.0 change PyName to willRenderFeature when deprecated method is removed
virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context );

//! return list of symbols used for rendering the feature.
//! For renderers that do not support MoreSymbolsPerFeature it is more efficient
//! to use symbolForFeature()
Q_DECL_DEPRECATED virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat );

//! return list of symbols used for rendering the feature.
//! For renderers that do not support MoreSymbolsPerFeature it is more efficient
//! to use symbolForFeature()
/** Returns list of symbols used for rendering the feature.
* For renderers that do not support MoreSymbolsPerFeature it is more efficient
* to use symbolForFeature()
* @note added in QGIS 2.12
* @note available in Python bindings as symbolsForFeature2
*/
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context );

//! Equivalent of originalSymbolsForFeature() call
//! extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
//! @note added in 2.6
Q_DECL_DEPRECATED virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat );

//! Equivalent of originalSymbolsForFeature() call
//! extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
//! @note added in 2.6
/** Equivalent of originalSymbolsForFeature() call
* extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
* @note added in 2.12
* @note available in Python bindings as originalSymbolsForFeature2
*/
//TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed
virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context );

/** Allows for a renderer to modify the extent of a feature request prior to rendering
@@ -356,7 +356,7 @@ def testQgsGraduatedSymbolRendererV2_1(self):
self.assertEqual(renderer.minSymbolSize(), 2)
refSizes = [2, (13 + 2) * .5, 13]
ctx = QgsRenderContext()
for idx, symbol in enumerate(renderer.symbols(ctx)):
for idx, symbol in enumerate(renderer.symbols2(ctx)):
self.assertEqual(symbol.size(), refSizes[idx])

def testQgsGraduatedSymbolRendererV2_2(self):

0 comments on commit f955900

Please sign in to comment.
You can’t perform that action at this time.