41 double origAngle =
angle();
42 double angleDiff = symbolAngle - origAngle;
43 const auto constMLayers =
mLayers;
59 return markerLayer->
angle();
66 const auto constMLayers =
mLayers;
78 const double symbolRotation =
angle();
98 QgsProperty rotatedDD = QgsSymbolLayerUtils::rotateWholeSymbol( markerLayer->
angle() - symbolRotation, property );
107 const double symbolRotation =
angle();
138 if ( !layerAngleDD || layerAngleDD != symbolDD )
143 QgsProperty rotatedDD( QgsSymbolLayerUtils::rotateWholeSymbol( markerLayer->
angle() - symbolRotation, symbolDD ) );
144 if ( !layerAngleDD || layerAngleDD != rotatedDD )
154 double origSize =
size();
156 const auto constMLayers =
mLayers;
167 markerLayer->
setSize( markerLayer->
size() * s / origSize );
171 markerLayer->
setOffset( QPointF( markerLayer->
offset().x() * s / origSize,
172 markerLayer->
offset().y() * s / origSize ) );
180 const auto constMLayers =
mLayers;
186 double lsize = markerLayer->
size();
187 if ( lsize > maxSize )
203 maxSize = std::max( maxSize, layerSize );
210 const auto constMLayers =
mLayers;
226 const auto constMLayers =
mLayers;
237 if ( unit != markerLayer->
sizeUnit() )
248 const auto constMLayers =
mLayers;
261 const auto constMLayers =
mLayers;
275 const double symbolSize =
size();
277 const auto constMLayers =
mLayers;
303 markerLayer->
offset().x() / symbolSize,
304 markerLayer->
offset().y() / symbolSize, property ) );
312 const double symbolSize =
size();
345 if ( !layerSizeDD || layerSizeDD != symbolDD )
353 QgsProperty scaledDD( QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->
size() / symbolSize, symbolDD ) );
354 if ( !layerSizeDD || layerSizeDD != scaledDD )
358 QgsProperty scaledOffsetDD( QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->
offset().x() / symbolSize, markerLayer->
offset().y() / symbolSize, symbolDD ) );
359 if ( layerOffsetDD && layerOffsetDD != scaledOffsetDD )
368 const auto constMLayers =
mLayers;
380 const auto constMLayers =
mLayers;
395 static QPointF nullPoint( 0, 0 );
401 if ( effect && effect->
enabled() )
404 p->translate( point );
405 p.setEffect( effect );
406 layer->renderPoint( nullPoint, context );
410 layer->renderPoint( point, context );
422 if ( layerIdx != -1 )
430 renderPointUsingLayer( markerLayer, point, symbolContext );
450 renderPointUsingLayer( markerLayer, point, symbolContext );
462 const auto constMLayers =
mLayers;
467 if ( !
layer->enabled()
472 if ( bound.isNull() )
473 bound =
symbolLayer->bounds( point, symbolContext );
475 bound = bound.united(
symbolLayer->bounds( point, symbolContext ) );
The Qgis class provides global constants for use throughout the application.
ScaleMethod
Scale methods.
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...
Struct for storing maximum and minimum scales for measurements in map units.
Abstract base class for marker symbol layers.
virtual void setSize(double size)
Sets the symbol size.
QPointF offset() const
Returns the marker's offset, which is the horizontal and vertical displacement which the rendered mar...
void setAngle(double angle)
Sets the rotation angle for the marker.
Qgis::ScaleMethod scaleMethod() const
Returns the method to use for scaling the marker's size.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the symbol's size.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's size.
void setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's size.
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol's angle.
double size() const
Returns the symbol size.
void setScaleMethod(Qgis::ScaleMethod scaleMethod)
Sets the method to use for scaling the marker's size.
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol's size.
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
A marker symbol type, for rendering Point and MultiPoint geometries.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the size units for the whole symbol (including all symbol layers).
static QgsMarkerSymbol * createSimple(const QVariantMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
void setScaleMethod(Qgis::ScaleMethod scaleMethod)
Sets the method to use for scaling the marker's size.
QgsProperty dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
void setSize(double size)
Sets the size for the whole symbol.
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol's angle.
QgsMarkerSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsMarkerSymbol, with the specified list of initial symbol layers.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the size units for the whole symbol (including all symbol layers).
double size() const
Returns the estimated size for the whole symbol, which is the maximum size of all marker symbol layer...
double angle() const
Returns the marker angle for the whole symbol.
QgsMapUnitScale sizeMapUnitScale() const
Returns the size map unit scale for the whole symbol.
void setDataDefinedSize(const QgsProperty &property)
Set data defined size for whole symbol (including all symbol layers).
void setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the size map unit scale for the whole symbol (including all symbol layers).
QgsProperty dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
void setAngle(double symbolAngle)
Sets the angle for the whole symbol.
Qgis::ScaleMethod scaleMethod()
Returns the method to use for scaling the marker's size.
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
void renderPoint(QPointF point, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
Renders the symbol at the specified point, using the given render context.
void setDataDefinedAngle(const QgsProperty &property)
Set data defined angle for whole symbol (including all symbol layers).
QRectF bounds(QPointF point, QgsRenderContext &context, const QgsFeature &feature=QgsFeature()) const
Returns the approximate bounding box of the marker symbol, which includes the bounding box of all sym...
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 isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
A store for object properties.
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...
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to painter units (pixels).
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleMarkerSymbolLayer.
@ PropertyAngle
Symbol angle.
@ PropertySize
Symbol size.
@ PropertyOffset
Symbol offset.
@ 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.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
void setGeometryPartCount(int count)
Sets the part count of current geometry.
void setGeometryPartNum(int num)
Sets the part number of current geometry.
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.
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.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol's property collection, used for data defined overrides.
void setOpacity(qreal opacity)
Sets the opacity for the symbol.
Qgis::SymbolRenderHints mRenderHints
QgsSymbolLayerList mLayers
Q_DECL_DEPRECATED const QgsVectorLayer * layer() const
void renderUsingLayer(QgsSymbolLayer *layer, QgsSymbolRenderContext &context)
Renders a context using a particular symbol layer without passing in a geometry.
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
#define DEFAULT_SCALE_METHOD