Skip to content
Permalink
Browse files
Inverted polygons renderer: add SIP
  • Loading branch information
Hugo Mercier committed May 23, 2014
1 parent 0ff587c commit 66ac1eda38b36de4c93be7a1bb11644cd7423886
Showing with 95 additions and 0 deletions.
  1. +1 −0 python/core/core.sip
  2. +70 −0 python/core/symbology-ng/qgsinvertedpolygonrenderer.sip
  3. +1 −0 python/gui/gui.sip
  4. +23 −0 python/gui/symbology-ng/qgsinvertedpolygonrendererwidget.sip
@@ -206,6 +206,7 @@
%Include symbology-ng/qgssinglesymbolrendererv2.sip
%Include symbology-ng/qgspointdisplacementrenderer.sip
%Include symbology-ng/qgsrulebasedrendererv2.sip
%Include symbology-ng/qgsinvertedpolygonrenderer.sip
%Include symbology-ng/qgsrendererv2.sip
%Include symbology-ng/qgsrendererv2registry.sip

@@ -0,0 +1,70 @@
class QgsInvertedPolygonRenderer : public QgsFeatureRendererV2
{
%TypeHeaderCode
#include <qgsinvertedpolygonrenderer.h>
%End
public:

/** Constructor
* @param embeddedRenderer optional embeddedRenderer. If null, a default one will be assigned
*/
QgsInvertedPolygonRenderer( const QgsFeatureRendererV2* embeddedRenderer = 0 );
virtual ~QgsInvertedPolygonRenderer();

/** Used to clone this feature renderer.*/
virtual QgsFeatureRendererV2* clone();

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

/** Renders a given feature.
* This will here collect features. The actual rendering will be postponed to stopRender()
* @param feature the feature to render
* @param context the rendering context
* @param layer the symbol layer to render, if that makes sense
* @param selected whether this feature has been selected (this will add decorations)
* @param drawVertexMarker whether this feature has vertex markers (in edit mode usually)
* @returns true if the rendering was ok
*/
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

/**
* The actual rendering will take place here.
* Features collected during renderFeature() are rendered using the embedded feature renderer
*/
virtual void stopRender( QgsRenderContext& context );

/** @returns a textual reprensation of the renderer */
virtual QString dump() const;

/** Proxy that will call this method on the embedded renderer. */
virtual QList<QString> usedAttributes();
/** 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();
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature );
/** Proxy that will call this method on the embedded renderer. */
virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat );
/** 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. */
virtual bool willRenderFeature( QgsFeature& feat );

/** Creates a renderer out of an XML, for loading*/
static QgsFeatureRendererV2* create( QDomElement& element );

/** Creates an XML representation of the renderer. Used for saving purpose
* @param doc the XML document where to create the XML subtree
* @returns the created XML subtree
*/
virtual QDomElement save( QDomDocument& doc );

/** sets the embedded renderer
* @param subRenderer the embedded renderer (will be cloned)
*/
void setEmbeddedRenderer( const QgsFeatureRendererV2* subRenderer );
/** @returns the current embedded renderer
*/
const QgsFeatureRendererV2* embeddedRenderer() const;
};
@@ -120,6 +120,7 @@
%Include symbology-ng/qgscptcitycolorrampv2dialog.sip
%Include symbology-ng/qgsellipsesymbollayerv2widget.sip
%Include symbology-ng/qgsgraduatedsymbolrendererv2widget.sip
%Include symbology-ng/qgsinvertedpolygonrendererwidget.sip
%Include symbology-ng/qgslayerpropertieswidget.sip
%Include symbology-ng/qgspenstylecombobox.sip
%Include symbology-ng/qgspointdisplacementrendererwidget.sip
@@ -0,0 +1,23 @@
class QgsInvertedPolygonRendererWidget : public QgsRendererV2Widget, private Ui::QgsInvertedPolygonRendererWidgetBase
{
%TypeHeaderCode
#include <qgsinvertedpolygonrendererwidget.h>
%End
public:
/** static creation method
* @param layer the layer where this renderer is applied
* @param style
* @param renderer the mask renderer (will take ownership)
*/
static QgsRendererV2Widget* create( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer );

/** Constructor
* @param layer the layer where this renderer is applied
* @param style
* @param renderer the mask renderer (will take ownership)
*/
QgsInvertedPolygonRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer );

/** @returns the current feature renderer */
virtual QgsFeatureRendererV2* renderer();
};

0 comments on commit 66ac1ed

Please sign in to comment.