QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | List of all members
QgsInvertedPolygonRenderer Class Reference

QgsInvertedPolygonRenderer is a polygon-only feature renderer used to display features inverted, where the exterior is turned to an interior and where the exterior theoretically spans the entire plane, allowing to mask the surroundings of some features. More...

#include <qgsinvertedpolygonrenderer.h>

Inheritance diagram for QgsInvertedPolygonRenderer:
Inheritance graph
[legend]

Classes

struct  CombinedFeature
 Structure where the reversed geometry is built during renderFeature.
struct  FeatureDecoration
 Class used to represent features that must be rendered with decorations (selection, vertex markers)

Public Member Functions

 QgsInvertedPolygonRenderer (const QgsFeatureRendererV2 *embeddedRenderer=0)
 Constructor.
virtual ~QgsInvertedPolygonRenderer ()
virtual int capabilities () override
 Proxy that will call this method on the embedded renderer.
virtual QgsFeatureRendererV2clone () const override
 Used to clone this feature renderer.
virtual QString dump () const override
const QgsFeatureRendererV2embeddedRenderer () const
virtual QgsLegendSymbolList legendSymbolItems (double scaleDenominator=-1, QString rule="") override
 Proxy that will call this method on the embedded renderer.
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize) override
 Proxy that will call this method on the embedded renderer.
virtual QgsSymbolV2originalSymbolForFeature (QgsFeature &feat) override
 Proxy that will call this method on the embedded renderer.
virtual QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat) override
 Proxy that will call this method on the embedded renderer.
bool preprocessingEnabled () const
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false) override
 Renders a given feature.
virtual QDomElement save (QDomDocument &doc) override
 Creates an XML representation of the renderer.
void setEmbeddedRenderer (const QgsFeatureRendererV2 *subRenderer)
 sets the embedded renderer
void setPreprocessingEnabled (bool enabled)
virtual void startRender (QgsRenderContext &context, const QgsFields &fields) override
virtual void stopRender (QgsRenderContext &context) override
 The actual rendering will take place here.
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature) override
 Proxy that will call this method on the embedded renderer.
virtual QgsSymbolV2List symbols () override
 Proxy that will call this method on the embedded renderer.
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat) override
 Proxy that will call this method on the embedded renderer.
virtual QList< QString > usedAttributes () override
 Proxy that will call this method on the embedded renderer.
virtual bool willRenderFeature (QgsFeature &feat) override
 Proxy that will call this method on the embedded renderer.
- Public Member Functions inherited from QgsFeatureRendererV2
virtual ~QgsFeatureRendererV2 ()
virtual void checkLegendSymbolItem (QString key, bool state=true)
 item in symbology was checked
virtual QString legendClassificationAttribute () const
 If supported by the renderer, return classification attribute for the use in legend.
virtual bool legendSymbolItemChecked (QString key)
 items of symbology items in legend is checked
virtual bool legendSymbolItemsCheckable () const
 items of symbology items in legend should be checkable
virtual QgsLegendSymbolListV2 legendSymbolItemsV2 () const
 Return a list of symbology items for the legend.
virtual void modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context)
 Allows for a renderer to modify the extent of a feature request prior to rendering.
virtual QString rotationField () const
 return rotation field name (or empty string if not set or not supported by renderer)
virtual void setRotationField (QString fieldName)
 sets rotation field of renderer (if supported by the renderer)
void setUsingSymbolLevels (bool usingSymbolLevels)
void setVertexMarkerAppearance (int type, int size)
 set type and size of editing vertex markers for subsequent rendering
virtual Q_DECL_DEPRECATED void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
virtual void toSld (QDomDocument &doc, QDomElement &element) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs
QString type () const
bool usingSymbolLevels () const
virtual Q_DECL_DEPRECATED
QDomElement 
writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const
 create the SLD UserStyle element following the SLD v1.1 specs
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name

Static Public Member Functions

static QgsInvertedPolygonRendererconvertFromRenderer (const QgsFeatureRendererV2 *renderer)
 creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.
static QgsFeatureRendererV2create (QDomElement &element)
 Creates a renderer out of an XML, for loading.
- Static Public Member Functions inherited from QgsFeatureRendererV2
static QgsFeatureRendererV2defaultRenderer (QGis::GeometryType geomType)
 return a new renderer - used by default in vector layers
static QgsFeatureRendererV2load (QDomElement &symbologyElem)
 create a renderer from XML element
static QgsFeatureRendererV2loadSld (const QDomNode &node, QGis::GeometryType geomType, QString &errorMessage)
 create a new renderer according to the information contained in the UserStyle element of a SLD style document

Additional Inherited Members

