54 renderPolygonUsingLayer(
symbolLayer, points, rings, symbolContext );
61 const auto constMLayers =
mLayers;
71 renderPolygonUsingLayer(
symbolLayer, points, rings, symbolContext );
85 if ( effect && effect->
enabled() )
87 QRectF bounds = polygonBounds( points, rings );
88 QVector<QPolygonF> *translatedRings = translateRings( rings, -bounds.left(), -bounds.top() );
91 p->translate( bounds.topLeft() );
92 p.setEffect( effect );
95 (
static_cast<QgsFillSymbolLayer *
>(
layer ) )->renderPolygon( points.translated( -bounds.topLeft() ), translatedRings, context );
99 (
static_cast<QgsLineSymbolLayer *
>(
layer ) )->renderPolygonStroke( points.translated( -bounds.topLeft() ), translatedRings, context );
101 delete translatedRings;
116 QRectF QgsFillSymbol::polygonBounds(
const QPolygonF &points,
const QVector<QPolygonF> *rings )
const
118 QRectF bounds = points.boundingRect();
121 for (
auto it = rings->constBegin(); it != rings->constEnd(); ++it )
123 bounds = bounds.united( ( *it ).boundingRect() );
129 QVector<QPolygonF> *QgsFillSymbol::translateRings(
const QVector<QPolygonF> *rings,
double dx,
double dy )
const
134 QVector<QPolygonF> *translatedRings =
new QVector<QPolygonF>;
135 translatedRings->reserve( rings->size() );
136 for (
auto it = rings->constBegin(); it != rings->constEnd(); ++it )
138 translatedRings->append( ( *it ).translated( dx, dy ) );
140 return translatedRings;
159 const auto constMLayers =
mLayers;
The Qgis class provides global constants for use throughout the application.
double valueAsDouble(int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a double.
A class to manager painter saving and restoring required for effect drawing.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void setAngle(double angle)
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
QgsFillSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsFillSymbol, with the specified list of initial symbol layers.
static QgsFillSymbol * createSimple(const QVariantMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
void setAngle(double angle)
void renderPolygon(const QPolygonF &points, const QVector< QPolygonF > *rings, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
Renders the symbol using the given render context.
QgsFillSymbol * clone() const override
Returns a deep copy of this symbol.
Base class for visual effects which can be applied to QPicture drawings.
bool enabled() const
Returns whether the effect is enabled.
Contains information about the context of a rendering operation.
QgsExpressionContext & expressionContext()
Gets the expression context.
bool isSymbolLayerEnabled(const QgsSymbolLayer *layer) const
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
bool renderingStopped() const
Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled...
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleFillSymbolLayer using the specified properties map containing symbol propertie...
@ PropertyLayerEnabled
Whether symbol layer is enabled.
Qgis::SymbolType type() const
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
void setGeometryPartCount(int count)
Sets the part count of current geometry.
void setGeometryPartNum(int num)
Sets the part number of current geometry.
void setOriginalGeometryType(QgsWkbTypes::GeometryType type)
Sets the geometry type for the original feature geometry being rendered.
Abstract base class for all rendered symbols.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the symbol's property collection, used for data defined overrides.
Qgis::SymbolFlags mSymbolFlags
Symbol flags.
QgsSymbolLayerList cloneLayers() const
Retrieve a cloned list of all layers that make up this symbol.
QgsSymbolRenderContext * symbolRenderContext()
Returns the symbol render context.
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
@ PropertyOpacity
Opacity.
qreal mOpacity
Symbol opacity (in the range 0 - 1)
Q_DECL_DEPRECATED const QgsVectorLayer * mLayer
bool mClipFeaturesToExtent
qreal opacity() const
Returns the opacity for the symbol.
void setFlags(Qgis::SymbolFlags flags)
Sets flags for the symbol.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol's property collection, used for data defined overrides.
void setOpacity(qreal opacity)
Sets the opacity for the symbol.
Qgis::SymbolRenderHints mRenderHints
QgsSymbolLayerList mLayers
Q_DECL_DEPRECATED const QgsVectorLayer * layer() const
void renderUsingLayer(QgsSymbolLayer *layer, QgsSymbolRenderContext &context)
Renders a context using a particular symbol layer without passing in a geometry.
Q_DECL_DEPRECATED void setLayer(const QgsVectorLayer *layer)
void setClipFeaturesToExtent(bool clipFeaturesToExtent)
Sets whether features drawn by the symbol should be clipped to the render context's extent.
void setForceRHR(bool force)
Sets whether polygon features drawn by the symbol should be reoriented to follow the standard right-h...
@ RenderUnknownUnit
Mixed or unknown units.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
QList< QgsSymbolLayer * > QgsSymbolLayerList