QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
42 const double origWidth =
width();
44 const auto constMLayers =
mLayers;
85 const auto constLLayers =
mLayers;
102 const auto constMLayers =
mLayers;
109 if (
width > maxWidth )
119 if (
width > maxWidth )
136 const double layerWidth = lineLayer->
width( context );
137 maxWidth = std::max( maxWidth, layerWidth );
144 const double symbolWidth =
width();
146 const auto constMLayers =
mLayers;
180 const double symbolWidth =
width();
185 for ( QgsSymbolLayerList::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
199 const auto constMLayers =
mLayers;
211 if ( !layerWidthDD || layerWidthDD != symbolDD )
219 const QgsProperty scaledDD( QgsSymbolLayerUtils::scaleWholeSymbol( lineLayer->
width() / symbolWidth, symbolDD ) );
220 if ( !layerWidthDD || layerWidthDD != scaledDD )
224 const QgsProperty scaledOffsetDD( QgsSymbolLayerUtils::scaleWholeSymbol( lineLayer->
offset() / symbolWidth, symbolDD ) );
225 if ( layerOffsetDD && layerOffsetDD != scaledOffsetDD )
238 QPainter *renderPainter = context.
painter();
244 if ( layerIdx != -1 )
252 renderPolylineUsingLayer( lineLayer, points, symbolContext );
260 const auto constMLayers =
mLayers;
272 renderPolylineUsingLayer( lineLayer, points, symbolContext );
289 if ( effect && effect->
enabled() )
292 p->translate( points.boundingRect().topLeft() );
293 p.setEffect( effect );
294 layer->renderPolyline( points.translated( -points.boundingRect().topLeft() ), context );
298 layer->renderPolyline( points, context );
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
void setWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line's width.
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.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
A store for object properties.
RenderUnit
Rendering size units.
QgsExpressionContext & expressionContext()
Gets the expression context.
virtual double width() const
Returns the estimated width for the line symbol layer.
A class to manager painter saving and restoring required for effect drawing.
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
double width() const
Returns the estimated width for the whole symbol, which is the maximum width of all marker symbol lay...
QgsLineSymbol * clone() const override
Returns a deep copy of this symbol.
virtual void setWidth(double width)
Sets the width of the line symbol layer.
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation.
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.
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
void setOffset(double offset)
Sets the line's offset.
static QgsLineSymbol * createSimple(const QVariantMap &properties)
Create a line symbol with one symbol layer: SimpleLine with specified properties.
@ 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...
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleLineSymbolLayer, using the settings serialized in the properties map (correspo...
void setWidthUnit(QgsUnitTypes::RenderUnit unit) const
Sets the width units for the whole symbol (including all symbol layers).
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.
@ PropertyOffset
Symbol offset.
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...
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
A simple line symbol layer, which renders lines using a line in a variety of styles (e....
void setGeometryPartCount(int count)
Sets the part count of current geometry.
A line symbol type, for rendering LineString and MultiLineString geometries.
QgsProperty dataDefinedWidth() const
Returns data defined width for whole symbol (including all symbol layers).
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.
Qgis::SymbolType symbolType() const
Access the symbol type.
@ PropertyStrokeWidth
Stroke width.
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
void setWidth(double width) const
Sets the width for the whole line symbol.
Base class for visual effects which can be applied to QPicture drawings.
void setFlags(Qgis::SymbolFlags flags)
Sets flags for the symbol.
void renderPolyline(const QPolygonF &points, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
Renders the symbol along the line joining points, using the given render context.
QgsLineSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsLineSymbol, with the specified list of initial symbol layers.
@ 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.
double offset() const
Returns the line's offset.
QPainter * painter()
Returns the destination QPainter for the render operation.
void setDataDefinedWidth(const QgsProperty &property) const
Set data defined width for whole symbol (including all symbol layers).
bool enabled() const
Returns whether the effect is enabled.
QgsSymbolAnimationSettings mAnimationSettings
#define Q_NOWARN_DEPRECATED_PUSH
Qgis::SymbolFlags mSymbolFlags
Symbol flags.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
bool mClipFeaturesToExtent