- Public Types inherited from QgsFeatureRendererV2
enum  Capabilities {
  SymbolLevels = 1, RotationField = 1 << 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3,
  ScaleDependent = 1 << 4
}
- Protected Member Functions inherited from QgsFeatureRendererV2
 QgsFeatureRendererV2 (QString type)
void renderFeatureWithSymbol (QgsFeature &feature, QgsSymbolV2 *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker)
void renderVertexMarker (QPointF &pt, QgsRenderContext &context)
 render editing vertex marker at specified point
void renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
 render editing vertex marker for a polygon
void renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context)
 render editing vertex marker for a polyline
void setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod)
- Static Protected Member Functions inherited from QgsFeatureRendererV2
static const unsigned char * _getLineString (QPolygonF &pts, QgsRenderContext &context, const unsigned char *wkb)
static const unsigned char * _getPoint (QPointF &pt, QgsRenderContext &context, const unsigned char *wkb)
static const unsigned char * _getPolygon (QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, const unsigned char *wkb)
- Protected Attributes inherited from QgsFeatureRendererV2
int mCurrentVertexMarkerSize
 The current size of editing marker.
int mCurrentVertexMarkerType
 The current type of editing marker.
QString mType
bool mUsingSymbolLevels

Detailed Description

QgsInvertedPolygonRenderer is a polygon-only feature renderer used to display features inverted, where the exterior is turned to an interior and where the exterior theoretically spans the entire plane, allowing to mask the surroundings of some features.

It is designed on top of another feature renderer, which is called "embedded" Most of the methods are then only proxies to the embedded renderer.

Features are collected to form one "inverted" polygon during renderFeature() and rendered on stopRender().

Note
added in 2.4

Definition at line 40 of file qgsinvertedpolygonrenderer.h.

Constructor & Destructor Documentation

QgsInvertedPolygonRenderer::QgsInvertedPolygonRenderer ( const QgsFeatureRendererV2 embeddedRenderer = 0)

Constructor.

Parameters
embeddedRendereroptional embeddedRenderer. If null, a default one will be assigned

Definition at line 30 of file qgsinvertedpolygonrenderer.cpp.

QgsInvertedPolygonRenderer::~QgsInvertedPolygonRenderer ( )
virtual

Definition at line 44 of file qgsinvertedpolygonrenderer.cpp.

Member Function Documentation

int QgsInvertedPolygonRenderer::capabilities ( )
overridevirtual

Proxy that will call this method on the embedded renderer.

Reimplemented from QgsFeatureRendererV2.

Definition at line 412 of file qgsinvertedpolygonrenderer.cpp.

QgsFeatureRendererV2 * QgsInvertedPolygonRenderer::clone ( ) const
overridevirtual

Used to clone this feature renderer.

Implements QgsFeatureRendererV2.

Definition at line 328 of file qgsinvertedpolygonrenderer.cpp.

QgsInvertedPolygonRenderer * QgsInvertedPolygonRenderer::convertFromRenderer ( const QgsFeatureRendererV2 renderer)
static

creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.

Note
added in 2.5
Returns
a new renderer if the conversion was possible, otherwise 0.

Definition at line 457 of file qgsinvertedpolygonrenderer.cpp.

QgsFeatureRendererV2 * QgsInvertedPolygonRenderer::create ( QDomElement &  element)
static

Creates a renderer out of an XML, for loading.

Definition at line 343 of file qgsinvertedpolygonrenderer.cpp.

QString QgsInvertedPolygonRenderer::dump ( ) const
overridevirtual
Returns
a textual representation of the renderer

Reimplemented from QgsFeatureRendererV2.

Definition at line 319 of file qgsinvertedpolygonrenderer.cpp.

const QgsFeatureRendererV2 * QgsInvertedPolygonRenderer::embeddedRenderer ( ) const
Returns
the current embedded renderer

Definition at line 60 of file qgsinvertedpolygonrenderer.cpp.

QgsLegendSymbolList QgsInvertedPolygonRenderer::legendSymbolItems ( double  scaleDenominator = -1,
QString  rule = "" 
)
overridevirtual

Proxy that will call this method on the embedded renderer.

Note
not available in python bindings

Reimplemented from QgsFeatureRendererV2.

Definition at line 439 of file qgsinvertedpolygonrenderer.cpp.

QgsLegendSymbologyList QgsInvertedPolygonRenderer::legendSymbologyItems ( QSize  iconSize)
overridevirtual

Proxy that will call this method on the embedded renderer.

Reimplemented from QgsFeatureRendererV2.

Definition at line 430 of file qgsinvertedpolygonrenderer.cpp.

