16#ifndef QGSMARKERSYMBOLLAYER_H
17#define QGSMARKERSYMBOLLAYER_H
23#define DEFAULT_SIMPLEMARKER_NAME "circle"
24#define DEFAULT_SIMPLEMARKER_COLOR QColor(255,0,0)
25#define DEFAULT_SIMPLEMARKER_BORDERCOLOR QColor( 35, 35, 35 )
26#define DEFAULT_SIMPLEMARKER_JOINSTYLE Qt::BevelJoin
27#define DEFAULT_SIMPLEMARKER_SIZE DEFAULT_POINT_SIZE
28#define DEFAULT_SIMPLEMARKER_ANGLE 0
51 static QList< Qgis::MarkerShape > availableShapes();
146 void calculateOffsetAndRotation(
QgsSymbolRenderContext &context,
double scaledSize,
bool &hasDataDefinedRotation, QPointF &offset,
double &angle )
const;
217 QString layerType() const override;
220 QVariantMap properties() const override;
222 void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
223 QString ogrFeatureStyle(
double mmScaleFactor,
double mapUnitScaleFactor ) const override;
224 bool writeDxf(
QgsDxfExport &e,
double mmMapUnitScaleFactor, const QString &layerName,
QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const override;
225 void setOutputUnit(
Qgis::RenderUnit unit ) override;
226 Qgis::RenderUnit outputUnit() const override;
229 bool usesMapUnits() const override;
231 QColor fillColor()
const override {
return mColor; }
233 void setColor(
const QColor &color )
override;
234 QColor
color()
const override;
381 Qt::PenStyle mStrokeStyle = Qt::SolidLine;
383 double mStrokeWidth = 0;
391 Qt::PenCapStyle mPenCapStyle = Qt::SquareCap;
410 bool mUsingCache =
false;
413 static const int MAXIMUM_CACHE_WIDTH = 3000;
419 double mCachedOpacity = 1.0;
454 QString layerType() const override;
457 QVariantMap properties() const override;
462 QSet<QString> usedAttributes( const
QgsRenderContext &context ) const override;
463 bool hasDataDefinedProperties() const override;
464 void setColor( const QColor &
c ) override;
465 QColor color() const override;
466 bool usesMapUnits() const override;
467 void setOutputUnit(
Qgis::RenderUnit unit ) override;
478 std::unique_ptr< QgsFillSymbol > mFill;
483#define DEFAULT_SVGMARKER_SIZE 2*DEFAULT_POINT_SIZE
484#define DEFAULT_SVGMARKER_ANGLE 0
511 static
void resolvePaths( QVariantMap &properties, const
QgsPathResolver &pathResolver,
bool saving );
515 QString layerType() const override;
523 QVariantMap properties() const override;
524 bool usesMapUnits() const override;
528 void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
534 QString path()
const {
return mPath; }
541 void setPath(
const QString &path );
554 double updateDefaultAspectRatio();
568 bool setPreservedAspectRatio(
bool par );
598 QMap<QString, QgsProperty>
parameters()
const {
return mParameters; }
604 void setParameters(
const QMap<QString, QgsProperty> ¶meters );
644 double calculateAspectRatio(
QgsSymbolRenderContext &context,
double scaledSize,
bool &hasDataDefinedAspectRatio )
const;
649 double mDefaultAspectRatio = 0.0;
651 double mFixedAspectRatio = 0.0;
654 bool mHasFillParam =
false;
664 void calculateOffsetAndRotation(
QgsSymbolRenderContext &context,
double scaledWidth,
double scaledHeight, QPointF &offset,
double &angle )
const;
671#define DEFAULT_RASTERMARKER_SIZE 2*DEFAULT_POINT_SIZE
672#define DEFAULT_RASTERMARKER_ANGLE 0
703 static
void resolvePaths( QVariantMap &properties, const
QgsPathResolver &pathResolver,
bool saving );
707 QString layerType() const override;
710 QVariantMap properties() const override;
712 bool usesMapUnits() const override;
713 QColor color() const override;
721 double calculateAspectRatio(
QgsSymbolRenderContext &context,
double scaledSize,
bool &hasDataDefinedAspectRatio ) const;
727 QString path()
const {
return mPath; }
734 void setPath(
const QString &path );
761 double updateDefaultAspectRatio();
775 bool setPreservedAspectRatio(
bool par );
804 void setCommonProperties(
const QVariantMap &properties );
818 virtual QImage fetchImage(
QgsRenderContext &context,
const QString &path, QSize size,
bool preserveAspectRatio,
double opacity )
const SIP_SKIP;
822 double mOpacity = 1.0;
824 double mDefaultAspectRatio = 0.0;
826 double mFixedAspectRatio = 0.0;
830 void calculateOffsetAndRotation(
QgsSymbolRenderContext &context,
double scaledWidth,
double scaledHeight, QPointF &offset,
double &angle )
const;
837#define POINT2MM(x) ( (x) * 25.4 / 72 )
838#define MM2POINT(x) ( (x) * 72 / 25.4 )
840#define DEFAULT_FONTMARKER_FONT "Dingbats"
841#define DEFAULT_FONTMARKER_CHR QChar('A')
842#define DEFAULT_FONTMARKER_SIZE POINT2MM(12)
843#define DEFAULT_FONTMARKER_COLOR QColor( 35, 35, 35 )
844#define DEFAULT_FONTMARKER_BORDERCOLOR QColor(Qt::white)
845#define DEFAULT_FONTMARKER_JOINSTYLE Qt::MiterJoin
846#define DEFAULT_FONTMARKER_ANGLE 0
883 static
void resolveFonts( const QVariantMap &properties, const
QgsReadWriteContext &context );
887 QString layerType() const override;
895 QVariantMap properties() const override;
899 void writeSldMarker( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const override;
900 bool usesMapUnits() const override;
901 void setOutputUnit(
Qgis::RenderUnit unit ) override;
910 QString fontFamily()
const {
return mFontFamily; }
1031 QString mFontFamily;
1034 std::unique_ptr< QFontMetrics >mFontMetrics;
1038 double mChrWidth = 0;
1041 double mFontSizeScale = 1.0;
1044 QColor mStrokeColor;
1045 double mStrokeWidth;
1048 Qt::PenJoinStyle mPenJoinStyle;
1053 bool mUseCachedPath =
false;
1054 QPainterPath mCachedPath;
1057 bool mNonZeroFontSize =
true;
1060 void calculateOffsetAndRotation(
QgsSymbolRenderContext &context,
double scaledSize,
bool &hasDataDefinedRotation, QPointF &offset,
double &angle )
const;
1097 QString layerType() const override;
1098 QVariantMap properties() const override;
1106 void setFrameRate(
double rate ) { mFrameRateFps = rate; }
1118 QImage fetchImage(
QgsRenderContext &context,
const QString &path, QSize size,
bool preserveAspectRatio,
double opacity )
const override SIP_SKIP;
1121 double mFrameRateFps = 10;
1122 bool mStaticPath =
false;
1123 mutable QSet< QString > mPreparedPaths;
The Qgis class provides global constants for use throughout the application.
ScaleMethod
Scale methods.
MarkerShape
Marker shapes.
RenderUnit
Rendering size units.
@ Millimeters
Millimeters.
Animated marker symbol layer class.
~QgsAnimatedMarkerSymbolLayer() override
double frameRate() const
Returns the marker frame rate in frame per second.
Exports QGIS layers to the DXF format.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.
~QgsFilledMarkerSymbolLayer() override
void setStrokeWidthUnit(Qgis::RenderUnit unit)
Sets the stroke width unit.
~QgsFontMarkerSymbolLayer() override
void setStrokeColor(const QColor &color) override
Sets the stroke color for the symbol layer.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the stroke width map unit scale.
Qgis::RenderUnit strokeWidthUnit() const
Returns the stroke width unit.
double strokeWidth() const
Returns the marker's stroke width.
void setFontStyle(const QString &style)
Sets the font style for the font which will be used to render the point.
QString fontStyle() const
Returns the font style for the associated font which will be used to render the point.
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
void setCharacter(QString chr)
Sets the character(s) used when rendering points.
void setFontFamily(const QString &family)
Sets the font family for the font which will be used to render the point.
void setStrokeWidth(double width)
Set's the marker's stroke width.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the stroke join style.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the stroke width map unit scale.
Qt::PenJoinStyle penJoinStyle() const
Returns the stroke join style.
QString character() const
Returns the character(s) used when rendering points.
Struct for storing maximum and minimum scales for measurements in map units.
Abstract base class for marker symbol layers.
virtual QRectF bounds(QPointF point, QgsSymbolRenderContext &context)=0
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
Qgis::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
virtual void renderPoint(QPointF point, QgsSymbolRenderContext &context)=0
Renders a marker at the specified point.
QgsMapUnitScale mapUnitScale() const override
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
void setOutputUnit(Qgis::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
void setMapUnitScale(const QgsMapUnitScale &scale) override
Resolves relative paths into absolute paths and vice versa.
Raster marker symbol layer class.
void setOpacity(double opacity)
Set the marker opacity.
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
~QgsRasterMarkerSymbolLayer() override
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
double opacity() const
Returns the marker opacity.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
Abstract base class for simple marker symbol layers.
Qgis::MarkerShape mShape
Symbol shape.
QPainterPath mPath
Painter path representing shape. If mPolygon is empty then the shape is stored in mPath.
~QgsSimpleMarkerSymbolLayerBase() override
QPolygonF mPolygon
Polygon of points in shape. If polygon is empty then shape is using mPath.
Qgis::MarkerShape shape() const
Returns the shape for the rendered marker symbol.
void setShape(Qgis::MarkerShape shape)
Sets the rendered marker shape.
Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke.
QPen mSelPen
QPen to use as stroke of selected symbols.
QColor mStrokeColor
Stroke color.
QImage mSelCache
Cached image of selected marker, if using cached version.
QImage mCache
Cached image of marker, if using cached version.
QBrush mSelBrush
QBrush to use as fill of selected symbols.
void setFillColor(const QColor &color) override
Sets the fill color for the symbol layer.
Qt::PenJoinStyle penJoinStyle() const
Returns the marker's stroke join style (e.g., miter, bevel, etc).
QPen mPen
QPen corresponding to marker's stroke style.
void setStrokeWidthUnit(Qgis::RenderUnit u)
Sets the unit for the width of the marker's stroke.
~QgsSimpleMarkerSymbolLayer() override
Qt::PenCapStyle penCapStyle() const
Returns the marker's stroke cap style (e.g., flat, round, etc).
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map scale for the width of the marker's stroke.
void setStrokeStyle(Qt::PenStyle strokeStyle)
Sets the marker's stroke style (e.g., solid, dashed, etc)
const QgsMapUnitScale & strokeWidthMapUnitScale() const
Returns the map scale for the width of the marker's stroke.
void setPenJoinStyle(Qt::PenJoinStyle style)
Sets the marker's stroke join style (e.g., miter, bevel, etc).
QColor strokeColor() const override
Returns the marker's stroke color.
QBrush mBrush
QBrush corresponding to marker's fill style.
void setStrokeWidth(double w)
Sets the width of the marker's stroke.
void setStrokeColor(const QColor &color) override
Sets the marker's stroke color.
Qt::PenStyle strokeStyle() const
Returns the marker's stroke style (e.g., solid, dashed, etc)
Qgis::RenderUnit strokeWidthUnit() const
Returns the unit for the width of the marker's stroke.
void setPenCapStyle(Qt::PenCapStyle style)
Sets the marker's stroke cap style (e.g., flat, round, etc).
QgsMapUnitScale mStrokeWidthMapUnitScale
Stroke width map unit scale.
double strokeWidth() const
Returns the width of the marker's stroke.
Qt::PenJoinStyle mPenJoinStyle
Stroke pen join style.
QColor fillColor() const override
Returns the fill color for the symbol layer.
const QgsMapUnitScale & strokeWidthMapUnitScale() const
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
bool preservedAspectRatio() const
Returns the preserved aspect ratio value, true if fixed aspect ratio has been lower or equal to 0.
void setStrokeWidth(double w)
QMap< QString, QgsProperty > mParameters
void setStrokeWidthUnit(Qgis::RenderUnit unit)
Sets the units for the stroke width.
double fixedAspectRatio() const
Returns the marker aspect ratio between width and height to be used in rendering, if the value set is...
void setStrokeColor(const QColor &c) override
Sets the stroke color for the symbol layer.
QColor strokeColor() const override
Returns the stroke color for the symbol layer.
void setFillColor(const QColor &color) override
Sets the fill color for the symbol layer.
double strokeWidth() const
Qgis::RenderUnit strokeWidthUnit() const
Returns the units for the stroke width.
~QgsSvgMarkerSymbolLayer() override
QMap< QString, QgsProperty > parameters() const
Returns the dynamic SVG parameters.
QgsMapUnitScale mStrokeWidthMapUnitScale
Qgis::RenderUnit mStrokeWidthUnit
void setFixedAspectRatio(double ratio)
Set the marker aspect ratio between width and height to be used in rendering, if the value set is low...
double defaultAspectRatio() const
Returns the default marker aspect ratio between width and height, 0 if not yet calculated.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const
Returns the set of attributes referenced by the layer.
virtual void prepareExpressions(const QgsSymbolRenderContext &context)
Prepares all data defined property expressions for evaluation.
virtual void setColor(const QColor &color)
Sets the "representative" color for the symbol layer.
virtual QColor color() const
Returns the "representative" color of the symbol layer.
virtual bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const
write as DXF
Abstract base class for all rendered symbols.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define DEFAULT_RASTERMARKER_ANGLE
#define DEFAULT_RASTERMARKER_SIZE
#define DEFAULT_SVGMARKER_ANGLE
#define DEFAULT_SIMPLEMARKER_JOINSTYLE
#define DEFAULT_FONTMARKER_CHR
#define DEFAULT_SIMPLEMARKER_BORDERCOLOR
#define DEFAULT_SIMPLEMARKER_SIZE
#define DEFAULT_SIMPLEMARKER_ANGLE
#define DEFAULT_SVGMARKER_SIZE
#define DEFAULT_FONTMARKER_FONT
#define DEFAULT_FONTMARKER_ANGLE
#define DEFAULT_FONTMARKER_COLOR
#define DEFAULT_FONTMARKER_SIZE
#define DEFAULT_SIMPLEMARKER_COLOR
#define DEFAULT_SCALE_METHOD