29 return std::make_unique< QgsFillSymbol >( layers );
56 renderPolygonUsingLayer(
symbolLayer, points, rings, symbolContext );
63 const auto constMLayers =
mLayers;
73 renderPolygonUsingLayer(
symbolLayer, points, rings, symbolContext );
87 if ( effect && effect->
enabled() )
89 const QRectF bounds = polygonBounds( points, rings );
90 QVector<QPolygonF> *translatedRings = translateRings( rings, -bounds.left(), -bounds.top() );
93 p->translate( bounds.topLeft() );
94 p.setEffect( effect );
101 (
static_cast<QgsLineSymbolLayer *
>(
layer ) )->renderPolygonStroke( points.translated( -bounds.topLeft() ), translatedRings, context );
103 delete translatedRings;
109 (
static_cast<QgsFillSymbolLayer *
>(
layer ) )->
renderPolygon( points, rings, context );
113 (
static_cast<QgsLineSymbolLayer *
>(
layer ) )->renderPolygonStroke( points, rings, context );
118QRectF QgsFillSymbol::polygonBounds(
const QPolygonF &points,
const QVector<QPolygonF> *rings )
const
120 QRectF bounds = points.boundingRect();
123 for (
auto it = rings->constBegin(); it != rings->constEnd(); ++it )
125 bounds = bounds.united( ( *it ).boundingRect() );
131QVector<QPolygonF> *QgsFillSymbol::translateRings(
const QVector<QPolygonF> *rings,
double dx,
double dy )
const
136 QVector<QPolygonF> *translatedRings =
new QVector<QPolygonF>;
137 translatedRings->reserve( rings->size() );
138 for (
auto it = rings->constBegin(); it != rings->constEnd(); ++it )
140 translatedRings->append( ( *it ).translated( dx, dy ) );
142 return translatedRings;
154 const auto constMLayers =
mLayers;
Provides global constants and enumerations for use throughout the application.
@ Unknown
Mixed or unknown units.
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.
Manages 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...
Abstract base class for fill symbol layers.
void setAngle(double angle)
Sets the rotation angle of the pattern, in degrees clockwise.
void setAngle(double angle) const
static std::unique_ptr< QgsFillSymbol > createSimple(const QVariantMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
QgsFillSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsFillSymbol, with the specified list of initial symbol layers.
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...
Renders polygons using a single fill and stroke color.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleFillSymbolLayer using the specified properties map containing symbol propertie...
Abstract base class for symbol layers.
@ LayerEnabled
Whether symbol layer is enabled.
Encapsulates the context in which a symbol is being rendered.
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.
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.
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.
Qgis::SymbolRenderHints renderHints() const
Returns the rendering hint flags for the symbol.
void copyCommonProperties(const QgsSymbol *other)
Copies common properties from an other symbol to this symbol.
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).
qreal opacity() const
Returns the opacity for the symbol.
QgsSymbolLayerList mLayers
Q_DECL_DEPRECATED const QgsVectorLayer * layer() const
QgsSymbol(Qgis::SymbolType type, const QgsSymbolLayerList &layers)
Constructor for a QgsSymbol of the specified type.
QList< QgsSymbolLayer * > QgsSymbolLayerList