QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
28 #include <QDomDocument>
29 #include <QDomElement>
32 : mSymbolName( QStringLiteral(
"circle" ) )
33 , mStrokeColor( QColor( 35, 35, 35 ) )
36 mPen.setColor( mStrokeColor );
37 mPen.setStyle( mStrokeStyle );
38 mPen.setJoinStyle( mPenJoinStyle );
41 mBrush.setStyle( Qt::SolidPattern );
49 if (
properties.contains( QStringLiteral(
"symbol_name" ) ) )
53 if (
properties.contains( QStringLiteral(
"size" ) ) )
57 if (
properties.contains( QStringLiteral(
"size_unit" ) ) )
61 if (
properties.contains( QStringLiteral(
"size_map_unit_scale" ) ) )
65 if (
properties.contains( QStringLiteral(
"symbol_width" ) ) )
69 if (
properties.contains( QStringLiteral(
"symbol_width_unit" ) ) )
73 if (
properties.contains( QStringLiteral(
"symbol_width_map_unit_scale" ) ) )
77 if (
properties.contains( QStringLiteral(
"symbol_height" ) ) )
81 if (
properties.contains( QStringLiteral(
"symbol_height_unit" ) ) )
85 if (
properties.contains( QStringLiteral(
"symbol_height_map_unit_scale" ) ) )
89 if (
properties.contains( QStringLiteral(
"angle" ) ) )
93 if (
properties.contains( QStringLiteral(
"outline_style" ) ) )
97 else if (
properties.contains( QStringLiteral(
"line_style" ) ) )
101 if (
properties.contains( QStringLiteral(
"joinstyle" ) ) )
105 if (
properties.contains( QStringLiteral(
"outline_width" ) ) )
109 else if (
properties.contains( QStringLiteral(
"line_width" ) ) )
113 if (
properties.contains( QStringLiteral(
"outline_width_unit" ) ) )
117 else if (
properties.contains( QStringLiteral(
"line_width_unit" ) ) )
121 if (
properties.contains( QStringLiteral(
"outline_width_map_unit_scale" ) ) )
125 if (
properties.contains( QStringLiteral(
"fill_color" ) ) )
130 else if (
properties.contains( QStringLiteral(
"color" ) ) )
134 if (
properties.contains( QStringLiteral(
"outline_color" ) ) )
138 else if (
properties.contains( QStringLiteral(
"line_color" ) ) )
142 if (
properties.contains( QStringLiteral(
"offset" ) ) )
146 if (
properties.contains( QStringLiteral(
"offset_unit" ) ) )
150 if (
properties.contains( QStringLiteral(
"offset_map_unit_scale" ) ) )
154 if (
properties.contains( QStringLiteral(
"horizontal_anchor_point" ) ) )
158 if (
properties.contains( QStringLiteral(
"vertical_anchor_point" ) ) )
171 double scaledWidth = mSymbolWidth;
172 double scaledHeight = mSymbolHeight;
179 if ( exprVal.isValid() )
181 double width = exprVal.toDouble( &ok );
185 mPen.setWidthF( width );
186 mSelPen.setWidthF( width );
192 if ( exprVal.isValid() )
195 mSelPen.setStyle( mPen.style() );
200 if ( exprVal.isValid() )
203 mSelPen.setJoinStyle( mPen.joinStyle() );
217 if ( exprVal.isValid() )
221 preparePath(
symbolName, context, &scaledWidth, &scaledHeight, context.
feature() );
226 bool hasDataDefinedRotation =
false;
229 calculateOffsetAndRotation( context, scaledWidth, scaledHeight, hasDataDefinedRotation,
offset,
angle );
238 transform.translate( point.x() +
offset.x(), point.y() +
offset.y() );
241 transform.rotate(
angle );
244 p->setPen( context.
selected() ? mSelPen : mPen );
245 p->setBrush( context.
selected() ? mSelBrush : mBrush );
246 p->drawPath( transform.map( mPainterPath ) );
253 bool &hasDataDefinedRotation,
255 double &
angle )
const
259 markerOffset( context, scaledWidth, scaledHeight, mSymbolWidthUnit, mSymbolHeightUnit, offsetX, offsetY, mSymbolWidthMapUnitScale, mSymbolHeightMapUnitScale );
260 offset = QPointF( offsetX, offsetY );
265 bool usingDataDefinedRotation =
false;
270 usingDataDefinedRotation = ok;
274 if ( hasDataDefinedRotation )
299 return QStringLiteral(
"EllipseMarker" );
307 preparePath( mSymbolName, context );
309 mPen.setColor( mStrokeColor );
310 mPen.setStyle( mStrokeStyle );
311 mPen.setJoinStyle( mPenJoinStyle );
313 mBrush.setColor(
mColor );
316 QColor selPenColor = selBrushColor ==
mColor ? selBrushColor : mStrokeColor;
319 selBrushColor.setAlphaF( context.
opacity() );
320 selPenColor.setAlphaF( context.
opacity() );
322 mSelBrush = QBrush( selBrushColor );
323 mSelPen = QPen( selPenColor );
324 mSelPen.setStyle( mStrokeStyle );
364 QDomElement symbolizerElem = doc.createElement( QStringLiteral(
"se:PointSymbolizer" ) );
365 if ( !props.value( QStringLiteral(
"uom" ), QString() ).isEmpty() )
366 symbolizerElem.setAttribute( QStringLiteral(
"uom" ), props.value( QStringLiteral(
"uom" ), QString() ) );
367 element.appendChild( symbolizerElem );
378 QDomElement graphicElem = doc.createElement( QStringLiteral(
"se:Graphic" ) );
379 element.appendChild( graphicElem );
388 QString angleFunc = props.
value( QStringLiteral(
"angle" ), QString() );
389 if ( angleFunc.isEmpty() )
391 if ( ddRotation && ddRotation.
isActive() )
396 angleFunc = QString::number(
mAngle );
398 else if ( ddRotation && ddRotation.
isActive() )
402 angleFunc = QStringLiteral(
"%1 + %2" ).arg( angleFunc, ddRotation.
asExpression() );
408 double angle = angleFunc.toDouble( &ok );
412 angleFunc = QStringLiteral(
"%1 + %2" ).arg( angleFunc ).arg(
mAngle );
427 double widthHeightFactor = mSymbolWidth / mSymbolHeight;
429 graphicElem.appendChild( factorElem );
436 QDomElement graphicElem = element.firstChildElement( QStringLiteral(
"Graphic" ) );
437 if ( graphicElem.isNull() )
440 QString name = QStringLiteral(
"circle" );
443 double widthHeightFactor = 1.0;
447 for ( QgsStringMap::iterator it = vendorOptions.begin(); it != vendorOptions.end(); ++it )
449 if ( it.key() == QLatin1String(
"widthHeightFactor" ) )
452 double v = it.value().toDouble( &ok );
454 widthHeightFactor = v;
461 QString uom = element.attribute( QStringLiteral(
"uom" ) );
470 double d = angleFunc.toDouble( &ok );
491 map[QStringLiteral(
"symbol_name" )] = mSymbolName;
492 map[QStringLiteral(
"symbol_width" )] = QString::number( mSymbolWidth );
495 map[QStringLiteral(
"symbol_height" )] = QString::number( mSymbolHeight );
498 map[QStringLiteral(
"angle" )] = QString::number(
mAngle );
500 map[QStringLiteral(
"outline_width" )] = QString::number( mStrokeWidth );
509 map[QStringLiteral(
"size" )] = QString::number(
mSize );
517 QSizeF QgsEllipseSymbolLayer::calculateSize(
QgsSymbolRenderContext &context,
double *scaledWidth,
double *scaledHeight )
528 width = mSymbolWidth;
532 *scaledWidth = width;
544 height = mSymbolHeight;
548 *scaledHeight = height;
551 return QSizeF( width, height );
554 void QgsEllipseSymbolLayer::preparePath(
const QString &symbolName,
QgsSymbolRenderContext &context,
double *scaledWidth,
double *scaledHeight,
const QgsFeature * )
556 mPainterPath = QPainterPath();
558 QSizeF
size = calculateSize( context, scaledWidth, scaledHeight );
560 if (
symbolName == QLatin1String(
"circle" ) )
562 mPainterPath.addEllipse( QRectF( -
size.width() / 2.0, -
size.height() / 2.0,
size.width(),
size.height() ) );
564 else if (
symbolName == QLatin1String(
"semi_circle" ) )
566 mPainterPath.arcTo( -
size.width() / 2.0, -
size.height() / 2.0,
size.width(),
size.height(), 0, 180 );
567 mPainterPath.lineTo( 0, 0 );
569 else if (
symbolName == QLatin1String(
"rectangle" ) )
571 mPainterPath.addRect( QRectF( -
size.width() / 2.0, -
size.height() / 2.0,
size.width(),
size.height() ) );
573 else if (
symbolName == QLatin1String(
"diamond" ) )
575 mPainterPath.moveTo( -
size.width() / 2.0, 0 );
576 mPainterPath.lineTo( 0,
size.height() / 2.0 );
577 mPainterPath.lineTo(
size.width() / 2.0, 0 );
578 mPainterPath.lineTo( 0, -
size.height() / 2.0 );
579 mPainterPath.lineTo( -
size.width() / 2.0, 0 );
581 else if (
symbolName == QLatin1String(
"cross" ) )
583 mPainterPath.moveTo( 0, -
size.height() / 2.0 );
584 mPainterPath.lineTo( 0,
size.height() / 2.0 );
585 mPainterPath.moveTo( -
size.width() / 2.0, 0 );
586 mPainterPath.lineTo(
size.width() / 2.0, 0 );
588 else if (
symbolName == QLatin1String(
"triangle" ) )
590 mPainterPath.moveTo( 0, -
size.height() / 2.0 );
591 mPainterPath.lineTo( -
size.width() / 2.0,
size.height() / 2.0 );
592 mPainterPath.lineTo(
size.width() / 2.0,
size.height() / 2.0 );
593 mPainterPath.lineTo( 0, -
size.height() / 2.0 );
595 else if (
symbolName == QLatin1String(
"left_half_triangle" ) )
597 mPainterPath.moveTo( 0,
size.height() / 2.0 );
598 mPainterPath.lineTo(
size.width() / 2.0,
size.height() / 2.0 );
599 mPainterPath.lineTo( 0, -
size.height() / 2.0 );
600 mPainterPath.lineTo( 0,
size.height() / 2.0 );
602 else if (
symbolName == QLatin1String(
"right_half_triangle" ) )
604 mPainterPath.moveTo( -
size.width() / 2.0,
size.height() / 2.0 );
605 mPainterPath.lineTo( 0,
size.height() / 2.0 );
606 mPainterPath.lineTo( 0, -
size.height() / 2.0 );
607 mPainterPath.lineTo( -
size.width() / 2.0,
size.height() / 2.0 );
613 if ( mSymbolWidth >= mSymbolHeight )
615 mSymbolHeight = mSymbolHeight *
size / mSymbolWidth;
620 mSymbolWidth = mSymbolWidth *
size / mSymbolHeight;
621 mSymbolHeight =
size;
641 mSymbolWidthUnit = unit;
642 mSymbolHeightUnit = unit;
643 mStrokeWidthUnit = unit;
649 if ( mSymbolWidthUnit != unit || mSymbolHeightUnit != unit || mStrokeWidthUnit != unit )
659 mSymbolWidthMapUnitScale = scale;
660 mSymbolHeightMapUnitScale = scale;
661 mStrokeWidthMapUnitScale = scale;
667 mSymbolWidthMapUnitScale == mSymbolHeightMapUnitScale &&
668 mSymbolHeightMapUnitScale == mStrokeWidthMapUnitScale )
670 return mSymbolWidthMapUnitScale;
677 QSizeF
size = calculateSize( context );
679 bool hasDataDefinedRotation =
false;
682 calculateOffsetAndRotation( context,
size.width(),
size.height(), hasDataDefinedRotation,
offset,
angle );
687 transform.translate( point.x() +
offset.x(), point.y() +
offset.y() );
690 transform.rotate(
angle );
692 double penWidth = mStrokeWidth;
698 if ( exprVal.isValid() )
714 if ( exprVal.isValid() && exprVal.toString() == QLatin1String(
"no" ) )
719 else if ( mStrokeStyle == Qt::NoPen )
725 QRectF symbolBounds = transform.mapRect( QRectF( -
size.width() / 2.0,
726 -
size.height() / 2.0,
731 symbolBounds.adjust( -penWidth / 2.0, -penWidth / 2.0,
732 penWidth / 2.0, penWidth / 2.0 );
786 QColor oc = mStrokeColor;
805 QPointF off( offsetX, offsetY );
808 double rotation = 0.0;
818 rotation = -rotation;
823 t.translate( shift.x() + offsetX, shift.y() + offsetY );
826 t.rotate( rotation );
831 if (
symbolName == QLatin1String(
"circle" ) )
835 QgsPoint pt( t.map( QPointF( 0, 0 ) ) );
842 double stepsize = 2 * M_PI / 40;
843 for (
int i = 0; i < 39; ++i )
845 double angle = stepsize * i;
846 double x = halfWidth * std::cos(
angle );
847 double y = halfHeight * std::sin(
angle );
848 line <<
QgsPoint( t.map( QPointF( x, y ) ) );
851 line << line.at( 0 );
853 if ( mBrush.style() != Qt::NoBrush )
855 if ( mPen.style() != Qt::NoPen )
859 else if (
symbolName == QLatin1String(
"rectangle" ) )
862 p <<
QgsPoint( t.map( QPointF( -halfWidth, -halfHeight ) ) )
863 <<
QgsPoint( t.map( QPointF( halfWidth, -halfHeight ) ) )
864 <<
QgsPoint( t.map( QPointF( halfWidth, halfHeight ) ) )
865 <<
QgsPoint( t.map( QPointF( -halfWidth, halfHeight ) ) );
868 if ( mBrush.style() != Qt::NoBrush )
870 if ( mPen.style() != Qt::NoPen )
874 else if (
symbolName == QLatin1String(
"cross" ) && mPen.style() != Qt::NoPen )
877 <<
QgsPoint( t.map( QPointF( -halfWidth, 0 ) ) )
878 <<
QgsPoint( t.map( QPointF( halfWidth, 0 ) ) ),
879 layerName, QStringLiteral(
"CONTINUOUS" ), oc,
strokeWidth );
881 <<
QgsPoint( t.map( QPointF( 0, halfHeight ) ) )
882 <<
QgsPoint( t.map( QPointF( 0, -halfHeight ) ) ),
883 layerName, QStringLiteral(
"CONTINUOUS" ), oc,
strokeWidth );
886 else if (
symbolName == QLatin1String(
"triangle" ) )
889 p <<
QgsPoint( t.map( QPointF( -halfWidth, -halfHeight ) ) )
890 <<
QgsPoint( t.map( QPointF( halfWidth, -halfHeight ) ) )
891 <<
QgsPoint( t.map( QPointF( 0, halfHeight ) ) );
893 if ( mBrush.style() != Qt::NoBrush )
895 if ( mPen.style() != Qt::NoPen )
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's stroke width.
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for data defined symbology.
bool isActive() const
Returns whether the property is currently active.
Qt::PenStyle strokeStyle() const
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's size.
double strokeWidth() const
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.
static QString encodeColor(const QColor &color)
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
Sets the horizontal anchor point for positioning the symbol.
VerticalAnchorPoint
Symbol vertical anchor points.
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to painter units (pixels).
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
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.
QgsMapUnitScale mSizeMapUnitScale
Marker size map unit scale.
QgsExpressionContext & expressionContext()
Gets the expression context.
QgsMapUnitScale mapUnitScale() const override
static bool wellKnownMarkerFromSld(QDomElement &element, QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle, double &strokeWidth, double &size)
QgsMapUnitScale mapUnitScale() const override
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
Point geometry type, with support for z-dimension and m-values.
void writePolygon(const QgsRingSequence &polygon, const QString &layer, const QString &hatchPattern, const QColor &color)
Draw dxf filled polygon (HATCH)
static double sizeInPixelsFromSldUom(const QString &uom, double size)
Returns the size scaled in pixels according to the uom attribute.
#define QgsDebugMsgLevel(str, level)
const QgsFeature * feature() const
Returns the current feature being rendered.
QColor strokeColor() const override
Gets stroke color.
void setSymbolName(const QString &name)
virtual void setColor(const QColor &color)
The fill color.
virtual QColor color() const
The fill color.
@ PropertyFillColor
Fill color.
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void setAngle(double angle)
Sets the rotation angle for the marker.
void setFillColor(const QColor &c) override
Set fill color.
qreal opacity() const
Returns the opacity for the symbol.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
void setMapUnitScale(const QgsMapUnitScale &scale) override
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
static const bool SELECTION_IS_OPAQUE
Whether styles for selected features ignore symbol alpha.
@ RenderMillimeters
Millimeters.
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void renderPoint(QPointF point, QgsSymbolRenderContext &context) override
Renders a marker at the specified point.
QString symbolName() const
static QString encodePenStyle(Qt::PenStyle style)
void setMapUnitScale(const QgsMapUnitScale &scale) override
QgsUnitTypes::RenderUnit mSizeUnit
Marker size unit.
void setStrokeColor(const QColor &c) override
Set stroke color.
void setSymbolHeightUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's height.
@ PropertyStrokeColor
Stroke color.
A symbol layer for rendering objects with major and minor axis (e.g.
static QColor decodeColor(const QString &str)
VerticalAnchorPoint mVerticalAnchorPoint
Vertical anchor point.
static void wellKnownMarkerToSld(QDomDocument &doc, QDomElement &element, const QString &name, const QColor &color, const QColor &strokeColor, Qt::PenStyle strokeStyle, double strokeWidth=-1, double size=-1)
QVariant value(const QgsExpressionContext &context, const QVariant &defaultValue=QVariant(), bool *ok=nullptr) const
Calculates the current value of the property, including any transforms which are set for the property...
static void createGeometryElement(QDomDocument &doc, QDomElement &element, const QString &geomFunc)
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
void setSymbolWidthMapUnitScale(const QgsMapUnitScale &scale)
void setPenJoinStyle(Qt::PenJoinStyle style)
Set stroke join style.
QgsUnitTypes::RenderUnit mOffsetUnit
Offset units.
bool selected() const
Returns true if symbols should be rendered using the selected symbol coloring and style.
static void createDisplacementElement(QDomDocument &doc, QDomElement &element, QPointF offset)
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
HorizontalAnchorPoint
Symbol horizontal anchor points.
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
void markerOffset(QgsSymbolRenderContext &context, double &offsetX, double &offsetY) const
Calculates the required marker offset, including both the symbol offset and any displacement required...
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
static QgsSymbolLayer * createFromSld(QDomElement &element)
void setStrokeWidth(double w)
void setSymbolWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's width.
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)
double mapRotation() const
Returns current map rotation in degrees (clockwise)
static double rescaleUom(double size, QgsUnitTypes::RenderUnit unit, const QgsStringMap &props)
Rescales the given size based on the uomScale found in the props, if any is found,...
QgsEllipseSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void copyPaintEffect(QgsSymbolLayer *destLayer) const
Copies paint effect of this layer to another symbol layer.
static QPointF decodePoint(const QString &string)
Decodes a QSizeF from a string.
@ PropertyStrokeStyle
Stroke style (eg solid, dashed)
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void writeSldMarker(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const override
Writes the symbol layer definition as a SLD XML element.
static QDomElement createVendorOptionElement(QDomDocument &doc, const QString &name, const QString &value)
@ PropertyName
Name, eg shape name for simple markers.
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.
QgsPropertyCollection mDataDefinedProperties
@ PropertyStrokeWidth
Stroke width.
QVector< QgsPointSequence > QgsRingSequence
QColor fillColor() const override
Gets fill color.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's offset.
static QString encodePoint(QPointF point)
Encodes a QPointF to a string.
QString valueAsString(int key, const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a string.
QgsSymbol::RenderHints renderHints() const
Returns the rendering hint flags for the symbol.
void setSymbolHeight(double h)
QColor selectionColor() const
Returns the color to use when rendering selected features.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's offset.
QMap< QString, QString > QgsStringMap
QPointF mOffset
Marker offset.
HorizontalAnchorPoint mHorizontalAnchorPoint
Horizontal anchor point.
QVector< QgsPoint > QgsPointSequence
QVariant value(int key, const QgsExpressionContext &context, const QVariant &defaultValue=QVariant()) const override
Returns the calculated value of the property with the specified key from within the collection.
A geometry is the spatial representation of a feature.
void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const override
Perform transforms between map coordinates and device coordinates.
void writeFilledCircle(const QString &layer, const QColor &color, const QgsPoint &pt, double radius)
Write filled circle (as hatch)
@ DynamicRotation
Rotation of symbol may be changed during rendering and symbol should not be cached.
static QgsStringMap getVendorOptionList(QDomElement &element)
double mLineAngle
Line rotation angle (see setLineAngle() for details)
bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const override
write as DXF
static bool rotationFromSldElement(QDomElement &element, QString &rotationFunc)
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
@ PropertyAngle
Symbol angle.
double symbolWidth() const
@ RenderUnknownUnit
Mixed or unknown units.
void restoreOldDataDefinedProperties(const QgsStringMap &stringMap)
Restores older data defined properties from string map.
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
static void createRotationElement(QDomDocument &doc, QDomElement &element, const QString &rotationFunc)
static QPointF _rotatedOffset(QPointF offset, double angle)
Adjusts a marker offset to account for rotation.
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.
void setVerticalAnchorPoint(VerticalAnchorPoint v)
Sets the vertical anchor point for positioning the symbol.
QgsStringMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
static QgsSymbolLayer * create(const QgsStringMap &properties=QgsStringMap())
double mAngle
Marker rotation angle, in degrees clockwise from north.
static QString encodePenJoinStyle(Qt::PenJoinStyle style)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
@ PropertyHeight
Symbol height.
void setStrokeStyle(Qt::PenStyle strokeStyle)
QPainter * painter()
Returns the destination QPainter for the render operation.
static Qt::PenStyle decodePenStyle(const QString &str)
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
void setSize(double size) override
Sets the symbol size.
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
QgsWkbTypes::GeometryType type
QgsMapUnitScale mOffsetMapUnitScale
Offset map unit scale.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
void copyDataDefinedProperties(QgsSymbolLayer *destLayer) const
Copies all data defined properties of this layer to another symbol layer.
void setSymbolHeightMapUnitScale(const QgsMapUnitScale &scale)
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
QRectF bounds(QPointF point, QgsSymbolRenderContext &context) override
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
QString layerType() const override
Returns a string that represents this layer type.
double symbolHeight() const
QColor valueAsColor(int key, const QgsExpressionContext &context, const QColor &defaultColor=QColor(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a color.
void setSymbolWidth(double w)
void writePolyline(const QgsPointSequence &line, const QString &layer, const QString &lineStyleName, const QColor &color, double width=-1)
Draw dxf primitives (LWPOLYLINE)
@ PropertyJoinStyle
Line join style.
@ PropertyWidth
Symbol width.