From a9ae72243e982f3a37b21c6c8b4eda39c35dbf90 Mon Sep 17 00:00:00 2001 From: wonder Date: Tue, 5 Jan 2010 14:09:31 +0000 Subject: [PATCH] PyQGIS: added missing conversion to QgsRenderer subclasses, added few missing methods git-svn-id: http://svn.osgeo.org/qgis/trunk@12672 c8812cc2-4d05-0410-92ff-de0c093fc19c --- python/core/qgsrenderer.sip | 24 ++++++++++++++++++++++++ python/core/qgssinglesymbolrenderer.sip | 1 + 2 files changed, 25 insertions(+) diff --git a/python/core/qgsrenderer.sip b/python/core/qgsrenderer.sip index 702d73394d5..1d7a77e8d0c 100644 --- a/python/core/qgsrenderer.sip +++ b/python/core/qgsrenderer.sip @@ -4,13 +4,34 @@ class QgsRenderer { %TypeHeaderCode #include +#include +#include +#include +#include %End + +%ConvertToSubClassCode + if (dynamic_cast(sipCpp) != NULL) + sipClass = sipClass_QgsSingleSymbolRenderer; + else if (dynamic_cast(sipCpp) != NULL) + sipClass = sipClass_QgsUniqueValueRenderer; + else if (dynamic_cast(sipCpp) != NULL) + sipClass = sipClass_QgsGraduatedSymbolRenderer; + else if (dynamic_cast(sipCpp) != NULL) + sipClass = sipClass_QgsContinuousColorRenderer; + else + sipClass = 0; +%End + public: /** Default ctor sets up selection color from project properties */ QgsRenderer(); /** Virtual destructor because we have virtual methods... */ virtual ~QgsRenderer(); + /** Determines if a feature will be rendered or not + @param f a pointer to the feature to determine if rendering will happen*/ + virtual bool willRenderFeature( QgsFeature *f ); /**A vector layer passes features to a renderer object to change the brush and pen of the qpainter @param p the painter storing brush and pen @param f a pointer to the feature to be rendered @@ -59,6 +80,9 @@ class QgsRenderer /**Returns true if this renderer uses its own transparency settings, e.g. differentiated by classification. This is a hint for QgsVectorLayer to not use the transparency setting on layer level in this cases*/ virtual bool usesTransparency() const; + + /**Scales a brush to a given raster scale factor (e.g. for printing)*/ + static void scaleBrush( QBrush& b, double rasterScaleFactor ); }; diff --git a/python/core/qgssinglesymbolrenderer.sip b/python/core/qgssinglesymbolrenderer.sip index 26539c2b3c0..80c1727db6f 100644 --- a/python/core/qgssinglesymbolrenderer.sip +++ b/python/core/qgssinglesymbolrenderer.sip @@ -31,6 +31,7 @@ class QgsSingleSymbolRenderer : QgsRenderer bool needsAttributes() const; /**Returns an empty list, since no classification attributes are used*/ QList classificationAttributes() const; + void updateSymbolAttributes(); /**Returns the renderers name*/ virtual QString name() const; /**Returns a list containing mSymbol*/