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
This commit is contained in:
Nyall Dawson 2015-10-12 21:50:49 +11:00
parent ae85376614
commit f9559003d4
10 changed files with 74 additions and 45 deletions

View File

@ -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;

View File

@ -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 );

View File

@ -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/;

View File

@ -41,15 +41,15 @@ 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.
@ -57,7 +57,7 @@ class QgsInvertedPolygonRenderer : QgsFeatureRendererV2
*/
// 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/;

View File

@ -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 );

View File

@ -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

View File

@ -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

View File

@ -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/;

View File

@ -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,7 +257,9 @@ 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.
@ -259,9 +267,13 @@ class CORE_EXPORT QgsFeatureRendererV2
//! 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
@ -269,9 +281,12 @@ class CORE_EXPORT QgsFeatureRendererV2
//! @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

View File

@ -356,7 +356,7 @@ class TestQgsGraduatedSymbolRendererV2(TestCase):
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):