55 renderPolygonUsingLayer(
symbolLayer, points, rings, symbolContext );
62 const auto constMLayers =
mLayers;
72 renderPolygonUsingLayer(
symbolLayer, points, rings, symbolContext );
86 if ( effect && effect->
enabled() )
88 const QRectF bounds = polygonBounds( points, rings );
89 QVector<QPolygonF> *translatedRings = translateRings( rings, -bounds.left(), -bounds.top() );
92 p->translate( bounds.topLeft() );
93 p.setEffect( effect );
96 (
static_cast<QgsFillSymbolLayer *
>(
layer ) )->renderPolygon( points.translated( -bounds.topLeft() ), translatedRings, context );
100 (
static_cast<QgsLineSymbolLayer *
>(
layer ) )->renderPolygonStroke( points.translated( -bounds.topLeft() ), translatedRings, context );
102 delete translatedRings;
117QRectF QgsFillSymbol::polygonBounds(
const QPolygonF &points,
const QVector<QPolygonF> *rings )
const
119 QRectF bounds = points.boundingRect();
122 for (
auto it = rings->constBegin(); it != rings->constEnd(); ++it )
124 bounds = bounds.united( ( *it ).boundingRect() );
130QVector<QPolygonF> *QgsFillSymbol::translateRings(
const QVector<QPolygonF> *rings,
double dx,
double dy )
const
135 QVector<QPolygonF> *translatedRings =
new QVector<QPolygonF>;
136 translatedRings->reserve( rings->size() );
137 for (
auto it = rings->constBegin(); it != rings->constEnd(); ++it )
139 translatedRings->append( ( *it ).translated( dx, dy ) );
141 return translatedRings;
161 const auto constMLayers =
mLayers;
The Qgis class provides global constants for use throughout the application.
@ Unknown
Mixed or unknown units.
SymbolType
Attribute editing capabilities which may be supported by vector data providers.
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)
Sets the rotation angle of the pattern, in degrees clockwise.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
void setAngle(double angle) const
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 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.
bool hasActiveProperties() const final
Returns true if the collection has any active properties, or false if all properties within the colle...
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...
Qgis::SymbolType type() const
@ LayerEnabled
Whether symbol layer is enabled.
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
void setOriginalGeometryType(Qgis::GeometryType type)
Sets the geometry type for the original feature geometry being rendered.
void setGeometryPartCount(int count)
Sets the part count of current geometry.
void setGeometryPartNum(int num)
Sets the part number of current geometry.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
Abstract base class for all rendered symbols.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the symbol's property collection, used for data defined overrides.
void renderUsingLayer(QgsSymbolLayer *layer, QgsSymbolRenderContext &context, Qgis::GeometryType geometryType=Qgis::GeometryType::Unknown, const QPolygonF *points=nullptr, const QVector< QPolygonF > *rings=nullptr)
Renders a context using a particular symbol layer without passing in a geometry.
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.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol's property collection, used for data defined overrides.
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.
void setOpacity(qreal opacity)
Sets the opacity for the symbol.
Qgis::SymbolRenderHints mRenderHints
QgsSymbolLayerList mLayers
Q_DECL_DEPRECATED const QgsVectorLayer * layer() const
QgsSymbolAnimationSettings mAnimationSettings
void setAnimationSettings(const QgsSymbolAnimationSettings &settings)
Sets a the symbol animation settings.
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...
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
QList< QgsSymbolLayer * > QgsSymbolLayerList