QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
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>
Public Member Functions | |
QgsInvertedPolygonRenderer (QgsFeatureRendererV2 *embeddedRenderer=nullptr) | |
Constructor. More... | |
virtual | ~QgsInvertedPolygonRenderer () |
virtual int | capabilities () override |
Proxy that will call this method on the embedded renderer. More... | |
virtual void | checkLegendSymbolItem (const QString &key, bool state=true) override |
item in symbology was checked More... | |
virtual QgsInvertedPolygonRenderer * | clone () const override |
Used to clone this feature renderer. More... | |
virtual QString | dump () const override |
const QgsFeatureRendererV2 * | embeddedRenderer () const override |
Returns the current embedded renderer (subrenderer) for this feature renderer. More... | |
virtual bool | legendSymbolItemChecked (const QString &key) override |
items of symbology items in legend is checked More... | |
virtual QgsLegendSymbolList | legendSymbolItems (double scaleDenominator=-1, const QString &rule="") override |
Proxy that will call this method on the embedded renderer. More... | |
virtual bool | legendSymbolItemsCheckable () const override |
items of symbology items in legend should be checkable More... | |
virtual QgsLegendSymbolListV2 | legendSymbolItemsV2 () const override |
Return a list of symbology items for the legend. More... | |
virtual QgsLegendSymbologyList | legendSymbologyItems (QSize iconSize) override |
Proxy that will call this method on the embedded renderer. More... | |
virtual QgsSymbolV2 * | originalSymbolForFeature (QgsFeature &feat, QgsRenderContext &context) override |
Proxy that will call this method on the embedded renderer. More... | |
virtual QgsSymbolV2List | originalSymbolsForFeature (QgsFeature &feat, QgsRenderContext &context) override |
Proxy that will call this method on the embedded renderer. More... | |
bool | preprocessingEnabled () const |
virtual bool | renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false) override |
Renders a given feature. More... | |
virtual QDomElement | save (QDomDocument &doc) override |
Creates an XML representation of the renderer. More... | |
void | setEmbeddedRenderer (QgsFeatureRendererV2 *subRenderer) override |
Sets an embedded renderer (subrenderer) for this feature renderer. More... | |
virtual void | setLegendSymbolItem (const QString &key, QgsSymbolV2 *symbol) override |
Sets the symbol to be used for a legend symbol item. More... | |
void | setPreprocessingEnabled (bool enabled) |
virtual void | startRender (QgsRenderContext &context, const QgsFields &fields) override |
Needs to be called when a new render cycle is started. More... | |
virtual void | stopRender (QgsRenderContext &context) override |
The actual rendering will take place here. More... | |
virtual QgsSymbolV2 * | symbolForFeature (QgsFeature &feature, QgsRenderContext &context) override |
Proxy that will call this method on the embedded renderer. More... | |
virtual QgsSymbolV2List | symbols (QgsRenderContext &context) override |
Proxy that will call this method on the embedded renderer. More... | |
virtual QgsSymbolV2List | symbolsForFeature (QgsFeature &feat, QgsRenderContext &context) override |
Proxy that will call this method on the embedded renderer. More... | |
virtual QList< QString > | usedAttributes () override |
Proxy that will call this method on the embedded renderer. More... | |
virtual bool | willRenderFeature (QgsFeature &feat, QgsRenderContext &context) override |
Proxy that will call this method on the embedded renderer. More... | |
Public Member Functions inherited from QgsFeatureRendererV2 | |
virtual | ~QgsFeatureRendererV2 () |
virtual QString | filter (const QgsFields &fields=QgsFields()) |
If a renderer does not require all the features this method may be overridden and return an expression used as where clause. More... | |
virtual bool | filterNeedsGeometry () const |
Returns true if this renderer requires the geometry to apply the filter. More... | |
bool | forceRasterRender () const |
Returns whether the renderer must render as a raster. More... | |
virtual QString | legendClassificationAttribute () const |
If supported by the renderer, return classification attribute for the use in legend. More... | |
virtual QSet< QString > | legendKeysForFeature (QgsFeature &feature, QgsRenderContext &context) |
Return legend keys matching a specified feature. More... | |
virtual void | modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context) |
Allows for a renderer to modify the extent of a feature request prior to rendering. More... | |
QgsFeatureRequest::OrderBy | orderBy () const |
Get the order in which features shall be processed by this renderer. More... | |
bool | orderByEnabled () const |
Returns whether custom ordering will be applied before features are processed by this renderer. More... | |
virtual Q_DECL_DEPRECATED QgsSymbolV2 * | originalSymbolForFeature (QgsFeature &feature) |
Return symbol for feature. More... | |
virtual Q_DECL_DEPRECATED QgsSymbolV2List | originalSymbolsForFeature (QgsFeature &feat) |
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More... | |
QgsPaintEffect * | paintEffect () const |
Returns the current paint effect for the renderer. More... | |
virtual Q_DECL_DEPRECATED QString | rotationField () const |
return rotation field name (or empty string if not set or not supported by renderer) More... | |
void | setForceRasterRender (bool forceRaster) |
Sets whether the renderer should be rendered to a raster destination. More... | |
void | setOrderBy (const QgsFeatureRequest::OrderBy &orderBy) |
Define the order in which features shall be processed by this renderer. More... | |
void | setOrderByEnabled (bool enabled) |
Sets whether custom ordering should be applied before features are processed by this renderer. More... | |
void | setPaintEffect (QgsPaintEffect *effect) |
Sets the current paint effect for the renderer. More... | |
virtual Q_DECL_DEPRECATED void | setRotationField (const QString &fieldName) |
sets rotation field of renderer (if supported by the renderer) More... | |
void | setUsingSymbolLevels (bool usingSymbolLevels) |
void | setVertexMarkerAppearance (int type, int size) |
set type and size of editing vertex markers for subsequent rendering More... | |
virtual Q_DECL_DEPRECATED void | startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer) |
virtual Q_DECL_DEPRECATED QgsSymbolV2 * | symbolForFeature (QgsFeature &feature) |
To be overridden. More... | |
virtual Q_DECL_DEPRECATED QgsSymbolV2List | symbols () |
For symbol levels. More... | |
virtual Q_DECL_DEPRECATED QgsSymbolV2List | symbolsForFeature (QgsFeature &feat) |
Returns list of symbols used for rendering the feature. More... | |
virtual void | toSld (QDomDocument &doc, QDomElement &element) const |
used from subclasses to create SLD Rule elements following SLD v1.1 specs More... | |
virtual void | toSld (QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const |
used from subclasses to create SLD Rule elements following SLD v1.1 specs More... | |
QString | type () const |
bool | usingSymbolLevels () const |
virtual Q_DECL_DEPRECATED bool | willRenderFeature (QgsFeature &feat) |
Returns whether the renderer will render a feature or not. More... | |
virtual Q_DECL_DEPRECATED QDomElement | writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const |
create the SLD UserStyle element following the SLD v1.1 specs More... | |
virtual QDomElement | writeSld (QDomDocument &doc, const QString &styleName) const |
create the SLD UserStyle element following the SLD v1.1 specs with the given name More... | |
virtual QDomElement | writeSld (QDomDocument &doc, const QString &styleName, const QgsStringMap &props) const |
create the SLD UserStyle element following the SLD v1.1 specs with the given name More... | |
Static Public Member Functions | |
static QgsInvertedPolygonRenderer * | convertFromRenderer (const QgsFeatureRendererV2 *renderer) |
Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer. More... | |
static QgsFeatureRendererV2 * | create (QDomElement &element) |
Creates a renderer out of an XML, for loading. More... | |
Static Public Member Functions inherited from QgsFeatureRendererV2 | |
static QgsFeatureRendererV2 * | defaultRenderer (QGis::GeometryType geomType) |
return a new renderer - used by default in vector layers More... | |
static QgsFeatureRendererV2 * | load (QDomElement &symbologyElem) |
create a renderer from XML element More... | |
static QgsFeatureRendererV2 * | loadSld (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. More... | |
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 (const QString &type) | |
Q_DECL_DEPRECATED void | copyPaintEffect (QgsFeatureRendererV2 *destRenderer) const |
Copies paint effect of this renderer to another renderer. More... | |
void | copyRendererData (QgsFeatureRendererV2 *destRenderer) const |
Clones generic renderer data to another renderer. More... | |
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 More... | |
void | renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context) |
render editing vertex marker for a polygon More... | |
void | renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context) |
render editing vertex marker for a polyline More... | |
void | setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod) |
Static Protected Member Functions inherited from QgsFeatureRendererV2 | |
static QgsConstWkbPtr | _getLineString (QPolygonF &pts, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true) |
Creates a line string in screen coordinates from a wkb string in map coordinates. More... | |
static QgsConstWkbPtr | _getPoint (QPointF &pt, QgsRenderContext &context, QgsConstWkbPtr &wkb) |
Creates a point in screen coordinates from a wkb string in map coordinates. More... | |
static QgsConstWkbPtr | _getPolygon (QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true) |
Creates a polygon in screen coordinates from a wkb string in map coordinates. More... | |
static void | convertSymbolRotation (QgsSymbolV2 *symbol, const QString &field) |
static void | convertSymbolSizeScale (QgsSymbolV2 *symbol, QgsSymbolV2::ScaleMethod method, const QString &field) |
Protected Attributes inherited from QgsFeatureRendererV2 | |
int | mCurrentVertexMarkerSize |
The current size of editing marker. More... | |
int | mCurrentVertexMarkerType |
The current type of editing marker. More... | |
bool | mForceRaster |
QgsFeatureRequest::OrderBy | mOrderBy |
bool | mOrderByEnabled |
QgsPaintEffect * | mPaintEffect |
QString | mType |
bool | mUsingSymbolLevels |
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().
Definition at line 40 of file qgsinvertedpolygonrenderer.h.
QgsInvertedPolygonRenderer::QgsInvertedPolygonRenderer | ( | QgsFeatureRendererV2 * | embeddedRenderer = nullptr | ) |
Constructor.
embeddedRenderer | optional embeddedRenderer. If null, a default one will be assigned. Ownership will be transferred. |
Definition at line 32 of file qgsinvertedpolygonrenderer.cpp.
|
virtual |
Definition at line 46 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 465 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
item in symbology was checked
Reimplemented from QgsFeatureRendererV2.
Definition at line 91 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Used to clone this feature renderer.
Implements QgsFeatureRendererV2.
Definition at line 367 of file qgsinvertedpolygonrenderer.cpp.
|
static |
Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.
Definition at line 518 of file qgsinvertedpolygonrenderer.cpp.
|
static |
Creates a renderer out of an XML, for loading.
Definition at line 383 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Reimplemented from QgsFeatureRendererV2.
Definition at line 358 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Returns the current embedded renderer (subrenderer) for this feature renderer.
The base class implementation does not use subrenderers and will always return null.
Reimplemented from QgsFeatureRendererV2.
Definition at line 62 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
items of symbology items in legend is checked
Reimplemented from QgsFeatureRendererV2.
Definition at line 83 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 492 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
items of symbology items in legend should be checkable
Reimplemented from QgsFeatureRendererV2.
Definition at line 75 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Return a list of symbology items for the legend.
Better choice than legendSymbolItems(). Default fallback implementation just uses legendSymbolItems() implementation
Reimplemented from QgsFeatureRendererV2.
Definition at line 510 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 483 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 433 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 449 of file qgsinvertedpolygonrenderer.cpp.
|
inline |
Definition at line 133 of file qgsinvertedpolygonrenderer.h.
|
overridevirtual |
Renders a given feature.
This will here collect features. The actual rendering will be postponed to stopRender()
feature | the feature to render |
context | the rendering context |
layer | the symbol layer to render, if that makes sense |
selected | whether this feature has been selected (this will add decorations) |
drawVertexMarker | whether this feature has vertex markers (in edit mode usually) |
Reimplemented from QgsFeatureRendererV2.
Definition at line 159 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Creates an XML representation of the renderer.
Used for saving purpose
doc | the XML document where to create the XML subtree |
Reimplemented from QgsFeatureRendererV2.
Definition at line 397 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Sets an embedded renderer (subrenderer) for this feature renderer.
The base class implementation does nothing with subrenderers, but individual derived classes can use these to modify their behaviour.
subRenderer | the embedded renderer. Ownership will be transferred. |
Reimplemented from QgsFeatureRendererV2.
Definition at line 50 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Sets the symbol to be used for a legend symbol item.
key | rule key for legend symbol |
symbol | new symbol for legend item. Ownership is transferred to renderer. |
Reimplemented from QgsFeatureRendererV2.
Definition at line 67 of file qgsinvertedpolygonrenderer.cpp.
|
inline |
enabled | enables or disables the preprocessing. When enabled, geometries will be merged with an union before being rendered. It allows fixing some rendering artifacts (when rendering overlapping polygons for instance). This will involve some CPU-demanding computations and is thus disabled by default. |
Definition at line 140 of file qgsinvertedpolygonrenderer.h.
|
overridevirtual |
Needs to be called when a new render cycle is started.
context | Additional information passed to the renderer about the job which will be rendered |
fields | The fields available for rendering |
Implements QgsFeatureRendererV2.
Definition at line 99 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
The actual rendering will take place here.
Features collected during renderFeature() are rendered using the embedded feature renderer
Implements QgsFeatureRendererV2.
Definition at line 251 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 424 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 456 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 440 of file qgsinvertedpolygonrenderer.cpp.
Proxy that will call this method on the embedded renderer.
Implements QgsFeatureRendererV2.
Definition at line 474 of file qgsinvertedpolygonrenderer.cpp.
|
overridevirtual |
Proxy that will call this method on the embedded renderer.
Reimplemented from QgsFeatureRendererV2.
Definition at line 501 of file qgsinvertedpolygonrenderer.cpp.