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 );
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...
Qgis::SymbolType symbolType() const
Access the symbol type.
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
virtual void setWidth(double width)
Sets the width of the line symbol layer.
void setWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the line's width.
void setOffset(double offset)
Sets the line's offset.
virtual double width() const
Returns the estimated width for the line symbol layer.
double offset() const
Returns the line's offset.
A line symbol type, for rendering LineString and MultiLineString geometries.
void setDataDefinedWidth(const QgsProperty &property) const
Set data defined width for whole symbol (including all symbol layers).
QgsLineSymbol * clone() const override
Returns a deep copy of this symbol.
void setWidth(double width) const
Sets the width for the whole line 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.
double width() const
Returns the estimated width for the whole symbol, which is the maximum width of all marker symbol lay...
void setWidthUnit(QgsUnitTypes::RenderUnit unit) const
Sets the width units for the whole symbol (including all symbol layers).
static QgsLineSymbol * createSimple(const QVariantMap &properties)
Create a line symbol with one symbol layer: SimpleLine with specified properties.
QgsLineSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsLineSymbol, with the specified list of initial symbol layers.
QgsProperty dataDefinedWidth() const
Returns data defined width for whole symbol (including all symbol layers).
Base class for visual effects which can be applied to QPicture drawings.
bool enabled() const
Returns whether the effect is enabled.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
bool hasActiveProperties() const override
Returns true if the collection has any active properties, or false if all properties within the colle...
A store for object properties.
Contains information about the context of a rendering operation.
QPainter * painter()
Returns the destination QPainter for the render operation.
QgsExpressionContext & expressionContext()
Gets the expression context.
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation.
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...
A simple line symbol layer, which renders lines using a line in a variety of styles (e....
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleLineSymbolLayer, using the settings serialized in the properties map (correspo...
@ PropertyOffset
Symbol offset.
@ PropertyStrokeWidth
Stroke width.
@ PropertyLayerEnabled
Whether symbol layer is enabled.
Qgis::SymbolType type() const
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
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.
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.
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.
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.
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...
RenderUnit
Rendering size units.
@ RenderUnknownUnit
Mixed or unknown units.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QList< QgsSymbolLayer * > QgsSymbolLayerList