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;
174 QColor brushColor =
mColor;
175 brushColor.setAlphaF( brushColor.alphaF() * context.
opacity() );
176 mBrush.setColor( brushColor );
178 QColor penColor = mStrokeColor;
179 penColor.setAlphaF( penColor.alphaF() * context.
opacity() );
180 mPen.setColor( penColor );
187 if ( exprVal.isValid() )
189 double width = exprVal.toDouble( &ok );
193 mPen.setWidthF( width );
194 mSelPen.setWidthF( width );
200 if ( exprVal.isValid() )
203 mSelPen.setStyle( mPen.style() );
208 if ( exprVal.isValid() )
211 mSelPen.setJoinStyle( mPen.joinStyle() );
216 brushColor.setAlphaF( brushColor.alphaF() * context.
opacity() );
217 mBrush.setColor( brushColor );
221 penColor.setAlphaF( penColor.alphaF() * context.
opacity() );
222 mPen.setColor( penColor );
229 if ( exprVal.isValid() )
233 preparePath(
symbolName, context, &scaledWidth, &scaledHeight, context.
feature() );
238 bool hasDataDefinedRotation =
false;
241 calculateOffsetAndRotation( context, scaledWidth, scaledHeight, hasDataDefinedRotation,
offset,
angle );
250 transform.translate( point.x() +
offset.x(), point.y() +
offset.y() );
253 transform.rotate(
angle );
256 p->setPen( context.
selected() ? mSelPen : mPen );
257 p->setBrush( context.
selected() ? mSelBrush : mBrush );
258 p->drawPath( transform.map( mPainterPath ) );
265 bool &hasDataDefinedRotation,
267 double &
angle )
const
271 markerOffset( context, scaledWidth, scaledHeight, mSymbolWidthUnit, mSymbolHeightUnit, offsetX, offsetY, mSymbolWidthMapUnitScale, mSymbolHeightMapUnitScale );
272 offset = QPointF( offsetX, offsetY );
277 bool usingDataDefinedRotation =
false;
282 usingDataDefinedRotation = ok;
286 if ( hasDataDefinedRotation )
311 return QStringLiteral(
"EllipseMarker" );
319 preparePath( mSymbolName, context );
321 mPen.setColor( mStrokeColor );
322 mPen.setStyle( mStrokeStyle );
323 mPen.setJoinStyle( mPenJoinStyle );
325 mBrush.setColor(
mColor );
328 QColor selPenColor = selBrushColor ==
mColor ? selBrushColor : mStrokeColor;
331 selBrushColor.setAlphaF( context.
opacity() );
332 selPenColor.setAlphaF( context.
opacity() );
334 mSelBrush = QBrush( selBrushColor );
335 mSelPen = QPen( selPenColor );
336 mSelPen.setStyle( mStrokeStyle );
376 QDomElement symbolizerElem = doc.createElement( QStringLiteral(
"se:PointSymbolizer" ) );
377 if ( !props.value( QStringLiteral(
"uom" ), QString() ).toString().isEmpty() )
378 symbolizerElem.setAttribute( QStringLiteral(
"uom" ), props.value( QStringLiteral(
"uom" ), QString() ).toString() );
379 element.appendChild( symbolizerElem );
390 QDomElement graphicElem = doc.createElement( QStringLiteral(
"se:Graphic" ) );
391 element.appendChild( graphicElem );
400 QString angleFunc = props.
value( QStringLiteral(
"angle" ), QString() ).toString();
401 if ( angleFunc.isEmpty() )
403 if ( ddRotation && ddRotation.
isActive() )
408 angleFunc = QString::number(
mAngle );
410 else if ( ddRotation && ddRotation.
isActive() )
414 angleFunc = QStringLiteral(
"%1 + %2" ).arg( angleFunc, ddRotation.
asExpression() );
420 double angle = angleFunc.toDouble( &ok );
424 angleFunc = QStringLiteral(
"%1 + %2" ).arg( angleFunc ).arg(
mAngle );
439 double widthHeightFactor = mSymbolWidth / mSymbolHeight;
441 graphicElem.appendChild( factorElem );
448 QDomElement graphicElem = element.firstChildElement( QStringLiteral(
"Graphic" ) );
449 if ( graphicElem.isNull() )
452 QString name = QStringLiteral(
"circle" );
455 double widthHeightFactor = 1.0;
459 for ( QgsStringMap::iterator it = vendorOptions.begin(); it != vendorOptions.end(); ++it )
461 if ( it.key() == QLatin1String(
"widthHeightFactor" ) )
464 double v = it.value().toDouble( &ok );
466 widthHeightFactor = v;
473 QString uom = element.attribute( QStringLiteral(
"uom" ) );
482 double d = angleFunc.toDouble( &ok );
503 map[QStringLiteral(
"symbol_name" )] = mSymbolName;
504 map[QStringLiteral(
"symbol_width" )] = QString::number( mSymbolWidth );
507 map[QStringLiteral(
"symbol_height" )] = QString::number( mSymbolHeight );
510 map[QStringLiteral(
"angle" )] = QString::number(
mAngle );
512 map[QStringLiteral(
"outline_width" )] = QString::number( mStrokeWidth );
521 map[QStringLiteral(
"size" )] = QString::number(
mSize );
529 QSizeF QgsEllipseSymbolLayer::calculateSize(
QgsSymbolRenderContext &context,
double *scaledWidth,
double *scaledHeight )
540 width = mSymbolWidth;
544 *scaledWidth = width;
556 height = mSymbolHeight;
560 *scaledHeight = height;
563 return QSizeF( width, height );
566 void QgsEllipseSymbolLayer::preparePath(
const QString &symbolName,
QgsSymbolRenderContext &context,
double *scaledWidth,
double *scaledHeight,
const QgsFeature * )
568 mPainterPath = QPainterPath();
570 QSizeF
size = calculateSize( context, scaledWidth, scaledHeight );
572 if (
symbolName == QLatin1String(
"circle" ) )
574 mPainterPath.addEllipse( QRectF( -
size.width() / 2.0, -
size.height() / 2.0,
size.width(),
size.height() ) );
576 else if (
symbolName == QLatin1String(
"semi_circle" ) )
578 mPainterPath.arcTo( -
size.width() / 2.0, -
size.height() / 2.0,
size.width(),
size.height(), 0, 180 );
579 mPainterPath.lineTo( 0, 0 );
581 else if (
symbolName == QLatin1String(
"rectangle" ) )
583 mPainterPath.addRect( QRectF( -
size.width() / 2.0, -
size.height() / 2.0,
size.width(),
size.height() ) );
585 else if (
symbolName == QLatin1String(
"diamond" ) )
587 mPainterPath.moveTo( -
size.width() / 2.0, 0 );
588 mPainterPath.lineTo( 0,
size.height() / 2.0 );
589 mPainterPath.lineTo(
size.width() / 2.0, 0 );
590 mPainterPath.lineTo( 0, -
size.height() / 2.0 );
591 mPainterPath.lineTo( -
size.width() / 2.0, 0 );
593 else if (
symbolName == QLatin1String(
"cross" ) )
595 mPainterPath.moveTo( 0, -
size.height() / 2.0 );
596 mPainterPath.lineTo( 0,
size.height() / 2.0 );
597 mPainterPath.moveTo( -
size.width() / 2.0, 0 );
598 mPainterPath.lineTo(
size.width() / 2.0, 0 );
600 else if (
symbolName == QLatin1String(
"triangle" ) )
602 mPainterPath.moveTo( 0, -
size.height() / 2.0 );
603 mPainterPath.lineTo( -
size.width() / 2.0,
size.height() / 2.0 );
604 mPainterPath.lineTo(
size.width() / 2.0,
size.height() / 2.0 );
605 mPainterPath.lineTo( 0, -
size.height() / 2.0 );
607 else if (
symbolName == QLatin1String(
"left_half_triangle" ) )
609 mPainterPath.moveTo( 0,
size.height() / 2.0 );
610 mPainterPath.lineTo(
size.width() / 2.0,
size.height() / 2.0 );
611 mPainterPath.lineTo( 0, -
size.height() / 2.0 );
612 mPainterPath.lineTo( 0,
size.height() / 2.0 );
614 else if (
symbolName == QLatin1String(
"right_half_triangle" ) )
616 mPainterPath.moveTo( -
size.width() / 2.0,
size.height() / 2.0 );
617 mPainterPath.lineTo( 0,
size.height() / 2.0 );
618 mPainterPath.lineTo( 0, -
size.height() / 2.0 );
619 mPainterPath.lineTo( -
size.width() / 2.0,
size.height() / 2.0 );
625 if ( mSymbolWidth >= mSymbolHeight )
627 mSymbolHeight = mSymbolHeight *
size / mSymbolWidth;
632 mSymbolWidth = mSymbolWidth *
size / mSymbolHeight;
633 mSymbolHeight =
size;
653 mSymbolWidthUnit = unit;
654 mSymbolHeightUnit = unit;
655 mStrokeWidthUnit = unit;
661 if ( mSymbolWidthUnit != unit || mSymbolHeightUnit != unit || mStrokeWidthUnit != unit )
679 mSymbolWidthMapUnitScale = scale;
680 mSymbolHeightMapUnitScale = scale;
681 mStrokeWidthMapUnitScale = scale;
687 mSymbolWidthMapUnitScale == mSymbolHeightMapUnitScale &&
688 mSymbolHeightMapUnitScale == mStrokeWidthMapUnitScale )
690 return mSymbolWidthMapUnitScale;
697 QSizeF
size = calculateSize( context );
699 bool hasDataDefinedRotation =
false;
702 calculateOffsetAndRotation( context,
size.width(),
size.height(), hasDataDefinedRotation,
offset,
angle );
707 transform.translate( point.x() +
offset.x(), point.y() +
offset.y() );
710 transform.rotate(
angle );
712 double penWidth = mStrokeWidth;
718 if ( exprVal.isValid() )
734 if ( exprVal.isValid() && exprVal.toString() == QLatin1String(
"no" ) )
739 else if ( mStrokeStyle == Qt::NoPen )
745 QRectF symbolBounds = transform.mapRect( QRectF( -
size.width() / 2.0,
746 -
size.height() / 2.0,
751 symbolBounds.adjust( -penWidth / 2.0, -penWidth / 2.0,
752 penWidth / 2.0, penWidth / 2.0 );
806 QColor oc = mStrokeColor;
825 QPointF off( offsetX, offsetY );
828 double rotation = 0.0;
838 rotation = -rotation;
843 t.translate( shift.x() + offsetX, shift.y() + offsetY );
846 t.rotate( rotation );
851 if (
symbolName == QLatin1String(
"circle" ) )
855 QgsPoint pt( t.map( QPointF( 0, 0 ) ) );
862 double stepsize = 2 * M_PI / 40;
863 for (
int i = 0; i < 39; ++i )
865 double angle = stepsize * i;
866 double x = halfWidth * std::cos(
angle );
867 double y = halfHeight * std::sin(
angle );
868 line <<
QgsPoint( t.map( QPointF( x, y ) ) );
871 line << line.at( 0 );
873 if ( mBrush.style() != Qt::NoBrush )
875 if ( mPen.style() != Qt::NoPen )
879 else if (
symbolName == QLatin1String(
"rectangle" ) )
882 p <<
QgsPoint( t.map( QPointF( -halfWidth, -halfHeight ) ) )
883 <<
QgsPoint( t.map( QPointF( halfWidth, -halfHeight ) ) )
884 <<
QgsPoint( t.map( QPointF( halfWidth, halfHeight ) ) )
885 <<
QgsPoint( t.map( QPointF( -halfWidth, halfHeight ) ) );
888 if ( mBrush.style() != Qt::NoBrush )
890 if ( mPen.style() != Qt::NoPen )
894 else if (
symbolName == QLatin1String(
"cross" ) && mPen.style() != Qt::NoPen )
897 <<
QgsPoint( t.map( QPointF( -halfWidth, 0 ) ) )
898 <<
QgsPoint( t.map( QPointF( halfWidth, 0 ) ) ),
899 layerName, QStringLiteral(
"CONTINUOUS" ), oc,
strokeWidth );
901 <<
QgsPoint( t.map( QPointF( 0, halfHeight ) ) )
902 <<
QgsPoint( t.map( QPointF( 0, -halfHeight ) ) ),
903 layerName, QStringLiteral(
"CONTINUOUS" ), oc,
strokeWidth );
906 else if (
symbolName == QLatin1String(
"triangle" ) )
909 p <<
QgsPoint( t.map( QPointF( -halfWidth, -halfHeight ) ) )
910 <<
QgsPoint( t.map( QPointF( halfWidth, -halfHeight ) ) )
911 <<
QgsPoint( t.map( QPointF( 0, halfHeight ) ) );
913 if ( mBrush.style() != Qt::NoBrush )
915 if ( mPen.style() != Qt::NoPen )
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.
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.
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.
Exports QGIS layers to the DXF format.
void writeFilledCircle(const QString &layer, const QColor &color, const QgsPoint &pt, double radius)
Write filled circle (as hatch)
void writePolygon(const QgsRingSequence &polygon, const QString &layer, const QString &hatchPattern, const QColor &color)
Draw dxf filled polygon (HATCH)
void writePolyline(const QgsPointSequence &line, const QString &layer, const QString &lineStyleName, const QColor &color, double width=-1)
Draw dxf primitives (LWPOLYLINE)
A symbol layer for rendering objects with major and minor axis (e.g.
bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift=QPointF(0.0, 0.0)) const override
write as DXF
void setStrokeWidth(double w)
void setSymbolHeightMapUnitScale(const QgsMapUnitScale &scale)
void setSymbolWidthMapUnitScale(const QgsMapUnitScale &scale)
void setSymbolName(const QString &name)
QVariantMap properties() const override
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
QRectF bounds(QPointF point, QgsSymbolRenderContext &context) override
Returns the approximate bounding box of the marker symbol layer, taking into account any data defined...
void setSymbolWidth(double w)
void renderPoint(QPointF point, QgsSymbolRenderContext &context) override
Renders a marker at the specified point.
void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Saves the symbol layer as SLD.
double strokeWidth() const
void setStrokeColor(const QColor &c) override
Set stroke color.
void setStrokeStyle(Qt::PenStyle strokeStyle)
QgsUnitTypes::RenderUnit outputUnit() const override
Returns the units to use for sizes and widths within the symbol layer.
void setSize(double size) override
Sets the symbol size.
QgsMapUnitScale mapUnitScale() const override
QColor fillColor() const override
Gets fill color.
bool usesMapUnits() const override
Returns true if the symbol layer has any components which use map unit based sizes.
void setFillColor(const QColor &c) override
Set fill color.
Qt::PenStyle strokeStyle() const
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates the symbol layer.
static QgsSymbolLayer * createFromSld(QDomElement &element)
double symbolWidth() const
void setStrokeWidthMapUnitScale(const QgsMapUnitScale &scale)
void stopRender(QgsSymbolRenderContext &context) override
Called after a set of rendering operations has finished on the supplied render context.
QString layerType() const override
Returns a string that represents this layer type.
QColor strokeColor() const override
Gets stroke color.
void setSymbolWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's width.
void setPenJoinStyle(Qt::PenJoinStyle style)
Set stroke join style.
void startRender(QgsSymbolRenderContext &context) override
Called before a set of rendering operations commences on the supplied render context.
QString symbolName() const
void setStrokeWidthUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's stroke width.
void setMapUnitScale(const QgsMapUnitScale &scale) override
double symbolHeight() const
void setSymbolHeight(double h)
void setSymbolHeightUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's height.
void writeSldMarker(QDomDocument &doc, QDomElement &element, const QVariantMap &props) const override
Writes the symbol layer definition as a SLD XML element.
QgsEllipseSymbolLayer * clone() const override
Shall be reimplemented by subclasses to create a deep copy of the instance.
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A geometry is the spatial representation of a feature.
QgsWkbTypes::GeometryType type
Perform transforms between map coordinates and device coordinates.
double mapRotation() const
Returns current map rotation in degrees (clockwise)
Struct for storing maximum and minimum scales for measurements in map 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...
double mLineAngle
Line rotation angle (see setLineAngle() for details)
HorizontalAnchorPoint
Symbol horizontal anchor points.
void setAngle(double angle)
Sets the rotation angle for the marker.
QgsUnitTypes::RenderUnit mOffsetUnit
Offset units.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's size.
void setVerticalAnchorPoint(VerticalAnchorPoint v)
Sets the vertical anchor point for positioning the symbol.
void setOutputUnit(QgsUnitTypes::RenderUnit unit) override
Sets the units to use for sizes and widths within the symbol layer.
QPointF mOffset
Marker offset.
void setHorizontalAnchorPoint(HorizontalAnchorPoint h)
Sets the horizontal anchor point for positioning the symbol.
QgsMapUnitScale mapUnitScale() const override
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.
double size() const
Returns the symbol size.
QgsMapUnitScale mOffsetMapUnitScale
Offset map unit scale.
HorizontalAnchorPoint mHorizontalAnchorPoint
Horizontal anchor point.
static QPointF _rotatedOffset(QPointF offset, double angle)
Adjusts a marker offset to account for rotation.
QgsMapUnitScale mSizeMapUnitScale
Marker size map unit scale.
VerticalAnchorPoint
Symbol vertical anchor points.
void markerOffset(QgsSymbolRenderContext &context, double &offsetX, double &offsetY) const
Calculates the required marker offset, including both the symbol offset and any displacement required...
VerticalAnchorPoint mVerticalAnchorPoint
Vertical anchor point.
QgsUnitTypes::RenderUnit mSizeUnit
Marker size unit.
void setOffsetUnit(QgsUnitTypes::RenderUnit unit)
Sets the units for the symbol's offset.
void setOffsetMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the symbol's offset.
double mAngle
Marker rotation angle, in degrees clockwise from north.
QgsUnitTypes::RenderUnit outputUnit() const override
Returns 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.
double angle() const
Returns the rotation angle for the marker, in degrees clockwise from north.
void setMapUnitScale(const QgsMapUnitScale &scale) override
Point geometry type, with support for z-dimension and m-values.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
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.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
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.
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
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...
bool isActive() const
Returns whether the property is currently active.
QPainter * painter()
Returns the destination QPainter for the render operation.
QgsExpressionContext & expressionContext()
Gets the expression context.
const QgsMapToPixel & mapToPixel() const
Returns the context's map to pixel transform, which transforms between map coordinates and device coo...
QColor selectionColor() const
Returns the color to use when rendering selected features.
double convertToPainterUnits(double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &scale=QgsMapUnitScale()) const
Converts a size from the specified units to painter units (pixels).
static bool rotationFromSldElement(QDomElement &element, QString &rotationFunc)
static QString encodePenStyle(Qt::PenStyle style)
static Qt::PenJoinStyle decodePenJoinStyle(const QString &str)
static QString encodeMapUnitScale(const QgsMapUnitScale &mapUnitScale)
static QColor decodeColor(const QString &str)
static double rescaleUom(double size, QgsUnitTypes::RenderUnit unit, const QVariantMap &props)
Rescales the given size based on the uomScale found in the props, if any is found,...
static QgsMapUnitScale decodeMapUnitScale(const QString &str)
static QDomElement createVendorOptionElement(QDomDocument &doc, const QString &name, const QString &value)
static double sizeInPixelsFromSldUom(const QString &uom, double size)
Returns the size scaled in pixels according to the uom attribute.
static bool wellKnownMarkerFromSld(QDomElement &element, QString &name, QColor &color, QColor &strokeColor, Qt::PenStyle &strokeStyle, double &strokeWidth, double &size)
static void createDisplacementElement(QDomDocument &doc, QDomElement &element, QPointF offset)
static QString encodeColor(const QColor &color)
static void createGeometryElement(QDomDocument &doc, QDomElement &element, const QString &geomFunc)
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)
static Qt::PenStyle decodePenStyle(const QString &str)
static void createRotationElement(QDomDocument &doc, QDomElement &element, const QString &rotationFunc)
static QString encodePoint(QPointF point)
Encodes a QPointF to a string.
static QString encodePenJoinStyle(Qt::PenJoinStyle style)
static QgsStringMap getVendorOptionList(QDomElement &element)
static QPointF decodePoint(const QString &string)
Decodes a QSizeF from a string.
@ PropertyStrokeStyle
Stroke style (eg solid, dashed)
@ PropertyAngle
Symbol angle.
@ PropertyJoinStyle
Line join style.
@ PropertyStrokeWidth
Stroke width.
@ PropertyFillColor
Fill color.
@ PropertyHeight
Symbol height.
@ PropertyName
Name, eg shape name for simple markers.
@ PropertyStrokeColor
Stroke color.
@ PropertyWidth
Symbol width.
static const bool SELECTION_IS_OPAQUE
Whether styles for selected features ignore symbol alpha.
virtual QColor color() const
The fill color.
void copyDataDefinedProperties(QgsSymbolLayer *destLayer) const
Copies all data defined properties of this layer to another symbol layer.
void restoreOldDataDefinedProperties(const QVariantMap &stringMap)
Restores older data defined properties from string map.
virtual void setColor(const QColor &color)
The fill color.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
void copyPaintEffect(QgsSymbolLayer *destLayer) const
Copies paint effect of this layer to another symbol layer.
QgsPropertyCollection mDataDefinedProperties
bool selected() const
Returns true if symbols should be rendered using the selected symbol coloring and style.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
const QgsFeature * feature() const
Returns the current feature being rendered.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for data defined symbology.
QgsSymbol::RenderHints renderHints() const
Returns the rendering hint flags for the symbol.
qreal opacity() const
Returns the opacity for the symbol.
@ DynamicRotation
Rotation of symbol may be changed during rendering and symbol should not be cached.
static Q_INVOKABLE QString encodeUnit(QgsUnitTypes::DistanceUnit unit)
Encodes a distance unit to a string.
static Q_INVOKABLE QgsUnitTypes::RenderUnit decodeRenderUnit(const QString &string, bool *ok=nullptr)
Decodes a render unit from a string.
RenderUnit
Rendering size units.
@ RenderUnknownUnit
Mixed or unknown units.
@ RenderMetersInMapUnits
Meters value as Map units.
@ RenderMillimeters
Millimeters.
@ RenderMapUnits
Map units.
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)
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QMap< QString, QString > QgsStringMap
QVector< QgsPointSequence > QgsRingSequence
QVector< QgsPoint > QgsPointSequence
#define QgsDebugMsgLevel(str, level)