QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
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;
117 QRectF 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() );
130 QVector<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;
Q_DECL_DEPRECATED void setLayer(const QgsVectorLayer *layer)
QgsSymbolLayerList cloneLayers() const
Retrieve a cloned list of all layers that make up this symbol.
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
const Q_DECL_DEPRECATED QgsVectorLayer * mLayer
QgsFillSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsFillSymbol, with the specified list of initial symbol layers.
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.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleFillSymbolLayer using the specified properties map containing symbol propertie...
QgsExpressionContext & expressionContext()
Gets the expression context.
A class to manager painter saving and restoring required for effect drawing.
const Q_DECL_DEPRECATED QgsVectorLayer * layer() const
void setGeometryPartNum(int num)
Sets the part number of current geometry.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the symbol's property collection, used for data defined overrides.
Contains information about the context of a rendering operation.
Abstract base class for all rendered symbols.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol's property collection, used for data defined overrides.
void setAngle(double angle) const
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
@ PropertyOpacity
Opacity.
bool isSymbolLayerEnabled(const QgsSymbolLayer *layer) const
When rendering a map layer in a second pass (for selective masking), some symbol layers may be disabl...
void setOpacity(qreal opacity)
Sets the opacity for the symbol.
#define Q_NOWARN_DEPRECATED_POP
bool renderingStopped() const
Returns true if the rendering operation has been stopped and any ongoing rendering should be canceled...
void setClipFeaturesToExtent(bool clipFeaturesToExtent)
Sets whether features drawn by the symbol should be clipped to the render context's extent.
qreal opacity() const
Returns the opacity for the symbol.
void setAnimationSettings(const QgsSymbolAnimationSettings &settings)
Sets a the symbol animation settings.
Qgis::SymbolRenderHints mRenderHints
QgsSymbolLayerList mLayers
bool hasActiveProperties() const override
Returns true if the collection has any active properties, or false if all properties within the colle...
void setGeometryPartCount(int count)
Sets the part count of current geometry.
void renderUsingLayer(QgsSymbolLayer *layer, QgsSymbolRenderContext &context, QgsWkbTypes::GeometryType geometryType=QgsWkbTypes::GeometryType::UnknownGeometry, const QPolygonF *points=nullptr, const QVector< QPolygonF > *rings=nullptr)
Renders a context using a particular symbol layer without passing in a geometry.
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.
static QgsFillSymbol * createSimple(const QVariantMap &properties)
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
QgsSymbolRenderContext * symbolRenderContext()
Returns the symbol render context.
void setForceRHR(bool force)
Sets whether polygon features drawn by the symbol should be reoriented to follow the standard right-h...
@ PropertyLayerEnabled
Whether symbol layer is enabled.
qreal mOpacity
Symbol opacity (in the range 0 - 1)
void setOriginalGeometryType(QgsWkbTypes::GeometryType type)
Sets the geometry type for the original feature geometry being rendered.
Qgis::SymbolType type() const
QList< QgsSymbolLayer * > QgsSymbolLayerList
Base class for visual effects which can be applied to QPicture drawings.
void setFlags(Qgis::SymbolFlags flags)
Sets flags for the symbol.
QgsFillSymbol * clone() const override
Returns a deep copy of this symbol.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
@ RenderUnknownUnit
Mixed or unknown units.
The Qgis class provides global constants for use throughout the application.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
bool enabled() const
Returns whether the effect is enabled.
QgsSymbolAnimationSettings mAnimationSettings
#define Q_NOWARN_DEPRECATED_PUSH
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)
Qgis::SymbolFlags mSymbolFlags
Symbol flags.
void setAngle(double angle)
bool mClipFeaturesToExtent