QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsinvertedpolygonrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsinvertedpolygonrenderer.h
3  ---------------------
4  begin : April 2014
5  copyright : (C) 2014 Hugo Mercier / Oslandia
6  email : hugo dot mercier at oslandia dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSINVERTEDPOLYGONRENDERER_H
16 #define QGSINVERTEDPOLYGONRENDERER_H
17 
18 #include "qgis.h"
19 #include "qgsrendererv2.h"
20 #include "qgssymbolv2.h"
21 #include "qgsexpression.h"
22 #include "qgsfeature.h"
23 #include "qgsgeometry.h"
24 #include <QScopedPointer>
25 
41 {
42  public:
43 
47  QgsInvertedPolygonRenderer( const QgsFeatureRendererV2* embeddedRenderer = 0 );
48  virtual ~QgsInvertedPolygonRenderer();
49 
51  virtual QgsFeatureRendererV2* clone();
52 
53  virtual void startRender( QgsRenderContext& context, const QgsFields& fields );
54 
64  virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
65 
70  virtual void stopRender( QgsRenderContext& context );
71 
73  virtual QString dump() const;
74 
76  virtual QList<QString> usedAttributes();
78  virtual int capabilities();
80  virtual QgsSymbolV2List symbols();
82  virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature );
86  virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize );
90  virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = "" );
92  virtual bool willRenderFeature( QgsFeature& feat );
93 
95  static QgsFeatureRendererV2* create( QDomElement& element );
96 
101  virtual QDomElement save( QDomDocument& doc );
102 
106  void setEmbeddedRenderer( const QgsFeatureRendererV2* subRenderer );
109  const QgsFeatureRendererV2* embeddedRenderer() const;
110 
112  bool preprocessingEnabled() const { return mPreprocessingEnabled; }
119  void setPreprocessingEnabled( bool enabled ) { mPreprocessingEnabled = enabled; }
120 
121  private:
126 
128  QScopedPointer<QgsFeatureRendererV2> mSubRenderer;
129 
132  {
133  QList<QgsGeometry*> geometries; //< list of geometries
134  QgsFeature feature; //< one feature (for attriute-based rendering)
135  };
136  typedef QVector<CombinedFeature> FeatureCategoryVector;
139 
141  QMap<QByteArray, int> mSymbolCategories;
142 
145 
148 
151 
156  {
158  bool selected;
160  int layer;
161  FeatureDecoration( QgsFeature& a_feature, bool a_selected, bool a_drawMarkers, int a_layer ) :
162  feature( a_feature ), selected( a_selected ), drawMarkers( a_drawMarkers ), layer( a_layer ) {}
163  };
164  QList<FeatureDecoration> mFeatureDecorations;
165 
168 };
169 
170 
171 #endif // QGSMASKRENDERERV2_H