Skip to content
Permalink
Browse files

[symbology] Add a 1/2, 1/3, 1/4 arc signs to simple markers

  • Loading branch information
nirvn committed Mar 17, 2021
1 parent 09620ad commit b3d27aacce90744dd8e4884385cea353e5c26a65
@@ -52,6 +52,9 @@ leaves the actual drawing of the symbols to subclasses.
Octagon,
SquareWithCorners,
AsteriskFill,
SemiArc,
ThirdArc,
QuarterArc,
};

static QList< QgsSimpleMarkerSymbolLayerBase::Shape > availableShapes();
@@ -75,6 +75,9 @@ QList<QgsSimpleMarkerSymbolLayerBase::Shape> QgsSimpleMarkerSymbolLayerBase::ava
<< CrossFill
<< Cross2
<< Line
<< SemiArc
<< ThirdArc
<< QuarterArc
<< ArrowHead
<< ArrowHeadFilled
<< SemiCircle
@@ -133,6 +136,9 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( QgsSimpleMarkerSymbolLayerBa
case Cross2:
case Line:
case ArrowHead:
case SemiArc:
case ThirdArc:
case QuarterArc:
return false;
}
return true;
@@ -356,6 +362,12 @@ QgsSimpleMarkerSymbolLayerBase::Shape QgsSimpleMarkerSymbolLayerBase::decodeShap
return LeftHalfTriangle;
else if ( cleaned == QLatin1String( "asterisk_fill" ) )
return AsteriskFill;
else if ( cleaned == QLatin1String( "semi_arc" ) )
return SemiArc;
else if ( cleaned == QLatin1String( "third_arc" ) )
return ThirdArc;
else if ( cleaned == QLatin1String( "quarter_arc" ) )
return QuarterArc;

if ( ok )
*ok = false;
@@ -418,6 +430,12 @@ QString QgsSimpleMarkerSymbolLayerBase::encodeShape( QgsSimpleMarkerSymbolLayerB
return QStringLiteral( "quarter_circle" );
case AsteriskFill:
return QStringLiteral( "asterisk_fill" );
case SemiArc:
return QStringLiteral( "semi_arc" );
case ThirdArc:
return QStringLiteral( "third_arc" );
case QuarterArc:
return QStringLiteral( "quarter_arc" );
}
return QString();
}
@@ -635,6 +653,9 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
case SemiCircle:
case ThirdCircle:
case QuarterCircle:
case SemiArc:
case ThirdArc:
case QuarterArc:
return false;
}

@@ -667,6 +688,21 @@ bool QgsSimpleMarkerSymbolLayerBase::prepareMarkerPath( QgsSimpleMarkerSymbolLay
mPath.lineTo( 0, 0 );
return true;

case SemiArc:
mPath.moveTo( 1, 0 );
mPath.arcTo( -1, -1, 2, 2, 0, 180 );
return true;

case ThirdArc:
mPath.moveTo( 0, -1 );
mPath.arcTo( -1, -1, 2, 2, 90, 120 );
return true;

case QuarterArc:
mPath.moveTo( 0, -1 );
mPath.arcTo( -1, -1, 2, 2, 90, 90 );
return true;

case Cross:
mPath.moveTo( -1, 0 );
mPath.lineTo( 1, 0 ); // horizontal
@@ -74,6 +74,9 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
Octagon, //!< Octagon (since QGIS 3.18)
SquareWithCorners, //!< A square with diagonal corners (since QGIS 3.18)
AsteriskFill, //!< A filled asterisk shape (since QGIS 3.18)
SemiArc, //!< A line-only semi arc (since QGIS 3.20)
ThirdArc, //!< A line-only one third arc (since QGIS 3.20)
QuarterArc, //!< A line-only quarter arc (since QGIS 3.20)
};

//! Returns a list of all available shape types.

0 comments on commit b3d27aa

Please sign in to comment.