QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
42 double origAngle =
angle();
43 double angleDiff = symbolAngle - origAngle;
44 const auto constMLayers =
mLayers;
60 return markerLayer->
angle();
67 const auto constMLayers =
mLayers;
79 const double symbolRotation =
angle();
99 QgsProperty rotatedDD = QgsSymbolLayerUtils::rotateWholeSymbol( markerLayer->
angle() - symbolRotation, property );
108 const double symbolRotation =
angle();
139 if ( !layerAngleDD || layerAngleDD != symbolDD )
144 QgsProperty rotatedDD( QgsSymbolLayerUtils::rotateWholeSymbol( markerLayer->
angle() - symbolRotation, symbolDD ) );
145 if ( !layerAngleDD || layerAngleDD != rotatedDD )
155 double origSize =
size();
157 const auto constMLayers =
mLayers;
170 markerLayer->
setSize( markerLayer->
size() * s / origSize );
174 markerLayer->
setOffset( QPointF( markerLayer->
offset().x() * s / origSize,
175 markerLayer->
offset().y() * s / origSize ) );
190 markerSymbol->
setSize( markerSymbol->
size() * s / origSize );
201 const auto constMLayers =
mLayers;
207 const double lsize = markerLayer->
size();
208 if ( lsize > maxSize )
217 const double lsize = markerSymbol->
size();
218 if ( lsize > maxSize )
236 maxSize = std::max( maxSize, layerSize );
243 const auto constMLayers =
mLayers;
259 const auto constMLayers =
mLayers;
270 if ( unit != markerLayer->
sizeUnit() )
281 const auto constMLayers =
mLayers;
294 const auto constMLayers =
mLayers;
308 const double symbolSize =
size();
310 const auto constMLayers =
mLayers;
336 markerLayer->
offset().x() / symbolSize,
337 markerLayer->
offset().y() / symbolSize, property ) );
345 const double symbolSize =
size();
378 if ( !layerSizeDD || layerSizeDD != symbolDD )
386 QgsProperty scaledDD( QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->
size() / symbolSize, symbolDD ) );
387 if ( !layerSizeDD || layerSizeDD != scaledDD )
391 QgsProperty scaledOffsetDD( QgsSymbolLayerUtils::scaleWholeSymbol( markerLayer->
offset().x() / symbolSize, markerLayer->
offset().y() / symbolSize, symbolDD ) );
392 if ( layerOffsetDD && layerOffsetDD != scaledOffsetDD )
401 const auto constMLayers =
mLayers;
413 const auto constMLayers =
mLayers;
428 static QPointF nullPoint( 0, 0 );
434 if ( effect && effect->
enabled() )
437 p->translate( point );
438 p.setEffect( effect );
439 layer->renderPoint( nullPoint, context );
443 layer->renderPoint( point, context );
456 if ( layerIdx != -1 )
464 renderPointUsingLayer( markerLayer, point, symbolContext );
469 points.append( point );
488 renderPointUsingLayer( markerLayer, point, symbolContext );
493 points.append( point );
504 const auto constMLayers =
mLayers;
509 if ( !
layer->enabled()
514 if ( bound.isNull() )
515 bound =
symbolLayer->bounds( point, symbolContext );
517 bound = bound.united(
symbolLayer->bounds( point, symbolContext ) );
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 setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's size.
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.
void setDataDefinedAngle(const QgsProperty &property)
Set data defined angle for whole symbol (including all symbol layers).
double size() const
Returns the symbol size.
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.
A class to manager painter saving and restoring required for effect drawing.
double size() const
Returns the estimated size for the whole symbol, which is the maximum size of all marker symbol layer...
QgsSymbol * subSymbol() override
Returns the symbol's sub symbol, if present.
void setLineAngle(double lineAngle) const
Sets the line angle modification for the symbol's angle.
QgsProperty dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
const Q_DECL_DEPRECATED QgsVectorLayer * layer() const
void setAngle(double angle)
Sets the rotation angle for the marker.
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.
void setSizeMapUnitScale(const QgsMapUnitScale &scale) const
Sets the size map unit scale for the whole symbol (including all symbol layers).
Contains information about the context of a rendering operation.
void setScaleMethod(Qgis::ScaleMethod scaleMethod)
Sets the method to use for scaling the marker's size.
Abstract base class for marker symbol layers.
Abstract base class for all rendered symbols.
double angle() const
Returns the marker angle for the whole symbol.
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.
Qgis::ScaleMethod scaleMethod() const
Returns the method to use for scaling the marker's size.
@ PropertyOpacity
Opacity.
void setDataDefinedSize(const QgsProperty &property) const
Set data defined size for whole symbol (including all symbol layers).
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.
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
ScaleMethod
Scale methods.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the units for the symbol's size.
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.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleMarkerSymbolLayer.
qreal opacity() const
Returns the opacity for the symbol.
Qgis::ScaleMethod scaleMethod() const
Returns the method to use for scaling the marker's size.
@ PropertyOffset
Symbol offset.
void setAnimationSettings(const QgsSymbolAnimationSettings &settings)
Sets a the symbol animation settings.
void setSizeUnit(QgsUnitTypes::RenderUnit unit) const
Sets the size units for the whole symbol (including all symbol layers).
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...
A marker symbol type, for rendering Point and MultiPoint geometries.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke.
@ PropertySize
Symbol size.
void setGeometryPartCount(int count)
Sets the part count of current geometry.
void setAngle(double symbolAngle) const
Sets the angle for the whole symbol.
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 setOffset(QPointF offset)
Sets the marker's offset, which is the horizontal and vertical displacement which the rendered marker...
Struct for storing maximum and minimum scales for measurements in map units.
Qgis::SymbolType symbolType() const
Access the symbol type.
void setScaleMethod(Qgis::ScaleMethod scaleMethod) const
Sets the method to use for scaling the marker's size.
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...
void setLineAngle(double lineAngle)
Sets the line angle modification for the symbol's angle.
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...
@ PropertyLayerEnabled
Whether symbol layer is enabled.
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::RenderSubcomponentProperty property=Qgis::RenderSubcomponentProperty::Generic) const
Converts a size from the specified units to painter units (pixels).
qreal mOpacity
Symbol opacity (in the range 0 - 1)
Qgis::SymbolType type() const
QgsProperty dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
QList< QgsSymbolLayer * > QgsSymbolLayerList
#define DEFAULT_SCALE_METHOD
void setSize(double size) const
Sets the size for the whole symbol.
Base class for visual effects which can be applied to QPicture drawings.
void setFlags(Qgis::SymbolFlags flags)
Sets flags for the symbol.
@ PropertyAngle
Symbol angle.
@ RenderUnknownUnit
Mixed or unknown units.
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 setSizeMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's size.
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.
QgsUnitTypes::RenderUnit sizeUnit() const
Returns the size units for the whole symbol (including all symbol layers).
bool enabled() const
Returns whether the effect is enabled.
QgsMarkerSymbol(const QgsSymbolLayerList &layers=QgsSymbolLayerList())
Constructor for QgsMarkerSymbol, with the specified list of initial symbol layers.
QgsMapUnitScale sizeMapUnitScale() const
Returns the size map unit scale for the whole symbol.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
QgsSymbolAnimationSettings mAnimationSettings
#define Q_NOWARN_DEPRECATED_PUSH
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.
static QgsMarkerSymbol * createSimple(const QVariantMap &properties)
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
Qgis::SymbolFlags mSymbolFlags
Symbol flags.
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
bool mClipFeaturesToExtent
const QgsMapUnitScale & sizeMapUnitScale() const
Returns the map unit scale for the symbol's size.