QgsSymbolV2 * QgsInvertedPolygonRenderer::originalSymbolForFeature ( QgsFeature feat)
overridevirtual

Proxy that will call this method on the embedded renderer.

Reimplemented from QgsFeatureRendererV2.

Definition at line 380 of file qgsinvertedpolygonrenderer.cpp.

QgsSymbolV2List QgsInvertedPolygonRenderer::originalSymbolsForFeature ( QgsFeature feat)
overridevirtual

Proxy that will call this method on the embedded renderer.

Reimplemented from QgsFeatureRendererV2.

Definition at line 396 of file qgsinvertedpolygonrenderer.cpp.

bool QgsInvertedPolygonRenderer::preprocessingEnabled ( ) const
inline
Returns
true if the geometries are to be preprocessed (merged with an union) before rendering.

Definition at line 116 of file qgsinvertedpolygonrenderer.h.

bool QgsInvertedPolygonRenderer::renderFeature ( QgsFeature feature,
QgsRenderContext context,
int  layer = -1,
bool  selected = false,
bool  drawVertexMarker = false 
)
overridevirtual

Renders a given feature.

This will here collect features. The actual rendering will be postponed to stopRender()

Parameters
featurethe feature to render
contextthe rendering context
layerthe symbol layer to render, if that makes sense
selectedwhether this feature has been selected (this will add decorations)
drawVertexMarkerwhether this feature has vertex markers (in edit mode usually)
Returns
true if the rendering was ok

Reimplemented from QgsFeatureRendererV2.

Definition at line 123 of file qgsinvertedpolygonrenderer.cpp.

QDomElement QgsInvertedPolygonRenderer::save ( QDomDocument &  doc)
overridevirtual

Creates an XML representation of the renderer.

Used for saving purpose

Parameters
docthe XML document where to create the XML subtree
Returns
the created XML subtree

Reimplemented from QgsFeatureRendererV2.

Definition at line 356 of file qgsinvertedpolygonrenderer.cpp.

void QgsInvertedPolygonRenderer::setEmbeddedRenderer ( const QgsFeatureRendererV2 subRenderer)

sets the embedded renderer

Parameters
subRendererthe embedded renderer (will be cloned)

Definition at line 48 of file qgsinvertedpolygonrenderer.cpp.

void QgsInvertedPolygonRenderer::setPreprocessingEnabled ( bool  enabled)
inline
Parameters
enabledenables or disables the preprocessing. When enabled, geometries will be merged with an union before being rendered. It allows fixing some rendering artefacts (when rendering overlapping polygons for instance). This will involve some CPU-demanding computations and is thus disabled by default.

Definition at line 123 of file qgsinvertedpolygonrenderer.h.

void QgsInvertedPolygonRenderer::startRender ( QgsRenderContext context,
const QgsFields fields 
)
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 65 of file qgsinvertedpolygonrenderer.cpp.

void QgsInvertedPolygonRenderer::stopRender ( QgsRenderContext context)
overridevirtual

The actual rendering will take place here.

Features collected during renderFeature() are rendered using the embedded feature renderer

Implements QgsFeatureRendererV2.

Definition at line 215 of file qgsinvertedpolygonrenderer.cpp.

QgsSymbolV2 * QgsInvertedPolygonRenderer::symbolForFeature ( QgsFeature feature)
overridevirtual

Proxy that will call this method on the embedded renderer.

Implements QgsFeatureRendererV2.

Definition at line 371 of file qgsinvertedpolygonrenderer.cpp.

QgsSymbolV2List QgsInvertedPolygonRenderer::symbols ( )
overridevirtual

Proxy that will call this method on the embedded renderer.

Implements QgsFeatureRendererV2.

Definition at line 403 of file qgsinvertedpolygonrenderer.cpp.

QgsSymbolV2List QgsInvertedPolygonRenderer::symbolsForFeature ( QgsFeature feat)
overridevirtual

Proxy that will call this method on the embedded renderer.

Reimplemented from QgsFeatureRendererV2.

Definition at line 387 of file qgsinvertedpolygonrenderer.cpp.

QList< QString > QgsInvertedPolygonRenderer::usedAttributes ( )
overridevirtual

Proxy that will call this method on the embedded renderer.

Implements QgsFeatureRendererV2.

Definition at line 421 of file qgsinvertedpolygonrenderer.cpp.

bool QgsInvertedPolygonRenderer::willRenderFeature ( QgsFeature feat)
overridevirtual

Proxy that will call this method on the embedded renderer.

Reimplemented from QgsFeatureRendererV2.

Definition at line 448 of file qgsinvertedpolygonrenderer.cpp.


The documentation for this class was generated from the following files: