Skip to content

Commit a9ae722

Browse files
author
wonder
committedJan 5, 2010
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
1 parent 362de6b commit a9ae722

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
 

‎python/core/qgsrenderer.sip

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,34 @@ class QgsRenderer
44
{
55
%TypeHeaderCode
66
#include <qgsrenderer.h>
7+
#include <qgssinglesymbolrenderer.h>
8+
#include <qgsuniquevaluerenderer.h>
9+
#include <qgsgraduatedsymbolrenderer.h>
10+
#include <qgscontinuouscolorrenderer.h>
711
%End
12+
13+
%ConvertToSubClassCode
14+
if (dynamic_cast<QgsSingleSymbolRenderer*>(sipCpp) != NULL)
15+
sipClass = sipClass_QgsSingleSymbolRenderer;
16+
else if (dynamic_cast<QgsUniqueValueRenderer*>(sipCpp) != NULL)
17+
sipClass = sipClass_QgsUniqueValueRenderer;
18+
else if (dynamic_cast<QgsGraduatedSymbolRenderer*>(sipCpp) != NULL)
19+
sipClass = sipClass_QgsGraduatedSymbolRenderer;
20+
else if (dynamic_cast<QgsContinuousColorRenderer*>(sipCpp) != NULL)
21+
sipClass = sipClass_QgsContinuousColorRenderer;
22+
else
23+
sipClass = 0;
24+
%End
25+
826

927
public:
1028
/** Default ctor sets up selection color from project properties */
1129
QgsRenderer();
1230
/** Virtual destructor because we have virtual methods... */
1331
virtual ~QgsRenderer();
32+
/** Determines if a feature will be rendered or not
33+
@param f a pointer to the feature to determine if rendering will happen*/
34+
virtual bool willRenderFeature( QgsFeature *f );
1435
/**A vector layer passes features to a renderer object to change the brush and pen of the qpainter
1536
@param p the painter storing brush and pen
1637
@param f a pointer to the feature to be rendered
@@ -59,6 +80,9 @@ class QgsRenderer
5980
/**Returns true if this renderer uses its own transparency settings, e.g. differentiated by classification.
6081
This is a hint for QgsVectorLayer to not use the transparency setting on layer level in this cases*/
6182
virtual bool usesTransparency() const;
83+
84+
/**Scales a brush to a given raster scale factor (e.g. for printing)*/
85+
static void scaleBrush( QBrush& b, double rasterScaleFactor );
6286

6387
};
6488

‎python/core/qgssinglesymbolrenderer.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class QgsSingleSymbolRenderer : QgsRenderer
3131
bool needsAttributes() const;
3232
/**Returns an empty list, since no classification attributes are used*/
3333
QList<int> classificationAttributes() const;
34+
void updateSymbolAttributes();
3435
/**Returns the renderers name*/
3536
virtual QString name() const;
3637
/**Returns a list containing mSymbol*/

0 commit comments

Comments
 (0)
Please sign in to comment.