Promote some symbol layer enums to enum classes, move to Qgis

This commit is contained in:
Nyall Dawson 2021-10-21 09:53:19 +10:00
parent b89cda5d50
commit fc0d1869bc
28 changed files with 1221 additions and 820 deletions

View File

@ -908,3 +908,182 @@ QgsVertexId.CurveVertex.__doc__ = "An intermediate point on a segment defining t
Qgis.VertexType.__doc__ = 'Types of vertex.\n\n.. versionadded:: 3.22\n\n' + '* ``SegmentVertex``: ' + Qgis.VertexType.Segment.__doc__ + '\n' + '* ``CurveVertex``: ' + Qgis.VertexType.Curve.__doc__
# --
Qgis.VertexType.baseClass = Qgis
QgsSimpleMarkerSymbolLayerBase.Shape = Qgis.MarkerShape
# monkey patching scoped based enum
QgsSimpleMarkerSymbolLayerBase.Square = Qgis.MarkerShape.Square
QgsSimpleMarkerSymbolLayerBase.Square.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Square.__doc__ = "Square"
QgsSimpleMarkerSymbolLayerBase.Diamond = Qgis.MarkerShape.Diamond
QgsSimpleMarkerSymbolLayerBase.Diamond.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Diamond.__doc__ = "Diamond"
QgsSimpleMarkerSymbolLayerBase.Pentagon = Qgis.MarkerShape.Pentagon
QgsSimpleMarkerSymbolLayerBase.Pentagon.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Pentagon.__doc__ = "Pentagon"
QgsSimpleMarkerSymbolLayerBase.Hexagon = Qgis.MarkerShape.Hexagon
QgsSimpleMarkerSymbolLayerBase.Hexagon.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Hexagon.__doc__ = "Hexagon"
QgsSimpleMarkerSymbolLayerBase.Triangle = Qgis.MarkerShape.Triangle
QgsSimpleMarkerSymbolLayerBase.Triangle.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Triangle.__doc__ = "Triangle"
QgsSimpleMarkerSymbolLayerBase.EquilateralTriangle = Qgis.MarkerShape.EquilateralTriangle
QgsSimpleMarkerSymbolLayerBase.EquilateralTriangle.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.EquilateralTriangle.__doc__ = "Equilateral triangle"
QgsSimpleMarkerSymbolLayerBase.Star = Qgis.MarkerShape.Star
QgsSimpleMarkerSymbolLayerBase.Star.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Star.__doc__ = "Star"
QgsSimpleMarkerSymbolLayerBase.Arrow = Qgis.MarkerShape.Arrow
QgsSimpleMarkerSymbolLayerBase.Arrow.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Arrow.__doc__ = "Arrow"
QgsSimpleMarkerSymbolLayerBase.Circle = Qgis.MarkerShape.Circle
QgsSimpleMarkerSymbolLayerBase.Circle.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Circle.__doc__ = "Circle"
QgsSimpleMarkerSymbolLayerBase.Cross = Qgis.MarkerShape.Cross
QgsSimpleMarkerSymbolLayerBase.Cross.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Cross.__doc__ = "Cross (lines only)"
QgsSimpleMarkerSymbolLayerBase.CrossFill = Qgis.MarkerShape.CrossFill
QgsSimpleMarkerSymbolLayerBase.CrossFill.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.CrossFill.__doc__ = "Solid filled cross"
QgsSimpleMarkerSymbolLayerBase.Cross2 = Qgis.MarkerShape.Cross2
QgsSimpleMarkerSymbolLayerBase.Cross2.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Cross2.__doc__ = "Rotated cross (lines only), "x" shape"
QgsSimpleMarkerSymbolLayerBase.Line = Qgis.MarkerShape.Line
QgsSimpleMarkerSymbolLayerBase.Line.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Line.__doc__ = "Vertical line"
QgsSimpleMarkerSymbolLayerBase.ArrowHead = Qgis.MarkerShape.ArrowHead
QgsSimpleMarkerSymbolLayerBase.ArrowHead.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.ArrowHead.__doc__ = "Right facing arrow head (unfilled, lines only)"
QgsSimpleMarkerSymbolLayerBase.ArrowHeadFilled = Qgis.MarkerShape.ArrowHeadFilled
QgsSimpleMarkerSymbolLayerBase.ArrowHeadFilled.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.ArrowHeadFilled.__doc__ = "Right facing filled arrow head"
QgsSimpleMarkerSymbolLayerBase.SemiCircle = Qgis.MarkerShape.SemiCircle
QgsSimpleMarkerSymbolLayerBase.SemiCircle.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.SemiCircle.__doc__ = "Semi circle (top half)"
QgsSimpleMarkerSymbolLayerBase.ThirdCircle = Qgis.MarkerShape.ThirdCircle
QgsSimpleMarkerSymbolLayerBase.ThirdCircle.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.ThirdCircle.__doc__ = "One third circle (top left third)"
QgsSimpleMarkerSymbolLayerBase.QuarterCircle = Qgis.MarkerShape.QuarterCircle
QgsSimpleMarkerSymbolLayerBase.QuarterCircle.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.QuarterCircle.__doc__ = "Quarter circle (top left quarter)"
QgsSimpleMarkerSymbolLayerBase.QuarterSquare = Qgis.MarkerShape.QuarterSquare
QgsSimpleMarkerSymbolLayerBase.QuarterSquare.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.QuarterSquare.__doc__ = "Quarter square (top left quarter)"
QgsSimpleMarkerSymbolLayerBase.HalfSquare = Qgis.MarkerShape.HalfSquare
QgsSimpleMarkerSymbolLayerBase.HalfSquare.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.HalfSquare.__doc__ = "Half square (left half)"
QgsSimpleMarkerSymbolLayerBase.DiagonalHalfSquare = Qgis.MarkerShape.DiagonalHalfSquare
QgsSimpleMarkerSymbolLayerBase.DiagonalHalfSquare.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.DiagonalHalfSquare.__doc__ = "Diagonal half square (bottom left half)"
QgsSimpleMarkerSymbolLayerBase.RightHalfTriangle = Qgis.MarkerShape.RightHalfTriangle
QgsSimpleMarkerSymbolLayerBase.RightHalfTriangle.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.RightHalfTriangle.__doc__ = "Right half of triangle"
QgsSimpleMarkerSymbolLayerBase.LeftHalfTriangle = Qgis.MarkerShape.LeftHalfTriangle
QgsSimpleMarkerSymbolLayerBase.LeftHalfTriangle.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.LeftHalfTriangle.__doc__ = "Left half of triangle"
QgsSimpleMarkerSymbolLayerBase.Octagon = Qgis.MarkerShape.Octagon
QgsSimpleMarkerSymbolLayerBase.Octagon.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.Octagon.__doc__ = "Octagon (since QGIS 3.18)"
QgsSimpleMarkerSymbolLayerBase.SquareWithCorners = Qgis.MarkerShape.SquareWithCorners
QgsSimpleMarkerSymbolLayerBase.SquareWithCorners.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.SquareWithCorners.__doc__ = "A square with diagonal corners (since QGIS 3.18)"
QgsSimpleMarkerSymbolLayerBase.AsteriskFill = Qgis.MarkerShape.AsteriskFill
QgsSimpleMarkerSymbolLayerBase.AsteriskFill.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.AsteriskFill.__doc__ = "A filled asterisk shape (since QGIS 3.18)"
QgsSimpleMarkerSymbolLayerBase.HalfArc = Qgis.MarkerShape.HalfArc
QgsSimpleMarkerSymbolLayerBase.HalfArc.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.HalfArc.__doc__ = "A line-only half arc (since QGIS 3.20)"
QgsSimpleMarkerSymbolLayerBase.ThirdArc = Qgis.MarkerShape.ThirdArc
QgsSimpleMarkerSymbolLayerBase.ThirdArc.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.ThirdArc.__doc__ = "A line-only one third arc (since QGIS 3.20)"
QgsSimpleMarkerSymbolLayerBase.QuarterArc = Qgis.MarkerShape.QuarterArc
QgsSimpleMarkerSymbolLayerBase.QuarterArc.is_monkey_patched = True
QgsSimpleMarkerSymbolLayerBase.QuarterArc.__doc__ = "A line-only one quarter arc (since QGIS 3.20)"
Qgis.MarkerShape.__doc__ = 'Marker shapes.\n\n.. note::\n\n Prior to QGIS 3.24 this was available as :py:class:`QgsSimpleMarkerSymbolLayerBase`.Shape\n\n.. versionadded:: 3.24\n\n' + '* ``Square``: ' + Qgis.MarkerShape.Square.__doc__ + '\n' + '* ``Diamond``: ' + Qgis.MarkerShape.Diamond.__doc__ + '\n' + '* ``Pentagon``: ' + Qgis.MarkerShape.Pentagon.__doc__ + '\n' + '* ``Hexagon``: ' + Qgis.MarkerShape.Hexagon.__doc__ + '\n' + '* ``Triangle``: ' + Qgis.MarkerShape.Triangle.__doc__ + '\n' + '* ``EquilateralTriangle``: ' + Qgis.MarkerShape.EquilateralTriangle.__doc__ + '\n' + '* ``Star``: ' + Qgis.MarkerShape.Star.__doc__ + '\n' + '* ``Arrow``: ' + Qgis.MarkerShape.Arrow.__doc__ + '\n' + '* ``Circle``: ' + Qgis.MarkerShape.Circle.__doc__ + '\n' + '* ``Cross``: ' + Qgis.MarkerShape.Cross.__doc__ + '\n' + '* ``CrossFill``: ' + Qgis.MarkerShape.CrossFill.__doc__ + '\n' + '* ``Cross2``: ' + Qgis.MarkerShape.Cross2.__doc__ + '\n' + '* ``Line``: ' + Qgis.MarkerShape.Line.__doc__ + '\n' + '* ``ArrowHead``: ' + Qgis.MarkerShape.ArrowHead.__doc__ + '\n' + '* ``ArrowHeadFilled``: ' + Qgis.MarkerShape.ArrowHeadFilled.__doc__ + '\n' + '* ``SemiCircle``: ' + Qgis.MarkerShape.SemiCircle.__doc__ + '\n' + '* ``ThirdCircle``: ' + Qgis.MarkerShape.ThirdCircle.__doc__ + '\n' + '* ``QuarterCircle``: ' + Qgis.MarkerShape.QuarterCircle.__doc__ + '\n' + '* ``QuarterSquare``: ' + Qgis.MarkerShape.QuarterSquare.__doc__ + '\n' + '* ``HalfSquare``: ' + Qgis.MarkerShape.HalfSquare.__doc__ + '\n' + '* ``DiagonalHalfSquare``: ' + Qgis.MarkerShape.DiagonalHalfSquare.__doc__ + '\n' + '* ``RightHalfTriangle``: ' + Qgis.MarkerShape.RightHalfTriangle.__doc__ + '\n' + '* ``LeftHalfTriangle``: ' + Qgis.MarkerShape.LeftHalfTriangle.__doc__ + '\n' + '* ``Octagon``: ' + Qgis.MarkerShape.Octagon.__doc__ + '\n' + '* ``SquareWithCorners``: ' + Qgis.MarkerShape.SquareWithCorners.__doc__ + '\n' + '* ``AsteriskFill``: ' + Qgis.MarkerShape.AsteriskFill.__doc__ + '\n' + '* ``HalfArc``: ' + Qgis.MarkerShape.HalfArc.__doc__ + '\n' + '* ``ThirdArc``: ' + Qgis.MarkerShape.ThirdArc.__doc__ + '\n' + '* ``QuarterArc``: ' + Qgis.MarkerShape.QuarterArc.__doc__
# --
Qgis.MarkerShape.baseClass = Qgis
QgsTemplatedLineSymbolLayerBase.Placement = Qgis.MarkerLinePlacement
# monkey patching scoped based enum
QgsTemplatedLineSymbolLayerBase.Interval = Qgis.MarkerLinePlacement.Interval
QgsTemplatedLineSymbolLayerBase.Interval.is_monkey_patched = True
QgsTemplatedLineSymbolLayerBase.Interval.__doc__ = "Place symbols at regular intervals"
QgsTemplatedLineSymbolLayerBase.Vertex = Qgis.MarkerLinePlacement.Vertex
QgsTemplatedLineSymbolLayerBase.Vertex.is_monkey_patched = True
QgsTemplatedLineSymbolLayerBase.Vertex.__doc__ = "Place symbols on every vertex in the line"
QgsTemplatedLineSymbolLayerBase.LastVertex = Qgis.MarkerLinePlacement.LastVertex
QgsTemplatedLineSymbolLayerBase.LastVertex.is_monkey_patched = True
QgsTemplatedLineSymbolLayerBase.LastVertex.__doc__ = "Place symbols on the last vertex in the line"
QgsTemplatedLineSymbolLayerBase.FirstVertex = Qgis.MarkerLinePlacement.FirstVertex
QgsTemplatedLineSymbolLayerBase.FirstVertex.is_monkey_patched = True
QgsTemplatedLineSymbolLayerBase.FirstVertex.__doc__ = "Place symbols on the first vertex in the line"
QgsTemplatedLineSymbolLayerBase.CentralPoint = Qgis.MarkerLinePlacement.CentralPoint
QgsTemplatedLineSymbolLayerBase.CentralPoint.is_monkey_patched = True
QgsTemplatedLineSymbolLayerBase.CentralPoint.__doc__ = "Place symbols at the mid point of the line"
QgsTemplatedLineSymbolLayerBase.CurvePoint = Qgis.MarkerLinePlacement.CurvePoint
QgsTemplatedLineSymbolLayerBase.CurvePoint.is_monkey_patched = True
QgsTemplatedLineSymbolLayerBase.CurvePoint.__doc__ = "Place symbols at every virtual curve point in the line (used when rendering curved geometry types only)"
QgsTemplatedLineSymbolLayerBase.SegmentCenter = Qgis.MarkerLinePlacement.SegmentCenter
QgsTemplatedLineSymbolLayerBase.SegmentCenter.is_monkey_patched = True
QgsTemplatedLineSymbolLayerBase.SegmentCenter.__doc__ = "Place symbols at the center of every line segment"
Qgis.MarkerLinePlacement.__doc__ = 'Defines how/where the symbols should be placed on a line.\n\n.. note::\n\n Prior to QGIS 3.24 this was available as :py:class:`QgsTemplatedLineSymbolLayerBase`.Placement\n\n.. versionadded:: 3.24\n\n' + '* ``Interval``: ' + Qgis.MarkerLinePlacement.Interval.__doc__ + '\n' + '* ``Vertex``: ' + Qgis.MarkerLinePlacement.Vertex.__doc__ + '\n' + '* ``LastVertex``: ' + Qgis.MarkerLinePlacement.LastVertex.__doc__ + '\n' + '* ``FirstVertex``: ' + Qgis.MarkerLinePlacement.FirstVertex.__doc__ + '\n' + '* ``CentralPoint``: ' + Qgis.MarkerLinePlacement.CentralPoint.__doc__ + '\n' + '* ``CurvePoint``: ' + Qgis.MarkerLinePlacement.CurvePoint.__doc__ + '\n' + '* ``SegmentCenter``: ' + Qgis.MarkerLinePlacement.SegmentCenter.__doc__
# --
Qgis.MarkerLinePlacement.baseClass = Qgis
QgsGradientFillSymbolLayer.GradientColorType = Qgis.GradientColorSource
# monkey patching scoped based enum
QgsGradientFillSymbolLayer.SimpleTwoColor = Qgis.GradientColorSource.SimpleTwoColor
QgsGradientFillSymbolLayer.SimpleTwoColor.is_monkey_patched = True
QgsGradientFillSymbolLayer.SimpleTwoColor.__doc__ = "Simple two color gradient"
QgsGradientFillSymbolLayer.ColorRamp = Qgis.GradientColorSource.ColorRamp
QgsGradientFillSymbolLayer.ColorRamp.is_monkey_patched = True
QgsGradientFillSymbolLayer.ColorRamp.__doc__ = "Gradient color ramp"
Qgis.GradientColorSource.__doc__ = 'Gradient color sources.\n\n.. note::\n\n Prior to QGIS 3.24 this was available as :py:class:`QgsGradientFillSymbolLayer`.GradientColorType\n\n.. versionadded:: 3.24\n\n' + '* ``SimpleTwoColor``: ' + Qgis.GradientColorSource.SimpleTwoColor.__doc__ + '\n' + '* ``ColorRamp``: ' + Qgis.GradientColorSource.ColorRamp.__doc__
# --
Qgis.GradientColorSource.baseClass = Qgis
QgsGradientFillSymbolLayer.GradientType = Qgis.GradientType
# monkey patching scoped based enum
QgsGradientFillSymbolLayer.Linear = Qgis.GradientType.Linear
QgsGradientFillSymbolLayer.Linear.is_monkey_patched = True
QgsGradientFillSymbolLayer.Linear.__doc__ = "Linear gradient"
QgsGradientFillSymbolLayer.Radial = Qgis.GradientType.Radial
QgsGradientFillSymbolLayer.Radial.is_monkey_patched = True
QgsGradientFillSymbolLayer.Radial.__doc__ = "Radial (circular) gradient"
QgsGradientFillSymbolLayer.Conical = Qgis.GradientType.Conical
QgsGradientFillSymbolLayer.Conical.is_monkey_patched = True
QgsGradientFillSymbolLayer.Conical.__doc__ = "Conical (polar) gradient"
Qgis.GradientType.__doc__ = 'Gradient types.\n\n.. note::\n\n Prior to QGIS 3.24 this was available as :py:class:`QgsGradientFillSymbolLayer`.GradientType\n\n.. versionadded:: 3.24\n\n' + '* ``Linear``: ' + Qgis.GradientType.Linear.__doc__ + '\n' + '* ``Radial``: ' + Qgis.GradientType.Radial.__doc__ + '\n' + '* ``Conical``: ' + Qgis.GradientType.Conical.__doc__
# --
Qgis.GradientType.baseClass = Qgis
QgsGradientFillSymbolLayer.GradientCoordinateMode = Qgis.SymbolCoordinateReference
# monkey patching scoped based enum
QgsGradientFillSymbolLayer.Feature = Qgis.SymbolCoordinateReference.Feature
QgsGradientFillSymbolLayer.Feature.is_monkey_patched = True
QgsGradientFillSymbolLayer.Feature.__doc__ = "Relative to feature/shape being rendered"
QgsGradientFillSymbolLayer.Viewport = Qgis.SymbolCoordinateReference.Viewport
QgsGradientFillSymbolLayer.Viewport.is_monkey_patched = True
QgsGradientFillSymbolLayer.Viewport.__doc__ = "Relative to the whole viewport/output device"
Qgis.SymbolCoordinateReference.__doc__ = 'Symbol coordinate reference modes.\n\n.. note::\n\n Prior to QGIS 3.24 this was available as :py:class:`QgsGradientFillSymbolLayer`.GradientCoordinateMode\n\n.. versionadded:: 3.24\n\n' + '* ``Feature``: ' + Qgis.SymbolCoordinateReference.Feature.__doc__ + '\n' + '* ``Viewport``: ' + Qgis.SymbolCoordinateReference.Viewport.__doc__
# --
Qgis.SymbolCoordinateReference.baseClass = Qgis
QgsGradientFillSymbolLayer.GradientSpread = Qgis.GradientSpread
# monkey patching scoped based enum
QgsGradientFillSymbolLayer.Pad = Qgis.GradientSpread.Pad
QgsGradientFillSymbolLayer.Pad.is_monkey_patched = True
QgsGradientFillSymbolLayer.Pad.__doc__ = "Pad out gradient using colors at endpoint of gradient"
QgsGradientFillSymbolLayer.Reflect = Qgis.GradientSpread.Reflect
QgsGradientFillSymbolLayer.Reflect.is_monkey_patched = True
QgsGradientFillSymbolLayer.Reflect.__doc__ = "Reflect gradient"
QgsGradientFillSymbolLayer.Repeat = Qgis.GradientSpread.Repeat
QgsGradientFillSymbolLayer.Repeat.is_monkey_patched = True
QgsGradientFillSymbolLayer.Repeat.__doc__ = "Repeat gradient"
Qgis.GradientSpread.__doc__ = 'Gradient spread options, which control how gradients are rendered outside of their\nstart and end points.\n\n.. note::\n\n Prior to QGIS 3.24 this was available as :py:class:`QgsGradientFillSymbolLayer`.GradientSpread\n\n.. versionadded:: 3.24\n\n' + '* ``Pad``: ' + Qgis.GradientSpread.Pad.__doc__ + '\n' + '* ``Reflect``: ' + Qgis.GradientSpread.Reflect.__doc__ + '\n' + '* ``Repeat``: ' + Qgis.GradientSpread.Repeat.__doc__
# --
Qgis.GradientSpread.baseClass = Qgis
QgsRandomMarkerFillSymbolLayer.CountMethod = Qgis.PointCountMethod
# monkey patching scoped based enum
QgsRandomMarkerFillSymbolLayer.AbsoluteCount = Qgis.PointCountMethod.Absolute
QgsRandomMarkerFillSymbolLayer.AbsoluteCount.is_monkey_patched = True
QgsRandomMarkerFillSymbolLayer.AbsoluteCount.__doc__ = "The point count is used as an absolute count of markers"
QgsRandomMarkerFillSymbolLayer.DensityBasedCount = Qgis.PointCountMethod.DensityBased
QgsRandomMarkerFillSymbolLayer.DensityBasedCount.is_monkey_patched = True
QgsRandomMarkerFillSymbolLayer.DensityBasedCount.__doc__ = "The point count is part of a marker density count"
Qgis.PointCountMethod.__doc__ = 'Methods which define the number of points randomly filling a polygon.\n\n.. note::\n\n Prior to QGIS 3.24 this was available as :py:class:`QgsRandomMarkerFillSymbolLayer`.CountMethod\n\n.. versionadded:: 3.24\n\n' + '* ``AbsoluteCount``: ' + Qgis.PointCountMethod.Absolute.__doc__ + '\n' + '* ``DensityBasedCount``: ' + Qgis.PointCountMethod.DensityBased.__doc__
# --
Qgis.PointCountMethod.baseClass = Qgis

View File

@ -615,6 +615,82 @@ The development version
Curve,
};
enum class MarkerShape
{
Square,
Diamond,
Pentagon,
Hexagon,
Triangle,
EquilateralTriangle,
Star,
Arrow,
Circle,
Cross,
CrossFill,
Cross2,
Line,
ArrowHead,
ArrowHeadFilled,
SemiCircle,
ThirdCircle,
QuarterCircle,
QuarterSquare,
HalfSquare,
DiagonalHalfSquare,
RightHalfTriangle,
LeftHalfTriangle,
Octagon,
SquareWithCorners,
AsteriskFill,
HalfArc,
ThirdArc,
QuarterArc,
};
enum class MarkerLinePlacement
{
Interval,
Vertex,
LastVertex,
FirstVertex,
CentralPoint,
CurvePoint,
SegmentCenter,
};
enum class GradientColorSource
{
SimpleTwoColor,
ColorRamp,
};
enum class GradientType
{
Linear,
Radial,
Conical,
};
enum class SymbolCoordinateReference
{
Feature,
Viewport,
};
enum class GradientSpread
{
Pad,
Reflect,
Repeat,
};
enum class PointCountMethod
{
Absolute,
DensityBased,
};
static const double DEFAULT_SEARCH_RADIUS_MM;
static const float DEFAULT_MAPTOPIXEL_THRESHOLD;

View File

@ -201,39 +201,16 @@ class QgsGradientFillSymbolLayer : QgsFillSymbolLayer
%End
public:
enum GradientColorType
{
SimpleTwoColor,
ColorRamp
};
enum GradientType
{
Linear,
Radial,
Conical
};
enum GradientCoordinateMode
{
Feature,
Viewport
};
enum GradientSpread
{
Pad,
Reflect,
Repeat
};
QgsGradientFillSymbolLayer( const QColor &color = DEFAULT_SIMPLEFILL_COLOR,
const QColor &color2 = Qt::white,
GradientColorType gradientColorType = SimpleTwoColor,
GradientType gradientType = Linear,
GradientCoordinateMode coordinateMode = Feature,
GradientSpread gradientSpread = Pad
Qgis::GradientColorSource gradientColorType = Qgis::GradientColorSource::SimpleTwoColor,
Qgis::GradientType gradientType = Qgis::GradientType::Linear,
Qgis::SymbolCoordinateReference coordinateMode = Qgis::SymbolCoordinateReference::Feature,
Qgis::GradientSpread gradientSpread = Qgis::GradientSpread::Pad
);
%Docstring
Constructor for QgsGradientFillSymbolLayer.
%End
~QgsGradientFillSymbolLayer();
@ -263,17 +240,33 @@ Caller takes ownership of the returned symbol layer.
virtual bool canCauseArtifactsBetweenAdjacentTiles() const;
GradientType gradientType() const;
Qgis::GradientType gradientType() const;
%Docstring
Type of gradient, e.g., linear or radial
%End
void setGradientType( GradientType gradientType );
Returns the type of gradient, e.g., linear or radial.
GradientColorType gradientColorType() const;
%Docstring
Gradient color mode, controls how gradient color stops are created
.. seealso:: :py:func:`setGradientType`
%End
void setGradientType( Qgis::GradientType gradientType );
%Docstring
Sets the type of gradient, e.g., linear or radial.
.. seealso:: :py:func:`gradientType`
%End
Qgis::GradientColorSource gradientColorType() const;
%Docstring
Returns the gradient color mode, which controls how gradient color stops are created.
.. seealso:: :py:func:`setGradientColorType`
%End
void setGradientColorType( Qgis::GradientColorSource gradientColorType );
%Docstring
Sets the gradient color mode, which controls how gradient color stops are created.
.. seealso:: :py:func:`gradientColorType`
%End
void setGradientColorType( GradientColorType gradientColorType );
QgsColorRamp *colorRamp();
%Docstring
@ -299,45 +292,102 @@ used if the gradient color type is set to ColorRamp.
QColor color2() const;
%Docstring
Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor
Returns the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
.. seealso:: :py:func:`setColor2`
%End
void setColor2( const QColor &color2 );
GradientCoordinateMode coordinateMode() const;
%Docstring
Coordinate mode for gradient. Controls how the gradient stops are positioned.
%End
void setCoordinateMode( GradientCoordinateMode coordinateMode );
Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
GradientSpread gradientSpread() const;
%Docstring
Gradient spread mode. Controls how the gradient behaves outside of the predefined stops
.. seealso:: :py:func:`color2`
%End
Qgis::SymbolCoordinateReference coordinateMode() const;
%Docstring
Returns the coordinate mode for gradient, which controls how the gradient stops are positioned.
.. seealso:: :py:func:`setCoordinateMode`
%End
void setCoordinateMode( Qgis::SymbolCoordinateReference coordinateMode );
%Docstring
Sets the coordinate mode for gradient, which controls how the gradient stops are positioned.
.. seealso:: :py:func:`coordinateMode`
%End
Qgis::GradientSpread gradientSpread() const;
%Docstring
Returns the gradient spread mode, which controls how the gradient behaves outside of the predefined stops.
.. seealso:: :py:func:`setGradientSpread`
%End
void setGradientSpread( Qgis::GradientSpread gradientSpread );
%Docstring
Sets the gradient spread mode, which controls how the gradient behaves outside of the predefined stops.
.. seealso:: :py:func:`gradientSpread`
%End
void setGradientSpread( GradientSpread gradientSpread );
void setReferencePoint1( QPointF referencePoint );
%Docstring
Starting point of gradient fill, in the range [0,0] - [1,1]
Sets the starting point of gradient fill, in the range [0,0] - [1,1].
.. seealso:: :py:func:`referencePoint1`
%End
QPointF referencePoint1() const;
%Docstring
Returns the starting point of gradient fill, in the range [0,0] - [1,1].
.. seealso:: :py:func:`setReferencePoint1`
%End
void setReferencePoint1IsCentroid( bool isCentroid );
%Docstring
Sets the starting point of the gradient to be the feature centroid
Sets whether the starting point for the gradient is taken from the feature centroid.
.. seealso:: :py:func:`referencePoint1IsCentroid`
%End
bool referencePoint1IsCentroid() const;
%Docstring
Returns whether the starting point for the gradient is taken from the feature centroid.
.. seealso:: :py:func:`setReferencePoint1IsCentroid`
%End
void setReferencePoint2( QPointF referencePoint );
%Docstring
End point of gradient fill, in the range [0,0] - [1,1]
Sets the end point of gradient fill, in the range [0,0] - [1,1].
.. seealso:: :py:func:`referencePoint2`
%End
QPointF referencePoint2() const;
%Docstring
Returns the end point of gradient fill, in the range [0,0] - [1,1].
.. seealso:: :py:func:`setReferencePoint2`
%End
void setReferencePoint2IsCentroid( bool isCentroid );
%Docstring
Sets the end point of the gradient to be the feature centroid
Sets whether the end point for the gradient is taken from the feature centroid.
.. seealso:: :py:func:`referencePoint2IsCentroid`
%End
bool referencePoint2IsCentroid() const;
%Docstring
Returns whether the end point for the gradient is taken from the feature centroid.
.. seealso:: :py:func:`setReferencePoint2IsCentroid`
%End
void setOffset( QPointF offset );
%Docstring
@ -2045,13 +2095,7 @@ A fill symbol layer which places markers at random locations within polygons.
%End
public:
enum CountMethod
{
AbsoluteCount,
DensityBasedCount,
};
QgsRandomMarkerFillSymbolLayer( int pointCount = 10, CountMethod method = AbsoluteCount, double densityArea = 250.0, unsigned long seed = 0 );
QgsRandomMarkerFillSymbolLayer( int pointCount = 10, Qgis::PointCountMethod method = Qgis::PointCountMethod::Absolute, double densityArea = 250.0, unsigned long seed = 0 );
%Docstring
Constructor for QgsRandomMarkerFillSymbolLayer, with the specified ``pointCount``.
@ -2155,14 +2199,14 @@ Sets whether point markers should be ``clipped`` to the polygon boundary.
.. seealso:: :py:func:`clipPoints`
%End
CountMethod countMethod() const;
Qgis::PointCountMethod countMethod() const;
%Docstring
Returns the count method used to randomly fill the polygon.
.. seealso:: :py:func:`setCountMethod`
%End
void setCountMethod( CountMethod method );
void setCountMethod( Qgis::PointCountMethod method );
%Docstring
Sets the count ``method`` used to randomly fill the polygon.

View File

@ -588,17 +588,6 @@ lines at intervals along the line feature.
%End
public:
enum Placement
{
Interval,
Vertex,
LastVertex,
FirstVertex,
CentralPoint,
CurvePoint,
SegmentCenter,
};
QgsTemplatedLineSymbolLayerBase( bool rotateSymbol = true,
double interval = 3 );
%Docstring
@ -687,14 +676,14 @@ Returns the map unit scale for the interval between symbols.
.. seealso:: :py:func:`interval`
%End
Placement placement() const;
Qgis::MarkerLinePlacement placement() const;
%Docstring
Returns the placement of the symbols.
.. seealso:: :py:func:`setPlacement`
%End
void setPlacement( Placement placement );
void setPlacement( Qgis::MarkerLinePlacement placement );
%Docstring
Sets the ``placement`` of the symbols.

View File

@ -25,45 +25,12 @@ leaves the actual drawing of the symbols to subclasses.
%End
public:
enum Shape
{
Square,
Diamond,
Pentagon,
Hexagon,
Triangle,
EquilateralTriangle,
Star,
Arrow,
Circle,
Cross,
CrossFill,
Cross2,
Line,
ArrowHead,
ArrowHeadFilled,
SemiCircle,
ThirdCircle,
QuarterCircle,
QuarterSquare,
HalfSquare,
DiagonalHalfSquare,
RightHalfTriangle,
LeftHalfTriangle,
Octagon,
SquareWithCorners,
AsteriskFill,
HalfArc,
ThirdArc,
QuarterArc,
};
static QList< QgsSimpleMarkerSymbolLayerBase::Shape > availableShapes();
static QList< Qgis::MarkerShape > availableShapes();
%Docstring
Returns a list of all available shape types.
%End
static bool shapeIsFilled( QgsSimpleMarkerSymbolLayerBase::Shape shape );
static bool shapeIsFilled( Qgis::MarkerShape shape );
%Docstring
Returns ``True`` if a symbol shape has a fill.
@ -72,7 +39,7 @@ Returns ``True`` if a symbol shape has a fill.
:return: ``True`` if shape uses a fill, or ``False`` if shape uses lines only
%End
QgsSimpleMarkerSymbolLayerBase( QgsSimpleMarkerSymbolLayerBase::Shape shape = Circle,
QgsSimpleMarkerSymbolLayerBase( Qgis::MarkerShape shape = Qgis::MarkerShape::Circle,
double size = DEFAULT_SIMPLEMARKER_SIZE,
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD );
@ -87,14 +54,14 @@ Constructor for QgsSimpleMarkerSymbolLayerBase.
~QgsSimpleMarkerSymbolLayerBase();
QgsSimpleMarkerSymbolLayerBase::Shape shape() const;
Qgis::MarkerShape shape() const;
%Docstring
Returns the shape for the rendered marker symbol.
.. seealso:: :py:func:`setShape`
%End
void setShape( QgsSimpleMarkerSymbolLayerBase::Shape shape );
void setShape( Qgis::MarkerShape shape );
%Docstring
Sets the rendered marker shape.
@ -103,7 +70,7 @@ Sets the rendered marker shape.
.. seealso:: :py:func:`shape`
%End
static QgsSimpleMarkerSymbolLayerBase::Shape decodeShape( const QString &name, bool *ok = 0 );
static Qgis::MarkerShape decodeShape( const QString &name, bool *ok = 0 );
%Docstring
Attempts to decode a string representation of a shape name to the corresponding
shape.
@ -116,7 +83,7 @@ shape.
.. seealso:: :py:func:`encodeShape`
%End
static QString encodeShape( QgsSimpleMarkerSymbolLayerBase::Shape shape );
static QString encodeShape( Qgis::MarkerShape shape );
%Docstring
Encodes a shape to its string representation.
@ -138,17 +105,17 @@ Encodes a shape to its string representation.
protected:
bool prepareMarkerShape( Shape shape );
bool prepareMarkerShape( Qgis::MarkerShape shape );
%Docstring
Prepares the layer for drawing the specified shape (QPolygonF version)
%End
bool prepareMarkerPath( Shape symbol );
bool prepareMarkerPath( Qgis::MarkerShape symbol );
%Docstring
Prepares the layer for drawing the specified shape (QPainterPath version)
%End
bool shapeToPolygon( Shape shape, QPolygonF &polygon ) const;
bool shapeToPolygon( Qgis::MarkerShape shape, QPolygonF &polygon ) const;
%Docstring
Creates a polygon representing the specified shape.
@ -183,7 +150,7 @@ Calculates the marker offset and rotation.
private:
virtual void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0;
virtual void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0;
%Docstring
Derived classes must implement :py:func:`~QgsSimpleMarkerSymbolLayerBase.draw` to handle drawing the generated shape onto the painter surface.
@ -206,7 +173,7 @@ Simple marker symbol layer, consisting of a rendered shape with solid fill color
%End
public:
QgsSimpleMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Shape shape = Circle,
QgsSimpleMarkerSymbolLayer( Qgis::MarkerShape shape = Qgis::MarkerShape::Circle,
double size = DEFAULT_SIMPLEMARKER_SIZE,
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD,
@ -495,7 +462,7 @@ Prepares cache image
private:
virtual void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path );
virtual void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path );
};
@ -513,7 +480,7 @@ the symbol to support advanced styling of the interior and stroke of the shape.
%End
public:
QgsFilledMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Shape shape = Circle,
QgsFilledMarkerSymbolLayer( Qgis::MarkerShape shape = Qgis::MarkerShape::Circle,
double size = DEFAULT_SIMPLEMARKER_SIZE,
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD );
@ -566,7 +533,7 @@ Creates a new QgsFilledMarkerSymbolLayer.
private:
QgsFilledMarkerSymbolLayer( const QgsFilledMarkerSymbolLayer & );
virtual void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path );
virtual void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path );
};

View File

@ -150,7 +150,7 @@ void QgsDecorationGrid::projectRead()
{
// set default symbol : cross with width=3
QgsSymbolLayerList symbolList;
symbolList << new QgsSimpleMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Cross, 3, 0 );
symbolList << new QgsSimpleMarkerSymbolLayer( Qgis::MarkerShape::Cross, 3, 0 );
mMarkerSymbol = new QgsMarkerSymbol( symbolList );
// mMarkerSymbol = new QgsMarkerSymbol();
}

View File

@ -224,16 +224,16 @@ std::unique_ptr<QgsMarkerSymbolLayer> backgroundToMarkerLayer( const QgsTextBack
{
QgsSimpleMarkerSymbolLayer *marker = new QgsSimpleMarkerSymbolLayer();
// default value
QgsSimpleMarkerSymbolLayerBase::Shape shape = QgsSimpleMarkerSymbolLayerBase::Diamond;
Qgis::MarkerShape shape = Qgis::MarkerShape::Diamond;
switch ( settings.type() )
{
case QgsTextBackgroundSettings::ShapeCircle:
case QgsTextBackgroundSettings::ShapeEllipse:
shape = QgsSimpleMarkerSymbolLayerBase::Circle;
shape = Qgis::MarkerShape::Circle;
break;
case QgsTextBackgroundSettings::ShapeRectangle:
case QgsTextBackgroundSettings::ShapeSquare:
shape = QgsSimpleMarkerSymbolLayerBase::Square;
shape = Qgis::MarkerShape::Square;
break;
case QgsTextBackgroundSettings::ShapeSVG:
case QgsTextBackgroundSettings::ShapeMarkerSymbol:

View File

@ -512,22 +512,22 @@ std::unique_ptr<QgsFillSymbol> QgsArcGisRestUtils::parseEsriPictureFillSymbolJso
return symbol;
}
QgsSimpleMarkerSymbolLayerBase::Shape QgsArcGisRestUtils::parseEsriMarkerShape( const QString &style )
Qgis::MarkerShape QgsArcGisRestUtils::parseEsriMarkerShape( const QString &style )
{
if ( style == QLatin1String( "esriSMSCircle" ) )
return QgsSimpleMarkerSymbolLayerBase::Circle;
return Qgis::MarkerShape::Circle;
else if ( style == QLatin1String( "esriSMSCross" ) )
return QgsSimpleMarkerSymbolLayerBase::Cross;
return Qgis::MarkerShape::Cross;
else if ( style == QLatin1String( "esriSMSDiamond" ) )
return QgsSimpleMarkerSymbolLayerBase::Diamond;
return Qgis::MarkerShape::Diamond;
else if ( style == QLatin1String( "esriSMSSquare" ) )
return QgsSimpleMarkerSymbolLayerBase::Square;
return Qgis::MarkerShape::Square;
else if ( style == QLatin1String( "esriSMSX" ) )
return QgsSimpleMarkerSymbolLayerBase::Cross2;
return Qgis::MarkerShape::Cross2;
else if ( style == QLatin1String( "esriSMSTriangle" ) )
return QgsSimpleMarkerSymbolLayerBase::Triangle;
return Qgis::MarkerShape::Triangle;
else
return QgsSimpleMarkerSymbolLayerBase::Circle;
return Qgis::MarkerShape::Circle;
}
std::unique_ptr<QgsMarkerSymbol> QgsArcGisRestUtils::parseEsriMarkerSymbolJson( const QVariantMap &symbolData )
@ -542,7 +542,7 @@ std::unique_ptr<QgsMarkerSymbol> QgsArcGisRestUtils::parseEsriMarkerSymbolJson(
if ( ok )
angleCW = -angleCCW;
QgsSimpleMarkerSymbolLayerBase::Shape shape = parseEsriMarkerShape( symbolData.value( QStringLiteral( "style" ) ).toString() );
Qgis::MarkerShape shape = parseEsriMarkerShape( symbolData.value( QStringLiteral( "style" ) ).toString() );
const double xOffset = symbolData.value( QStringLiteral( "xoffset" ) ).toDouble();
const double yOffset = symbolData.value( QStringLiteral( "yoffset" ) ).toDouble();

View File

@ -185,7 +185,7 @@ class CORE_EXPORT QgsArcGisRestUtils
static std::unique_ptr< QgsMarkerSymbol > parseEsriMarkerSymbolJson( const QVariantMap &symbolData );
static std::unique_ptr< QgsMarkerSymbol > parseEsriPictureMarkerSymbolJson( const QVariantMap &symbolData );
static QgsSimpleMarkerSymbolLayerBase::Shape parseEsriMarkerShape( const QString &style );
static Qgis::MarkerShape parseEsriMarkerShape( const QString &style );
friend class TestQgsArcGisRestUtils;
};

View File

@ -992,6 +992,139 @@ class CORE_EXPORT Qgis
};
Q_ENUM( VertexType )
/**
* Marker shapes.
*
* \note Prior to QGIS 3.24 this was available as QgsSimpleMarkerSymbolLayerBase::Shape
*
* \since QGIS 3.24
*/
enum class MarkerShape SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsSimpleMarkerSymbolLayerBase, Shape ) : int
{
Square, //!< Square
Diamond, //!< Diamond
Pentagon, //!< Pentagon
Hexagon, //!< Hexagon
Triangle, //!< Triangle
EquilateralTriangle, //!< Equilateral triangle
Star, //!< Star
Arrow, //!< Arrow
Circle, //!< Circle
Cross, //!< Cross (lines only)
CrossFill, //!< Solid filled cross
Cross2, //!< Rotated cross (lines only), "x" shape
Line, //!< Vertical line
ArrowHead, //!< Right facing arrow head (unfilled, lines only)
ArrowHeadFilled, //!< Right facing filled arrow head
SemiCircle, //!< Semi circle (top half)
ThirdCircle, //!< One third circle (top left third)
QuarterCircle, //!< Quarter circle (top left quarter)
QuarterSquare, //!< Quarter square (top left quarter)
HalfSquare, //!< Half square (left half)
DiagonalHalfSquare, //!< Diagonal half square (bottom left half)
RightHalfTriangle, //!< Right half of triangle
LeftHalfTriangle, //!< Left half of triangle
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)
HalfArc, //!< A line-only half arc (since QGIS 3.20)
ThirdArc, //!< A line-only one third arc (since QGIS 3.20)
QuarterArc, //!< A line-only one quarter arc (since QGIS 3.20)
};
Q_ENUM( MarkerShape )
/**
* Defines how/where the symbols should be placed on a line.
*
* \note Prior to QGIS 3.24 this was available as QgsTemplatedLineSymbolLayerBase::Placement
*
* \since QGIS 3.24
*/
enum class MarkerLinePlacement SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsTemplatedLineSymbolLayerBase, Placement ) : int
{
Interval, //!< Place symbols at regular intervals
Vertex, //!< Place symbols on every vertex in the line
LastVertex, //!< Place symbols on the last vertex in the line
FirstVertex, //!< Place symbols on the first vertex in the line
CentralPoint, //!< Place symbols at the mid point of the line
CurvePoint, //!< Place symbols at every virtual curve point in the line (used when rendering curved geometry types only)
SegmentCenter, //!< Place symbols at the center of every line segment
};
Q_ENUM( MarkerLinePlacement )
/**
* Gradient color sources.
*
* \note Prior to QGIS 3.24 this was available as QgsGradientFillSymbolLayer::GradientColorType
*
* \since QGIS 3.24
*/
enum class GradientColorSource SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsGradientFillSymbolLayer, GradientColorType ) : int
{
SimpleTwoColor, //!< Simple two color gradient
ColorRamp, //!< Gradient color ramp
};
Q_ENUM( GradientColorSource )
/**
* Gradient types.
*
* \note Prior to QGIS 3.24 this was available as QgsGradientFillSymbolLayer::GradientType
*
* \since QGIS 3.24
*/
enum class GradientType SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsGradientFillSymbolLayer, GradientType ) : int
{
Linear, //!< Linear gradient
Radial, //!< Radial (circular) gradient
Conical, //!< Conical (polar) gradient
};
Q_ENUM( GradientType )
/**
* Symbol coordinate reference modes.
*
* \note Prior to QGIS 3.24 this was available as QgsGradientFillSymbolLayer::GradientCoordinateMode
*
* \since QGIS 3.24
*/
enum class SymbolCoordinateReference SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsGradientFillSymbolLayer, GradientCoordinateMode ) : int
{
Feature, //!< Relative to feature/shape being rendered
Viewport, //!< Relative to the whole viewport/output device
};
Q_ENUM( SymbolCoordinateReference )
/**
* Gradient spread options, which control how gradients are rendered outside of their
* start and end points.
*
* \note Prior to QGIS 3.24 this was available as QgsGradientFillSymbolLayer::GradientSpread
*
* \since QGIS 3.24
*/
enum class GradientSpread SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsGradientFillSymbolLayer, GradientSpread ) : int
{
Pad, //!< Pad out gradient using colors at endpoint of gradient
Reflect, //!< Reflect gradient
Repeat, //!< Repeat gradient
};
Q_ENUM( GradientSpread )
/**
* Methods which define the number of points randomly filling a polygon.
*
* \note Prior to QGIS 3.24 this was available as QgsRandomMarkerFillSymbolLayer::CountMethod
*
* \since QGIS 3.24
*/
enum class PointCountMethod SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsRandomMarkerFillSymbolLayer, CountMethod ) : int
{
Absolute SIP_MONKEYPATCH_COMPAT_NAME( AbsoluteCount ), //!< The point count is used as an absolute count of markers
DensityBased SIP_MONKEYPATCH_COMPAT_NAME( DensityBasedCount ), //!< The point count is part of a marker density count
};
Q_ENUM( PointCountMethod )
/**
* Identify search radius in mm
* \since QGIS 2.3

View File

@ -1561,7 +1561,7 @@ std::unique_ptr<QgsSymbol> QgsOgrUtils::symbolFromStyleString( const QString &st
const thread_local QRegularExpression sOgrId = QRegularExpression( QStringLiteral( "ogr-sym-(\\d+)" ) );
const QRegularExpressionMatch ogrMatch = sOgrId.match( id );
QgsSimpleMarkerSymbolLayerBase::Shape shape;
Qgis::MarkerShape shape;
bool isFilled = true;
if ( ogrMatch.hasMatch() )
{
@ -1569,63 +1569,63 @@ std::unique_ptr<QgsSymbol> QgsOgrUtils::symbolFromStyleString( const QString &st
switch ( symId )
{
case 0:
shape = QgsSimpleMarkerSymbolLayer::Shape::Cross;
shape = Qgis::MarkerShape::Cross;
break;
case 1:
shape = QgsSimpleMarkerSymbolLayer::Shape::Cross2;
shape = Qgis::MarkerShape::Cross2;
break;
case 2:
isFilled = false;
shape = QgsSimpleMarkerSymbolLayer::Shape::Circle;
shape = Qgis::MarkerShape::Circle;
break;
case 3:
shape = QgsSimpleMarkerSymbolLayer::Shape::Circle;
shape = Qgis::MarkerShape::Circle;
break;
case 4:
isFilled = false;
shape = QgsSimpleMarkerSymbolLayer::Shape::Square;
shape = Qgis::MarkerShape::Square;
break;
case 5:
shape = QgsSimpleMarkerSymbolLayer::Shape::Square;
shape = Qgis::MarkerShape::Square;
break;
case 6:
isFilled = false;
shape = QgsSimpleMarkerSymbolLayer::Shape::Triangle;
shape = Qgis::MarkerShape::Triangle;
break;
case 7:
shape = QgsSimpleMarkerSymbolLayer::Shape::Triangle;
shape = Qgis::MarkerShape::Triangle;
break;
case 8:
isFilled = false;
shape = QgsSimpleMarkerSymbolLayer::Shape::Star;
shape = Qgis::MarkerShape::Star;
break;
case 9:
shape = QgsSimpleMarkerSymbolLayer::Shape::Star;
shape = Qgis::MarkerShape::Star;
break;
case 10:
shape = QgsSimpleMarkerSymbolLayer::Shape::Line;
shape = Qgis::MarkerShape::Line;
break;
default:
isFilled = false;
shape = QgsSimpleMarkerSymbolLayer::Shape::Square; // to initialize the variable
shape = Qgis::MarkerShape::Square; // to initialize the variable
break;
}
}
else
{
isFilled = false;
shape = QgsSimpleMarkerSymbolLayer::Shape::Square; // to initialize the variable
shape = Qgis::MarkerShape::Square; // to initialize the variable
}
std::unique_ptr< QgsSimpleMarkerSymbolLayer > simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, symbolSize, -angle );

View File

@ -520,8 +520,8 @@ Qt::BrushStyle QgsSimpleFillSymbolLayer::dxfBrushStyle() const
//QgsGradientFillSymbolLayer
QgsGradientFillSymbolLayer::QgsGradientFillSymbolLayer( const QColor &color, const QColor &color2,
GradientColorType colorType, GradientType gradientType,
GradientCoordinateMode coordinateMode, GradientSpread spread )
Qgis::GradientColorSource colorType, Qgis::GradientType gradientType,
Qgis::SymbolCoordinateReference coordinateMode, Qgis::GradientSpread spread )
: mGradientColorType( colorType )
, mGradientType( gradientType )
, mCoordinateMode( coordinateMode )
@ -541,10 +541,10 @@ QgsGradientFillSymbolLayer::~QgsGradientFillSymbolLayer()
QgsSymbolLayer *QgsGradientFillSymbolLayer::create( const QVariantMap &props )
{
//default to a two-color, linear gradient with feature mode and pad spreading
GradientType type = QgsGradientFillSymbolLayer::Linear;
GradientColorType colorType = QgsGradientFillSymbolLayer::SimpleTwoColor;
GradientCoordinateMode coordinateMode = QgsGradientFillSymbolLayer::Feature;
GradientSpread gradientSpread = QgsGradientFillSymbolLayer::Pad;
Qgis::GradientType type = Qgis::GradientType::Linear;
Qgis::GradientColorSource colorType = Qgis::GradientColorSource::SimpleTwoColor;
Qgis::SymbolCoordinateReference coordinateMode = Qgis::SymbolCoordinateReference::Feature;
Qgis::GradientSpread gradientSpread = Qgis::GradientSpread::Pad;
//default to gradient from the default fill color to white
QColor color = DEFAULT_SIMPLEFILL_COLOR, color2 = Qt::white;
QPointF referencePoint1 = QPointF( 0.5, 0 );
@ -556,13 +556,13 @@ QgsSymbolLayer *QgsGradientFillSymbolLayer::create( const QVariantMap &props )
//update gradient properties from props
if ( props.contains( QStringLiteral( "type" ) ) )
type = static_cast< GradientType >( props[QStringLiteral( "type" )].toInt() );
type = static_cast< Qgis::GradientType >( props[QStringLiteral( "type" )].toInt() );
if ( props.contains( QStringLiteral( "coordinate_mode" ) ) )
coordinateMode = static_cast< GradientCoordinateMode >( props[QStringLiteral( "coordinate_mode" )].toInt() );
coordinateMode = static_cast< Qgis::SymbolCoordinateReference >( props[QStringLiteral( "coordinate_mode" )].toInt() );
if ( props.contains( QStringLiteral( "spread" ) ) )
gradientSpread = static_cast< GradientSpread >( props[QStringLiteral( "spread" )].toInt() );
gradientSpread = static_cast< Qgis::GradientSpread >( props[QStringLiteral( "spread" )].toInt() );
if ( props.contains( QStringLiteral( "color_type" ) ) )
colorType = static_cast< GradientColorType >( props[QStringLiteral( "color_type" )].toInt() );
colorType = static_cast< Qgis::GradientColorSource >( props[QStringLiteral( "color_type" )].toInt() );
if ( props.contains( QStringLiteral( "gradient_color" ) ) )
{
//pre 2.5 projects used "gradient_color"
@ -672,7 +672,7 @@ void QgsGradientFillSymbolLayer::applyDataDefinedSymbology( QgsSymbolRenderConte
}
//gradient type
QgsGradientFillSymbolLayer::GradientType gradientType = mGradientType;
Qgis::GradientType gradientType = mGradientType;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyGradientType ) )
{
QString currentType = mDataDefinedProperties.valueAsString( QgsSymbolLayer::PropertyGradientType, context.renderContext().expressionContext(), QString(), &ok );
@ -680,21 +680,21 @@ void QgsGradientFillSymbolLayer::applyDataDefinedSymbology( QgsSymbolRenderConte
{
if ( currentType == QObject::tr( "linear" ) )
{
gradientType = QgsGradientFillSymbolLayer::Linear;
gradientType = Qgis::GradientType::Linear;
}
else if ( currentType == QObject::tr( "radial" ) )
{
gradientType = QgsGradientFillSymbolLayer::Radial;
gradientType = Qgis::GradientType::Radial;
}
else if ( currentType == QObject::tr( "conical" ) )
{
gradientType = QgsGradientFillSymbolLayer::Conical;
gradientType = Qgis::GradientType::Conical;
}
}
}
//coordinate mode
GradientCoordinateMode coordinateMode = mCoordinateMode;
Qgis::SymbolCoordinateReference coordinateMode = mCoordinateMode;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyCoordinateMode ) )
{
QString currentCoordMode = mDataDefinedProperties.valueAsString( QgsSymbolLayer::PropertyCoordinateMode, context.renderContext().expressionContext(), QString(), &ok );
@ -702,17 +702,17 @@ void QgsGradientFillSymbolLayer::applyDataDefinedSymbology( QgsSymbolRenderConte
{
if ( currentCoordMode == QObject::tr( "feature" ) )
{
coordinateMode = QgsGradientFillSymbolLayer::Feature;
coordinateMode = Qgis::SymbolCoordinateReference::Feature;
}
else if ( currentCoordMode == QObject::tr( "viewport" ) )
{
coordinateMode = QgsGradientFillSymbolLayer::Viewport;
coordinateMode = Qgis::SymbolCoordinateReference::Viewport;
}
}
}
//gradient spread
GradientSpread spread = mGradientSpread;
Qgis::GradientSpread spread = mGradientSpread;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyGradientSpread ) )
{
QString currentSpread = mDataDefinedProperties.valueAsString( QgsSymbolLayer::PropertyGradientSpread, context.renderContext().expressionContext(), QString(), &ok );
@ -720,15 +720,15 @@ void QgsGradientFillSymbolLayer::applyDataDefinedSymbology( QgsSymbolRenderConte
{
if ( currentSpread == QObject::tr( "pad" ) )
{
spread = QgsGradientFillSymbolLayer::Pad;
spread = Qgis::GradientSpread::Pad;
}
else if ( currentSpread == QObject::tr( "repeat" ) )
{
spread = QgsGradientFillSymbolLayer::Repeat;
spread = Qgis::GradientSpread::Repeat;
}
else if ( currentSpread == QObject::tr( "reflect" ) )
{
spread = QgsGradientFillSymbolLayer::Reflect;
spread = Qgis::GradientSpread::Reflect;
}
}
}
@ -823,9 +823,9 @@ QPointF QgsGradientFillSymbolLayer::rotateReferencePoint( QPointF refPoint, doub
}
void QgsGradientFillSymbolLayer::applyGradient( const QgsSymbolRenderContext &context, QBrush &brush,
const QColor &color, const QColor &color2, GradientColorType gradientColorType,
QgsColorRamp *gradientRamp, GradientType gradientType,
GradientCoordinateMode coordinateMode, GradientSpread gradientSpread,
const QColor &color, const QColor &color2, Qgis::GradientColorSource gradientColorType,
QgsColorRamp *gradientRamp, Qgis::GradientType gradientType,
Qgis::SymbolCoordinateReference coordinateMode, Qgis::GradientSpread gradientSpread,
QPointF referencePoint1, QPointF referencePoint2, const double angle )
{
//update alpha of gradient colors
@ -842,40 +842,40 @@ void QgsGradientFillSymbolLayer::applyGradient( const QgsSymbolRenderContext &co
QGradient gradient;
switch ( gradientType )
{
case QgsGradientFillSymbolLayer::Linear:
case Qgis::GradientType::Linear:
gradient = QLinearGradient( rotatedReferencePoint1, rotatedReferencePoint2 );
break;
case QgsGradientFillSymbolLayer::Radial:
case Qgis::GradientType::Radial:
gradient = QRadialGradient( rotatedReferencePoint1, QLineF( rotatedReferencePoint1, rotatedReferencePoint2 ).length() );
break;
case QgsGradientFillSymbolLayer::Conical:
case Qgis::GradientType::Conical:
gradient = QConicalGradient( rotatedReferencePoint1, QLineF( rotatedReferencePoint1, rotatedReferencePoint2 ).angle() );
break;
}
switch ( coordinateMode )
{
case QgsGradientFillSymbolLayer::Feature:
case Qgis::SymbolCoordinateReference::Feature:
gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
break;
case QgsGradientFillSymbolLayer::Viewport:
case Qgis::SymbolCoordinateReference::Viewport:
gradient.setCoordinateMode( QGradient::StretchToDeviceMode );
break;
}
switch ( gradientSpread )
{
case QgsGradientFillSymbolLayer::Pad:
case Qgis::GradientSpread::Pad:
gradient.setSpread( QGradient::PadSpread );
break;
case QgsGradientFillSymbolLayer::Reflect:
case Qgis::GradientSpread::Reflect:
gradient.setSpread( QGradient::ReflectSpread );
break;
case QgsGradientFillSymbolLayer::Repeat:
case Qgis::GradientSpread::Repeat:
gradient.setSpread( QGradient::RepeatSpread );
break;
}
//add stops to gradient
if ( gradientColorType == QgsGradientFillSymbolLayer::ColorRamp && gradientRamp &&
if ( gradientColorType == Qgis::GradientColorSource::ColorRamp && gradientRamp &&
( gradientRamp->type() == QgsGradientColorRamp::typeString() || gradientRamp->type() == QgsCptCityColorRamp::typeString() ) )
{
//color ramp gradient
@ -950,10 +950,10 @@ QVariantMap QgsGradientFillSymbolLayer::properties() const
QVariantMap map;
map[QStringLiteral( "color" )] = QgsSymbolLayerUtils::encodeColor( mColor );
map[QStringLiteral( "gradient_color2" )] = QgsSymbolLayerUtils::encodeColor( mColor2 );
map[QStringLiteral( "color_type" )] = QString::number( mGradientColorType );
map[QStringLiteral( "type" )] = QString::number( mGradientType );
map[QStringLiteral( "coordinate_mode" )] = QString::number( mCoordinateMode );
map[QStringLiteral( "spread" )] = QString::number( mGradientSpread );
map[QStringLiteral( "color_type" )] = QString::number( static_cast< int >( mGradientColorType ) );
map[QStringLiteral( "type" )] = QString::number( static_cast<int>( mGradientType ) );
map[QStringLiteral( "coordinate_mode" )] = QString::number( static_cast< int >( mCoordinateMode ) );
map[QStringLiteral( "spread" )] = QString::number( static_cast< int >( mGradientSpread ) );
map[QStringLiteral( "reference_point1" )] = QgsSymbolLayerUtils::encodePoint( mReferencePoint1 );
map[QStringLiteral( "reference_point1_iscentroid" )] = QString::number( mReferencePoint1IsCentroid );
map[QStringLiteral( "reference_point2" )] = QgsSymbolLayerUtils::encodePoint( mReferencePoint2 );
@ -4439,7 +4439,7 @@ void QgsRasterFillSymbolLayer::applyPattern( QBrush &brush, const QString &image
// QgsRandomMarkerFillSymbolLayer
//
QgsRandomMarkerFillSymbolLayer::QgsRandomMarkerFillSymbolLayer( int pointCount, CountMethod method, double densityArea, unsigned long seed )
QgsRandomMarkerFillSymbolLayer::QgsRandomMarkerFillSymbolLayer( int pointCount, Qgis::PointCountMethod method, double densityArea, unsigned long seed )
: mCountMethod( method )
, mPointCount( pointCount )
, mDensityArea( densityArea )
@ -4452,7 +4452,7 @@ QgsRandomMarkerFillSymbolLayer::~QgsRandomMarkerFillSymbolLayer() = default;
QgsSymbolLayer *QgsRandomMarkerFillSymbolLayer::create( const QVariantMap &properties )
{
const CountMethod countMethod = static_cast< CountMethod >( properties.value( QStringLiteral( "count_method" ), QStringLiteral( "0" ) ).toInt() );
const Qgis::PointCountMethod countMethod = static_cast< Qgis::PointCountMethod >( properties.value( QStringLiteral( "count_method" ), QStringLiteral( "0" ) ).toInt() );
const int pointCount = properties.value( QStringLiteral( "point_count" ), QStringLiteral( "10" ) ).toInt();
const double densityArea = properties.value( QStringLiteral( "density_area" ), QStringLiteral( "250.0" ) ).toDouble();
@ -4592,7 +4592,7 @@ void QgsRandomMarkerFillSymbolLayer::render( QgsRenderContext &context, const QV
switch ( mCountMethod )
{
case DensityBasedCount:
case Qgis::PointCountMethod::DensityBased:
{
double densityArea = mDensityArea;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyDensityArea ) )
@ -4605,7 +4605,7 @@ void QgsRandomMarkerFillSymbolLayer::render( QgsRenderContext &context, const QV
count = std::max( 0.0, std::ceil( count * ( geom.area() / densityArea ) ) );
break;
}
case AbsoluteCount:
case Qgis::PointCountMethod::Absolute:
break;
}
@ -4742,12 +4742,12 @@ void QgsRandomMarkerFillSymbolLayer::setClipPoints( bool clipPoints )
mClipPoints = clipPoints;
}
QgsRandomMarkerFillSymbolLayer::CountMethod QgsRandomMarkerFillSymbolLayer::countMethod() const
Qgis::PointCountMethod QgsRandomMarkerFillSymbolLayer::countMethod() const
{
return mCountMethod;
}
void QgsRandomMarkerFillSymbolLayer::setCountMethod( CountMethod method )
void QgsRandomMarkerFillSymbolLayer::setCountMethod( Qgis::PointCountMethod method )
{
mCountMethod = method;
}

View File

@ -212,38 +212,15 @@ class CORE_EXPORT QgsGradientFillSymbolLayer : public QgsFillSymbolLayer
{
public:
enum GradientColorType
{
SimpleTwoColor,
ColorRamp
};
enum GradientType
{
Linear,
Radial,
Conical
};
enum GradientCoordinateMode
{
Feature,
Viewport
};
enum GradientSpread
{
Pad,
Reflect,
Repeat
};
/**
* Constructor for QgsGradientFillSymbolLayer.
*/
QgsGradientFillSymbolLayer( const QColor &color = DEFAULT_SIMPLEFILL_COLOR,
const QColor &color2 = Qt::white,
GradientColorType gradientColorType = SimpleTwoColor,
GradientType gradientType = Linear,
GradientCoordinateMode coordinateMode = Feature,
GradientSpread gradientSpread = Pad
Qgis::GradientColorSource gradientColorType = Qgis::GradientColorSource::SimpleTwoColor,
Qgis::GradientType gradientType = Qgis::GradientType::Linear,
Qgis::SymbolCoordinateReference coordinateMode = Qgis::SymbolCoordinateReference::Feature,
Qgis::GradientSpread gradientSpread = Qgis::GradientSpread::Pad
);
~QgsGradientFillSymbolLayer() override;
@ -268,13 +245,33 @@ class CORE_EXPORT QgsGradientFillSymbolLayer : public QgsFillSymbolLayer
double estimateMaxBleed( const QgsRenderContext &context ) const override;
bool canCauseArtifactsBetweenAdjacentTiles() const override;
//! Type of gradient, e.g., linear or radial
GradientType gradientType() const { return mGradientType; }
void setGradientType( GradientType gradientType ) { mGradientType = gradientType; }
/**
* Returns the type of gradient, e.g., linear or radial.
*
* \see setGradientType()
*/
Qgis::GradientType gradientType() const { return mGradientType; }
//! Gradient color mode, controls how gradient color stops are created
GradientColorType gradientColorType() const { return mGradientColorType; }
void setGradientColorType( GradientColorType gradientColorType ) { mGradientColorType = gradientColorType; }
/**
* Sets the type of gradient, e.g., linear or radial.
*
* \see gradientType()
*/
void setGradientType( Qgis::GradientType gradientType ) { mGradientType = gradientType; }
/**
* Returns the gradient color mode, which controls how gradient color stops are created.
*
* \see setGradientColorType()
*/
Qgis::GradientColorSource gradientColorType() const { return mGradientColorType; }
/**
* Sets the gradient color mode, which controls how gradient color stops are created.
*
* \see gradientColorType()
*/
void setGradientColorType( Qgis::GradientColorSource gradientColorType ) { mGradientColorType = gradientColorType; }
/**
* Returns the color ramp used for the gradient fill. This is only
@ -293,32 +290,103 @@ class CORE_EXPORT QgsGradientFillSymbolLayer : public QgsFillSymbolLayer
*/
void setColorRamp( QgsColorRamp *ramp SIP_TRANSFER );
//! Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor
/**
* Returns the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
*
* \see setColor2()
*/
QColor color2() const { return mColor2; }
/**
* Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
*
* \see color2()
*/
void setColor2( const QColor &color2 ) { mColor2 = color2; }
//! Coordinate mode for gradient. Controls how the gradient stops are positioned.
GradientCoordinateMode coordinateMode() const { return mCoordinateMode; }
void setCoordinateMode( GradientCoordinateMode coordinateMode ) { mCoordinateMode = coordinateMode; }
/**
* Returns the coordinate mode for gradient, which controls how the gradient stops are positioned.
*
* \see setCoordinateMode()
*/
Qgis::SymbolCoordinateReference coordinateMode() const { return mCoordinateMode; }
//! Gradient spread mode. Controls how the gradient behaves outside of the predefined stops
GradientSpread gradientSpread() const { return mGradientSpread; }
void setGradientSpread( GradientSpread gradientSpread ) { mGradientSpread = gradientSpread; }
/**
* Sets the coordinate mode for gradient, which controls how the gradient stops are positioned.
*
* \see coordinateMode()
*/
void setCoordinateMode( Qgis::SymbolCoordinateReference coordinateMode ) { mCoordinateMode = coordinateMode; }
//! Starting point of gradient fill, in the range [0,0] - [1,1]
/**
* Returns the gradient spread mode, which controls how the gradient behaves outside of the predefined stops.
*
* \see setGradientSpread()
*/
Qgis::GradientSpread gradientSpread() const { return mGradientSpread; }
/**
* Sets the gradient spread mode, which controls how the gradient behaves outside of the predefined stops.
*
* \see gradientSpread()
*/
void setGradientSpread( Qgis::GradientSpread gradientSpread ) { mGradientSpread = gradientSpread; }
/**
* Sets the starting point of gradient fill, in the range [0,0] - [1,1].
*
* \see referencePoint1()
*/
void setReferencePoint1( QPointF referencePoint ) { mReferencePoint1 = referencePoint; }
/**
* Returns the starting point of gradient fill, in the range [0,0] - [1,1].
*
* \see setReferencePoint1()
*/
QPointF referencePoint1() const { return mReferencePoint1; }
//! Sets the starting point of the gradient to be the feature centroid
/**
* Sets whether the starting point for the gradient is taken from the feature centroid.
*
* \see referencePoint1IsCentroid()
*/
void setReferencePoint1IsCentroid( bool isCentroid ) { mReferencePoint1IsCentroid = isCentroid; }
/**
* Returns whether the starting point for the gradient is taken from the feature centroid.
*
* \see setReferencePoint1IsCentroid()
*/
bool referencePoint1IsCentroid() const { return mReferencePoint1IsCentroid; }
//! End point of gradient fill, in the range [0,0] - [1,1]
/**
* Sets the end point of gradient fill, in the range [0,0] - [1,1].
*
* \see referencePoint2()
*/
void setReferencePoint2( QPointF referencePoint ) { mReferencePoint2 = referencePoint; }
/**
* Returns the end point of gradient fill, in the range [0,0] - [1,1].
*
* \see setReferencePoint2()
*/
QPointF referencePoint2() const { return mReferencePoint2; }
//! Sets the end point of the gradient to be the feature centroid
/**
* Sets whether the end point for the gradient is taken from the feature centroid.
*
* \see referencePoint2IsCentroid()
*/
void setReferencePoint2IsCentroid( bool isCentroid ) { mReferencePoint2IsCentroid = isCentroid; }
/**
* Returns whether the end point for the gradient is taken from the feature centroid.
*
* \see setReferencePoint2IsCentroid()
*/
bool referencePoint2IsCentroid() const { return mReferencePoint2IsCentroid; }
/**
@ -380,12 +448,12 @@ class CORE_EXPORT QgsGradientFillSymbolLayer : public QgsFillSymbolLayer
QBrush mBrush;
QBrush mSelBrush;
GradientColorType mGradientColorType;
Qgis::GradientColorSource mGradientColorType;
QColor mColor2;
QgsColorRamp *mGradientRamp = nullptr;
GradientType mGradientType;
GradientCoordinateMode mCoordinateMode;
GradientSpread mGradientSpread;
Qgis::GradientType mGradientType;
Qgis::SymbolCoordinateReference mCoordinateMode;
Qgis::GradientSpread mGradientSpread;
QPointF mReferencePoint1;
bool mReferencePoint1IsCentroid = false;
@ -403,8 +471,8 @@ class CORE_EXPORT QgsGradientFillSymbolLayer : public QgsFillSymbolLayer
//! Applies the gradient to a brush
void applyGradient( const QgsSymbolRenderContext &context, QBrush &brush, const QColor &color, const QColor &color2,
GradientColorType gradientColorType, QgsColorRamp *gradientRamp, GradientType gradientType,
GradientCoordinateMode coordinateMode, GradientSpread gradientSpread,
Qgis::GradientColorSource gradientColorType, QgsColorRamp *gradientRamp, Qgis::GradientType gradientType,
Qgis::SymbolCoordinateReference coordinateMode, Qgis::GradientSpread gradientSpread,
QPointF referencePoint1, QPointF referencePoint2, double angle );
//! Rotates a reference point by a specified angle around the point (0.5, 0.5)
@ -1834,20 +1902,13 @@ class CORE_EXPORT QgsRandomMarkerFillSymbolLayer : public QgsFillSymbolLayer
{
public:
//! Methods to define the number of points randomly filling the polygon
enum CountMethod
{
AbsoluteCount, //!< The point count is used as an absolute count of markers
DensityBasedCount, //!< The point count is part of a marker density count
};
/**
* Constructor for QgsRandomMarkerFillSymbolLayer, with the specified \a pointCount.
*
* Optionally a specific random number \a seed can be used when generating points. A \a seed of 0 indicates that
* a truly random sequence will be used on every rendering, causing points to appear in different locations with every map refresh.
*/
QgsRandomMarkerFillSymbolLayer( int pointCount = 10, CountMethod method = AbsoluteCount, double densityArea = 250.0, unsigned long seed = 0 );
QgsRandomMarkerFillSymbolLayer( int pointCount = 10, Qgis::PointCountMethod method = Qgis::PointCountMethod::Absolute, double densityArea = 250.0, unsigned long seed = 0 );
~QgsRandomMarkerFillSymbolLayer() override;
@ -1931,14 +1992,14 @@ class CORE_EXPORT QgsRandomMarkerFillSymbolLayer : public QgsFillSymbolLayer
*
* \see setCountMethod()
*/
CountMethod countMethod() const;
Qgis::PointCountMethod countMethod() const;
/**
* Sets the count \a method used to randomly fill the polygon.
*
* \see countMethod()
*/
void setCountMethod( CountMethod method );
void setCountMethod( Qgis::PointCountMethod method );
/**
* Returns the density area used to count the number of points to randomly fill the polygon.
@ -2007,7 +2068,7 @@ class CORE_EXPORT QgsRandomMarkerFillSymbolLayer : public QgsFillSymbolLayer
void render( QgsRenderContext &context, const QVector< Part > &parts, const QgsFeature &feature, bool selected );
std::unique_ptr< QgsMarkerSymbol > mMarker;
CountMethod mCountMethod = AbsoluteCount;
Qgis::PointCountMethod mCountMethod = Qgis::PointCountMethod::Absolute;
int mPointCount = 10;
double mDensityArea = 250.0;
QgsUnitTypes::RenderUnit mDensityAreaUnit = QgsUnitTypes::RenderMillimeters;

View File

@ -1238,7 +1238,7 @@ void QgsTemplatedLineSymbolLayerBase::renderPolyline( const QPolygonF &points, Q
offset = mDataDefinedProperties.valueAsDouble( QgsSymbolLayer::PropertyOffset, context.renderContext().expressionContext(), mOffset );
}
QgsTemplatedLineSymbolLayerBase::Placement placement = QgsTemplatedLineSymbolLayerBase::placement();
Qgis::MarkerLinePlacement placement = QgsTemplatedLineSymbolLayerBase::placement();
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyPlacement ) )
{
@ -1248,35 +1248,35 @@ void QgsTemplatedLineSymbolLayerBase::renderPolyline( const QPolygonF &points, Q
QString placementString = exprVal.toString();
if ( placementString.compare( QLatin1String( "interval" ), Qt::CaseInsensitive ) == 0 )
{
placement = QgsTemplatedLineSymbolLayerBase::Interval;
placement = Qgis::MarkerLinePlacement::Interval;
}
else if ( placementString.compare( QLatin1String( "vertex" ), Qt::CaseInsensitive ) == 0 )
{
placement = QgsTemplatedLineSymbolLayerBase::Vertex;
placement = Qgis::MarkerLinePlacement::Vertex;
}
else if ( placementString.compare( QLatin1String( "lastvertex" ), Qt::CaseInsensitive ) == 0 )
{
placement = QgsTemplatedLineSymbolLayerBase::LastVertex;
placement = Qgis::MarkerLinePlacement::LastVertex;
}
else if ( placementString.compare( QLatin1String( "firstvertex" ), Qt::CaseInsensitive ) == 0 )
{
placement = QgsTemplatedLineSymbolLayerBase::FirstVertex;
placement = Qgis::MarkerLinePlacement::FirstVertex;
}
else if ( placementString.compare( QLatin1String( "centerpoint" ), Qt::CaseInsensitive ) == 0 )
{
placement = QgsTemplatedLineSymbolLayerBase::CentralPoint;
placement = Qgis::MarkerLinePlacement::CentralPoint;
}
else if ( placementString.compare( QLatin1String( "curvepoint" ), Qt::CaseInsensitive ) == 0 )
{
placement = QgsTemplatedLineSymbolLayerBase::CurvePoint;
placement = Qgis::MarkerLinePlacement::CurvePoint;
}
else if ( placementString.compare( QLatin1String( "segmentcenter" ), Qt::CaseInsensitive ) == 0 )
{
placement = QgsTemplatedLineSymbolLayerBase::SegmentCenter;
placement = Qgis::MarkerLinePlacement::SegmentCenter;
}
else
{
placement = QgsTemplatedLineSymbolLayerBase::Interval;
placement = Qgis::MarkerLinePlacement::Interval;
}
}
}
@ -1295,19 +1295,19 @@ void QgsTemplatedLineSymbolLayerBase::renderPolyline( const QPolygonF &points, Q
{
switch ( placement )
{
case Interval:
case Qgis::MarkerLinePlacement::Interval:
renderPolylineInterval( points, context, averageOver );
break;
case CentralPoint:
case Qgis::MarkerLinePlacement::CentralPoint:
renderPolylineCentral( points, context, averageOver );
break;
case Vertex:
case LastVertex:
case FirstVertex:
case CurvePoint:
case SegmentCenter:
case Qgis::MarkerLinePlacement::Vertex:
case Qgis::MarkerLinePlacement::LastVertex:
case Qgis::MarkerLinePlacement::FirstVertex:
case Qgis::MarkerLinePlacement::CurvePoint:
case Qgis::MarkerLinePlacement::SegmentCenter:
renderPolylineVertex( points, context, placement );
break;
}
@ -1323,19 +1323,19 @@ void QgsTemplatedLineSymbolLayerBase::renderPolyline( const QPolygonF &points, Q
switch ( placement )
{
case Interval:
case Qgis::MarkerLinePlacement::Interval:
renderPolylineInterval( points2, context, averageOver );
break;
case CentralPoint:
case Qgis::MarkerLinePlacement::CentralPoint:
renderPolylineCentral( points2, context, averageOver );
break;
case Vertex:
case LastVertex:
case FirstVertex:
case CurvePoint:
case SegmentCenter:
case Qgis::MarkerLinePlacement::Vertex:
case Qgis::MarkerLinePlacement::LastVertex:
case Qgis::MarkerLinePlacement::FirstVertex:
case Qgis::MarkerLinePlacement::CurvePoint:
case Qgis::MarkerLinePlacement::SegmentCenter:
renderPolylineVertex( points2, context, placement );
break;
}
@ -1451,25 +1451,25 @@ QVariantMap QgsTemplatedLineSymbolLayerBase::properties() const
switch ( mPlacement )
{
case Vertex:
case Qgis::MarkerLinePlacement::Vertex:
map[QStringLiteral( "placement" )] = QStringLiteral( "vertex" );
break;
case LastVertex:
case Qgis::MarkerLinePlacement::LastVertex:
map[QStringLiteral( "placement" )] = QStringLiteral( "lastvertex" );
break;
case FirstVertex:
case Qgis::MarkerLinePlacement::FirstVertex:
map[QStringLiteral( "placement" )] = QStringLiteral( "firstvertex" );
break;
case CentralPoint:
case Qgis::MarkerLinePlacement::CentralPoint:
map[QStringLiteral( "placement" )] = QStringLiteral( "centralpoint" );
break;
case CurvePoint:
case Qgis::MarkerLinePlacement::CurvePoint:
map[QStringLiteral( "placement" )] = QStringLiteral( "curvepoint" );
break;
case Interval:
case Qgis::MarkerLinePlacement::Interval:
map[QStringLiteral( "placement" )] = QStringLiteral( "interval" );
break;
case SegmentCenter:
case Qgis::MarkerLinePlacement::SegmentCenter:
map[QStringLiteral( "placement" )] = QStringLiteral( "segmentcenter" );
break;
}
@ -1482,15 +1482,15 @@ bool QgsTemplatedLineSymbolLayerBase::canCauseArtifactsBetweenAdjacentTiles() co
{
switch ( mPlacement )
{
case QgsTemplatedLineSymbolLayerBase::Interval:
case QgsTemplatedLineSymbolLayerBase::CentralPoint:
case QgsTemplatedLineSymbolLayerBase::SegmentCenter:
case Qgis::MarkerLinePlacement::Interval:
case Qgis::MarkerLinePlacement::CentralPoint:
case Qgis::MarkerLinePlacement::SegmentCenter:
return true;
case QgsTemplatedLineSymbolLayerBase::Vertex:
case QgsTemplatedLineSymbolLayerBase::CurvePoint:
case QgsTemplatedLineSymbolLayerBase::LastVertex:
case QgsTemplatedLineSymbolLayerBase::FirstVertex:
case Qgis::MarkerLinePlacement::Vertex:
case Qgis::MarkerLinePlacement::CurvePoint:
case Qgis::MarkerLinePlacement::LastVertex:
case Qgis::MarkerLinePlacement::FirstVertex:
return false;
}
return false;
@ -1568,19 +1568,19 @@ void QgsTemplatedLineSymbolLayerBase::setCommonProperties( QgsTemplatedLineSymbo
if ( properties.contains( QStringLiteral( "placement" ) ) )
{
if ( properties[QStringLiteral( "placement" )] == QLatin1String( "vertex" ) )
destLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::Vertex );
destLayer->setPlacement( Qgis::MarkerLinePlacement::Vertex );
else if ( properties[QStringLiteral( "placement" )] == QLatin1String( "lastvertex" ) )
destLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::LastVertex );
destLayer->setPlacement( Qgis::MarkerLinePlacement::LastVertex );
else if ( properties[QStringLiteral( "placement" )] == QLatin1String( "firstvertex" ) )
destLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::FirstVertex );
destLayer->setPlacement( Qgis::MarkerLinePlacement::FirstVertex );
else if ( properties[QStringLiteral( "placement" )] == QLatin1String( "centralpoint" ) )
destLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::CentralPoint );
destLayer->setPlacement( Qgis::MarkerLinePlacement::CentralPoint );
else if ( properties[QStringLiteral( "placement" )] == QLatin1String( "curvepoint" ) )
destLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::CurvePoint );
destLayer->setPlacement( Qgis::MarkerLinePlacement::CurvePoint );
else if ( properties[QStringLiteral( "placement" )] == QLatin1String( "segmentcenter" ) )
destLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::SegmentCenter );
destLayer->setPlacement( Qgis::MarkerLinePlacement::SegmentCenter );
else
destLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::Interval );
destLayer->setPlacement( Qgis::MarkerLinePlacement::Interval );
}
if ( properties.contains( QStringLiteral( "ring_filter" ) ) )
@ -1758,7 +1758,7 @@ static double _averageAngle( QPointF prevPt, QPointF pt, QPointF nextPt )
return std::atan2( unitY, unitX );
}
void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, QgsTemplatedLineSymbolLayerBase::Placement placement )
void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement )
{
if ( points.isEmpty() )
return;
@ -1785,7 +1785,7 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
}
if ( qgsDoubleNear( offsetAlongLine, 0.0 ) && context.renderContext().geometry()
&& context.renderContext().geometry()->hasCurvedSegments() && ( placement == QgsTemplatedLineSymbolLayerBase::Vertex || placement == QgsTemplatedLineSymbolLayerBase::CurvePoint ) )
&& context.renderContext().geometry()->hasCurvedSegments() && ( placement == Qgis::MarkerLinePlacement::Vertex || placement == Qgis::MarkerLinePlacement::CurvePoint ) )
{
QgsCoordinateTransform ct = context.renderContext().coordinateTransform();
const QgsMapToPixel &mtp = context.renderContext().mapToPixel();
@ -1802,8 +1802,8 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
scope->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM, ++pointNum, true ) );
if ( ( placement == QgsTemplatedLineSymbolLayerBase::Vertex && vId.type == Qgis::VertexType::Segment )
|| ( placement == QgsTemplatedLineSymbolLayerBase::CurvePoint && vId.type == Qgis::VertexType::Curve ) )
if ( ( placement == Qgis::MarkerLinePlacement::Vertex && vId.type == Qgis::VertexType::Segment )
|| ( placement == Qgis::MarkerLinePlacement::CurvePoint && vId.type == Qgis::VertexType::Curve ) )
{
//transform
x = vPoint.x();
@ -1830,42 +1830,42 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
switch ( placement )
{
case FirstVertex:
case Qgis::MarkerLinePlacement::FirstVertex:
{
i = 0;
maxCount = 1;
break;
}
case LastVertex:
case Qgis::MarkerLinePlacement::LastVertex:
{
i = points.count() - 1;
maxCount = points.count();
break;
}
case Vertex:
case SegmentCenter:
case Qgis::MarkerLinePlacement::Vertex:
case Qgis::MarkerLinePlacement::SegmentCenter:
{
i = placement == Vertex ? 0 : 1;
i = placement == Qgis::MarkerLinePlacement::Vertex ? 0 : 1;
maxCount = points.count();
if ( points.first() == points.last() )
isRing = true;
break;
}
case Interval:
case CentralPoint:
case CurvePoint:
case Qgis::MarkerLinePlacement::Interval:
case Qgis::MarkerLinePlacement::CentralPoint:
case Qgis::MarkerLinePlacement::CurvePoint:
{
return;
}
}
if ( offsetAlongLine > 0 && ( placement == QgsTemplatedLineSymbolLayerBase::FirstVertex || placement == QgsTemplatedLineSymbolLayerBase::LastVertex ) )
if ( offsetAlongLine > 0 && ( placement == Qgis::MarkerLinePlacement::FirstVertex || placement == Qgis::MarkerLinePlacement::LastVertex ) )
{
double distance;
distance = placement == QgsTemplatedLineSymbolLayerBase::FirstVertex ? offsetAlongLine : -offsetAlongLine;
distance = placement == Qgis::MarkerLinePlacement::FirstVertex ? offsetAlongLine : -offsetAlongLine;
renderOffsetVertexAlongLine( points, i, distance, context );
return;
@ -1873,7 +1873,7 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
int pointNum = 0;
QPointF prevPoint;
if ( placement == SegmentCenter && !points.empty() )
if ( placement == Qgis::MarkerLinePlacement::SegmentCenter && !points.empty() )
prevPoint = points.at( 0 );
QPointF symbolPoint;
@ -1881,12 +1881,12 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineVertex( const QPolygonF &poi
{
scope->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_GEOMETRY_POINT_NUM, ++pointNum, true ) );
if ( isRing && placement == QgsTemplatedLineSymbolLayerBase::Vertex && i == points.count() - 1 )
if ( isRing && placement == Qgis::MarkerLinePlacement::Vertex && i == points.count() - 1 )
{
continue; // don't draw the last marker - it has been drawn already
}
if ( placement == SegmentCenter )
if ( placement == Qgis::MarkerLinePlacement::SegmentCenter )
{
QPointF currentPoint = points.at( i );
symbolPoint = QPointF( 0.5 * ( currentPoint.x() + prevPoint.x() ),
@ -2332,16 +2332,16 @@ void QgsMarkerLineSymbolLayer::toSld( QDomDocument &doc, QDomElement &element, c
QString gap;
switch ( placement() )
{
case QgsTemplatedLineSymbolLayerBase::FirstVertex:
case Qgis::MarkerLinePlacement::FirstVertex:
symbolizerElem.appendChild( QgsSymbolLayerUtils::createVendorOptionElement( doc, QStringLiteral( "placement" ), QStringLiteral( "firstPoint" ) ) );
break;
case QgsTemplatedLineSymbolLayerBase::LastVertex:
case Qgis::MarkerLinePlacement::LastVertex:
symbolizerElem.appendChild( QgsSymbolLayerUtils::createVendorOptionElement( doc, QStringLiteral( "placement" ), QStringLiteral( "lastPoint" ) ) );
break;
case QgsTemplatedLineSymbolLayerBase::CentralPoint:
case Qgis::MarkerLinePlacement::CentralPoint:
symbolizerElem.appendChild( QgsSymbolLayerUtils::createVendorOptionElement( doc, QStringLiteral( "placement" ), QStringLiteral( "centralPoint" ) ) );
break;
case QgsTemplatedLineSymbolLayerBase::Vertex:
case Qgis::MarkerLinePlacement::Vertex:
// no way to get line/polygon's vertices, use a VendorOption
symbolizerElem.appendChild( QgsSymbolLayerUtils::createVendorOptionElement( doc, QStringLiteral( "placement" ), QStringLiteral( "points" ) ) );
break;
@ -2411,7 +2411,7 @@ QgsSymbolLayer *QgsMarkerLineSymbolLayer::createFromSld( QDomElement &element )
// retrieve vendor options
bool rotateMarker = true;
QgsTemplatedLineSymbolLayerBase::Placement placement = QgsTemplatedLineSymbolLayerBase::Interval;
Qgis::MarkerLinePlacement placement = Qgis::MarkerLinePlacement::Interval;
QgsStringMap vendorOptions = QgsSymbolLayerUtils::getVendorOptionList( element );
for ( QgsStringMap::iterator it = vendorOptions.begin(); it != vendorOptions.end(); ++it )
@ -2419,13 +2419,13 @@ QgsSymbolLayer *QgsMarkerLineSymbolLayer::createFromSld( QDomElement &element )
if ( it.key() == QLatin1String( "placement" ) )
{
if ( it.value() == QLatin1String( "points" ) )
placement = QgsTemplatedLineSymbolLayerBase::Vertex;
placement = Qgis::MarkerLinePlacement::Vertex;
else if ( it.value() == QLatin1String( "firstPoint" ) )
placement = QgsTemplatedLineSymbolLayerBase::FirstVertex;
placement = Qgis::MarkerLinePlacement::FirstVertex;
else if ( it.value() == QLatin1String( "lastPoint" ) )
placement = QgsTemplatedLineSymbolLayerBase::LastVertex;
placement = Qgis::MarkerLinePlacement::LastVertex;
else if ( it.value() == QLatin1String( "centralPoint" ) )
placement = QgsTemplatedLineSymbolLayerBase::CentralPoint;
placement = Qgis::MarkerLinePlacement::CentralPoint;
}
else if ( it.value() == QLatin1String( "rotateMarker" ) )
{

View File

@ -551,20 +551,6 @@ class CORE_EXPORT QgsTemplatedLineSymbolLayerBase : public QgsLineSymbolLayer
{
public:
/**
* Defines how/where the templated symbol should be placed on the line.
*/
enum Placement
{
Interval, //!< Place symbols at regular intervals
Vertex, //!< Place symbols on every vertex in the line
LastVertex, //!< Place symbols on the last vertex in the line
FirstVertex, //!< Place symbols on the first vertex in the line
CentralPoint, //!< Place symbols at the mid point of the line
CurvePoint, //!< Place symbols at every virtual curve point in the line (used when rendering curved geometry types only)
SegmentCenter, //!< Place symbols at the center of every line segment
};
/**
* Constructor for QgsTemplatedLineSymbolLayerBase. Creates a template
* line placed at the specified \a interval (in millimeters).
@ -639,13 +625,13 @@ class CORE_EXPORT QgsTemplatedLineSymbolLayerBase : public QgsLineSymbolLayer
* Returns the placement of the symbols.
* \see setPlacement()
*/
Placement placement() const { return mPlacement; }
Qgis::MarkerLinePlacement placement() const { return mPlacement; }
/**
* Sets the \a placement of the symbols.
* \see placement()
*/
void setPlacement( Placement placement ) { mPlacement = placement; }
void setPlacement( Qgis::MarkerLinePlacement placement ) { mPlacement = placement; }
/**
* Returns the offset along the line for the symbol placement. For Interval placements, this is the distance
@ -820,7 +806,7 @@ class CORE_EXPORT QgsTemplatedLineSymbolLayerBase : public QgsLineSymbolLayer
private:
void renderPolylineInterval( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, QgsTemplatedLineSymbolLayerBase::Placement placement = QgsTemplatedLineSymbolLayerBase::Vertex );
void renderPolylineVertex( const QPolygonF &points, QgsSymbolRenderContext &context, Qgis::MarkerLinePlacement placement = Qgis::MarkerLinePlacement::Vertex );
void renderPolylineCentral( const QPolygonF &points, QgsSymbolRenderContext &context, double averageAngleOver );
double markerAngle( const QPolygonF &points, bool isRing, int vertex );
@ -846,7 +832,7 @@ class CORE_EXPORT QgsTemplatedLineSymbolLayerBase : public QgsLineSymbolLayer
double mInterval = 3;
QgsUnitTypes::RenderUnit mIntervalUnit = QgsUnitTypes::RenderMillimeters;
QgsMapUnitScale mIntervalMapUnitScale;
Placement mPlacement = Interval;
Qgis::MarkerLinePlacement mPlacement = Qgis::MarkerLinePlacement::Interval;
double mOffsetAlongLine = 0; //distance to offset along line before marker is drawn
QgsUnitTypes::RenderUnit mOffsetAlongLineUnit = QgsUnitTypes::RenderMillimeters; //unit for offset along line
QgsMapUnitScale mOffsetAlongLineMapUnitScale;

View File

@ -560,43 +560,43 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
double markerSize = 1;
double angle = 0;
double lineOffset = 0;
QgsMarkerLineSymbolLayer::Placement placement = QgsMarkerLineSymbolLayer::Interval;
QgsSimpleMarkerSymbolLayerBase::Shape shape = QgsSimpleMarkerSymbolLayerBase::Circle;
Qgis::MarkerLinePlacement placement = Qgis::MarkerLinePlacement::Interval;
Qgis::MarkerShape shape = Qgis::MarkerShape::Circle;
switch ( identifier )
{
case 38:
spacing = 35;
offset = 25;
markerSize = 3;
shape = QgsSimpleMarkerSymbolLayer::Cross2;
shape = Qgis::MarkerShape::Cross2;
break;
case 39:
spacing = 35;
offset = 27.5;
markerSize = 3;
shape = QgsSimpleMarkerSymbolLayer::Cross2;
shape = Qgis::MarkerShape::Cross2;
break;
case 40:
spacing = 35;
offset = 27.5;
markerSize = 3.2;
shape = QgsSimpleMarkerSymbolLayer::Cross;
shape = Qgis::MarkerShape::Cross;
break;
case 54:
spacing = 12;
offset = 4;
markerSize = 6;
shape = QgsSimpleMarkerSymbolLayer::ArrowHead;
shape = Qgis::MarkerShape::ArrowHead;
break;
case 55:
spacing = 12;
offset = 0;
markerSize = 6;
shape = QgsSimpleMarkerSymbolLayer::ArrowHead;
shape = Qgis::MarkerShape::ArrowHead;
angle = 180;
break;
@ -604,7 +604,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 31;
offset = 4;
markerSize = 6;
shape = QgsSimpleMarkerSymbolLayer::ArrowHead;
shape = Qgis::MarkerShape::ArrowHead;
angle = 180;
break;
@ -612,14 +612,14 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 10;
offset = 4;
markerSize = 6;
shape = QgsSimpleMarkerSymbolLayer::ArrowHead;
shape = Qgis::MarkerShape::ArrowHead;
break;
case 58:
spacing = 10;
offset = 0;
markerSize = 6;
shape = QgsSimpleMarkerSymbolLayer::ArrowHead;
shape = Qgis::MarkerShape::ArrowHead;
angle = 180;
break;
@ -627,15 +627,15 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
case 61:
offset = 0;
markerSize = 6;
shape = QgsSimpleMarkerSymbolLayer::ArrowHead;
placement = QgsMarkerLineSymbolLayer::LastVertex;
shape = Qgis::MarkerShape::ArrowHead;
placement = Qgis::MarkerLinePlacement::LastVertex;
break;
case 60:
offset = 0;
markerSize = 6;
shape = QgsSimpleMarkerSymbolLayer::ArrowHead;
placement = QgsMarkerLineSymbolLayer::FirstVertex;
shape = Qgis::MarkerShape::ArrowHead;
placement = Qgis::MarkerLinePlacement::FirstVertex;
angle = 180;
break;
@ -643,16 +643,16 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
case 80:
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Octagon;
placement = QgsMarkerLineSymbolLayer::FirstVertex;
shape = Qgis::MarkerShape::Octagon;
placement = Qgis::MarkerLinePlacement::FirstVertex;
angle = 0;
break;
case 79:
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Octagon;
placement = QgsMarkerLineSymbolLayer::LastVertex;
shape = Qgis::MarkerShape::Octagon;
placement = Qgis::MarkerLinePlacement::LastVertex;
angle = 0;
break;
@ -664,8 +664,8 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 9;
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Octagon;
placement = QgsMarkerLineSymbolLayer::Interval;
shape = Qgis::MarkerShape::Octagon;
placement = Qgis::MarkerLinePlacement::Interval;
angle = 0;
break;
@ -673,16 +673,16 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
case 88:
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Square;
placement = QgsMarkerLineSymbolLayer::FirstVertex;
shape = Qgis::MarkerShape::Square;
placement = Qgis::MarkerLinePlacement::FirstVertex;
angle = 0;
break;
case 87:
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Square;
placement = QgsMarkerLineSymbolLayer::LastVertex;
shape = Qgis::MarkerShape::Square;
placement = Qgis::MarkerLinePlacement::LastVertex;
angle = 0;
break;
@ -694,8 +694,8 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 9;
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Square;
placement = QgsMarkerLineSymbolLayer::Interval;
shape = Qgis::MarkerShape::Square;
placement = Qgis::MarkerLinePlacement::Interval;
angle = 0;
break;
@ -703,16 +703,16 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
case 96:
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::EquilateralTriangle;
placement = QgsMarkerLineSymbolLayer::FirstVertex;
shape = Qgis::MarkerShape::EquilateralTriangle;
placement = Qgis::MarkerLinePlacement::FirstVertex;
angle = 0;
break;
case 95:
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::EquilateralTriangle;
placement = QgsMarkerLineSymbolLayer::LastVertex;
shape = Qgis::MarkerShape::EquilateralTriangle;
placement = Qgis::MarkerLinePlacement::LastVertex;
angle = 180;
break;
@ -724,8 +724,8 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 9;
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Diamond;
placement = QgsMarkerLineSymbolLayer::Interval;
shape = Qgis::MarkerShape::Diamond;
placement = Qgis::MarkerLinePlacement::Interval;
angle = 0;
break;
@ -733,16 +733,16 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
case 104:
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Diamond;
placement = QgsMarkerLineSymbolLayer::FirstVertex;
shape = Qgis::MarkerShape::Diamond;
placement = Qgis::MarkerLinePlacement::FirstVertex;
angle = 0;
break;
case 103:
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Diamond;
placement = QgsMarkerLineSymbolLayer::LastVertex;
shape = Qgis::MarkerShape::Diamond;
placement = Qgis::MarkerLinePlacement::LastVertex;
angle = 180;
break;
@ -754,8 +754,8 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 9;
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Diamond;
placement = QgsMarkerLineSymbolLayer::Interval;
shape = Qgis::MarkerShape::Diamond;
placement = Qgis::MarkerLinePlacement::Interval;
angle = 0;
break;
@ -763,8 +763,8 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 18;
offset = 9;
markerSize = 8;
shape = QgsSimpleMarkerSymbolLayer::SemiCircle;
placement = QgsMarkerLineSymbolLayer::Interval;
shape = Qgis::MarkerShape::SemiCircle;
placement = Qgis::MarkerLinePlacement::Interval;
angle = 0;
lineOffset = -0.8;
break;
@ -773,8 +773,8 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 16;
offset = 8;
markerSize = 8;
shape = QgsSimpleMarkerSymbolLayer::EquilateralTriangle;
placement = QgsMarkerLineSymbolLayer::Interval;
shape = Qgis::MarkerShape::EquilateralTriangle;
placement = Qgis::MarkerLinePlacement::Interval;
angle = 0;
lineOffset = -2;
break;
@ -783,8 +783,8 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 23;
offset = 8;
markerSize = 8;
shape = QgsSimpleMarkerSymbolLayer::SemiCircle;
placement = QgsMarkerLineSymbolLayer::Interval;
shape = Qgis::MarkerShape::SemiCircle;
placement = Qgis::MarkerLinePlacement::Interval;
angle = 0;
lineOffset = -0.8;
break;
@ -793,8 +793,8 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
spacing = 9;
offset = 2;
markerSize = 4;
shape = QgsSimpleMarkerSymbolLayer::Square;
placement = QgsMarkerLineSymbolLayer::Interval;
shape = Qgis::MarkerShape::Square;
placement = Qgis::MarkerLinePlacement::Interval;
angle = 0;
lineOffset = -2;
break;
@ -847,11 +847,11 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
subSimpleMarker->setPenJoinStyle( Qt::RoundJoin );
subSimpleMarker->setPenCapStyle( Qt::RoundCap );
if ( shape == QgsSimpleMarkerSymbolLayer::Octagon
|| shape == QgsSimpleMarkerSymbolLayer::Square
|| shape == QgsSimpleMarkerSymbolLayer::EquilateralTriangle
|| shape == QgsSimpleMarkerSymbolLayer::Diamond
|| shape == QgsSimpleMarkerSymbolLayer::SemiCircle )
if ( shape == Qgis::MarkerShape::Octagon
|| shape == Qgis::MarkerShape::Square
|| shape == Qgis::MarkerShape::EquilateralTriangle
|| shape == Qgis::MarkerShape::Diamond
|| shape == Qgis::MarkerShape::SemiCircle )
{
subSimpleMarker->setStrokeStyle( Qt::NoPen );
}
@ -869,14 +869,14 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
else if ( identifier == 61 )
{
std::unique_ptr< QgsMarkerLineSymbolLayer > marker2( marker->clone() );
marker2->setPlacement( QgsMarkerLineSymbolLayer::FirstVertex );
marker2->setPlacement( Qgis::MarkerLinePlacement::FirstVertex );
qgis::down_cast< QgsMarkerSymbol * >( marker2->subSymbol() )->setAngle( 180 );
symbol->appendSymbolLayer( marker2.release() );
}
else if ( identifier == 80 || identifier == 88 || identifier == 96 || identifier == 104 )
{
std::unique_ptr< QgsMarkerLineSymbolLayer > marker2( marker->clone() );
marker2->setPlacement( QgsMarkerLineSymbolLayer::LastVertex );
marker2->setPlacement( Qgis::MarkerLinePlacement::LastVertex );
qgis::down_cast< QgsMarkerSymbol * >( marker2->subSymbol() )->setAngle( 180 );
symbol->appendSymbolLayer( marker2.release() );
}
@ -885,7 +885,7 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
{
std::unique_ptr< QgsMarkerLineSymbolLayer > marker2( marker->clone() );
qgis::down_cast< QgsSimpleMarkerSymbolLayer * >( marker2->subSymbol()->symbolLayer( 0 ) )->setShape( QgsSimpleMarkerSymbolLayer::EquilateralTriangle );
qgis::down_cast< QgsSimpleMarkerSymbolLayer * >( marker2->subSymbol()->symbolLayer( 0 ) )->setShape( Qgis::MarkerShape::EquilateralTriangle );
marker2->setOffsetAlongLine( 16 * size );
marker2->setOffset( -1.5 * size );
symbol->appendSymbolLayer( marker2.release() );
@ -951,11 +951,11 @@ QgsLineSymbol *QgsMapInfoSymbolConverter::convertLineSymbol( int identifier, Qgs
else if ( identifier == 62 )
{
std::unique_ptr< QgsMarkerLineSymbolLayer > markerLine = std::make_unique< QgsMarkerLineSymbolLayer >();
markerLine->setPlacement( QgsMarkerLineSymbolLayer::FirstVertex );
markerLine->setPlacement( Qgis::MarkerLinePlacement::FirstVertex );
markerLine->setOffsetAlongLine( 2 * size );
markerLine->setOffsetAlongLineUnit( sizeUnit );
std::unique_ptr< QgsSimpleMarkerSymbolLayer > subSimpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( QgsSimpleMarkerSymbolLayer::Line, size * 4 );
std::unique_ptr< QgsSimpleMarkerSymbolLayer > subSimpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( Qgis::MarkerShape::Line, size * 4 );
subSimpleMarker->setColor( foreColor );
subSimpleMarker->setSizeUnit( sizeUnit );
subSimpleMarker->setStrokeWidth( 1.25 * size );
@ -1393,7 +1393,7 @@ QgsFillSymbol *QgsMapInfoSymbolConverter::convertFillSymbol( int identifier, Qgs
QgsMarkerSymbol *QgsMapInfoSymbolConverter::convertMarkerSymbol( int identifier, QgsMapInfoSymbolConversionContext &context, const QColor &color, double size, QgsUnitTypes::RenderUnit sizeUnit )
{
QgsSimpleMarkerSymbolLayerBase::Shape shape;
Qgis::MarkerShape shape;
bool isFilled = true;
bool isNull = false;
bool hasShadow = false;
@ -1404,108 +1404,108 @@ QgsMarkerSymbol *QgsMapInfoSymbolConverter::convertMarkerSymbol( int identifier,
{
case 31:
// null symbol
shape = QgsSimpleMarkerSymbolLayer::Shape::Square; // to initialize the variable
shape = Qgis::MarkerShape::Square; // to initialize the variable
isNull = true;
break;
case 32:
shape = QgsSimpleMarkerSymbolLayer::Shape::Square;
shape = Qgis::MarkerShape::Square;
break;
case 33:
shape = QgsSimpleMarkerSymbolLayer::Shape::Diamond;
shape = Qgis::MarkerShape::Diamond;
break;
case 34:
shape = QgsSimpleMarkerSymbolLayer::Shape::Circle;
shape = Qgis::MarkerShape::Circle;
break;
case 35:
shape = QgsSimpleMarkerSymbolLayer::Shape::Star;
shape = Qgis::MarkerShape::Star;
break;
case 36:
shape = QgsSimpleMarkerSymbolLayer::Shape::Triangle;
shape = Qgis::MarkerShape::Triangle;
break;
case 37:
shape = QgsSimpleMarkerSymbolLayer::Shape::Triangle;
shape = Qgis::MarkerShape::Triangle;
angle = 180;
break;
case 38:
shape = QgsSimpleMarkerSymbolLayer::Shape::Square;
shape = Qgis::MarkerShape::Square;
isFilled = false;
break;
case 39:
shape = QgsSimpleMarkerSymbolLayer::Shape::Diamond;
shape = Qgis::MarkerShape::Diamond;
isFilled = false;
break;
case 40:
shape = QgsSimpleMarkerSymbolLayer::Shape::Circle;
shape = Qgis::MarkerShape::Circle;
isFilled = false;
break;
case 41:
shape = QgsSimpleMarkerSymbolLayer::Shape::Star;
shape = Qgis::MarkerShape::Star;
isFilled = false;
break;
case 42:
shape = QgsSimpleMarkerSymbolLayer::Shape::Triangle;
shape = Qgis::MarkerShape::Triangle;
isFilled = false;
break;
case 43:
shape = QgsSimpleMarkerSymbolLayer::Shape::Triangle;
shape = Qgis::MarkerShape::Triangle;
angle = 180;
isFilled = false;
break;
case 44:
shape = QgsSimpleMarkerSymbolLayer::Shape::Square;
shape = Qgis::MarkerShape::Square;
hasShadow = true;
shadowOffset = QPointF( size * 0.1, size * 0.1 );
break;
case 45:
shape = QgsSimpleMarkerSymbolLayer::Shape::Triangle;
shape = Qgis::MarkerShape::Triangle;
shadowOffset = QPointF( size * 0.2, size * 0.1 );
hasShadow = true;
break;
case 46:
shape = QgsSimpleMarkerSymbolLayer::Shape::Circle;
shape = Qgis::MarkerShape::Circle;
shadowOffset = QPointF( size * 0.1, size * 0.1 );
hasShadow = true;
break;
case 47:
shape = QgsSimpleMarkerSymbolLayer::Shape::Arrow;
shape = Qgis::MarkerShape::Arrow;
size *= 0.66666;
angle = 45;
vertAlign = QgsMarkerSymbolLayer::Top;
break;
case 48:
shape = QgsSimpleMarkerSymbolLayer::Shape::Arrow;
shape = Qgis::MarkerShape::Arrow;
size *= 0.66666;
angle = 225;
vertAlign = QgsMarkerSymbolLayer::Top;
break;
case 49:
shape = QgsSimpleMarkerSymbolLayer::Shape::Cross;
shape = Qgis::MarkerShape::Cross;
break;
case 50:
shape = QgsSimpleMarkerSymbolLayer::Shape::Cross2;
shape = Qgis::MarkerShape::Cross2;
break;
case 51:
shape = QgsSimpleMarkerSymbolLayer::Shape::Cross;
shape = Qgis::MarkerShape::Cross;
break;
default:
@ -1552,7 +1552,7 @@ QgsMarkerSymbol *QgsMapInfoSymbolConverter::convertMarkerSymbol( int identifier,
if ( identifier == 51 )
{
std::unique_ptr< QgsSimpleMarkerSymbolLayer > second( simpleMarker->clone() );
second->setShape( QgsSimpleMarkerSymbolLayer::Shape::Cross2 );
second->setShape( Qgis::MarkerShape::Cross2 );
symbols << second.release();
}
symbols << simpleMarker.release();

View File

@ -61,43 +61,43 @@ static void _fixQPictureDPI( QPainter *p )
// QgsSimpleMarkerSymbolLayerBase
//
QList<QgsSimpleMarkerSymbolLayerBase::Shape> QgsSimpleMarkerSymbolLayerBase::availableShapes()
QList<Qgis::MarkerShape> QgsSimpleMarkerSymbolLayerBase::availableShapes()
{
QList< Shape > shapes;
shapes << Square
<< Diamond
<< Pentagon
<< Hexagon
<< Octagon
<< SquareWithCorners
<< Triangle
<< EquilateralTriangle
<< Star
<< Arrow
<< Circle
<< Cross
<< CrossFill
<< Cross2
<< Line
<< HalfArc
<< ThirdArc
<< QuarterArc
<< ArrowHead
<< ArrowHeadFilled
<< SemiCircle
<< ThirdCircle
<< QuarterCircle
<< QuarterSquare
<< HalfSquare
<< DiagonalHalfSquare
<< RightHalfTriangle
<< LeftHalfTriangle
<< AsteriskFill;
QList< Qgis::MarkerShape > shapes;
shapes << Qgis::MarkerShape::Square
<< Qgis::MarkerShape::Diamond
<< Qgis::MarkerShape::Pentagon
<< Qgis::MarkerShape::Hexagon
<< Qgis::MarkerShape::Octagon
<< Qgis::MarkerShape::SquareWithCorners
<< Qgis::MarkerShape::Triangle
<< Qgis::MarkerShape::EquilateralTriangle
<< Qgis::MarkerShape::Star
<< Qgis::MarkerShape::Arrow
<< Qgis::MarkerShape::Circle
<< Qgis::MarkerShape::Cross
<< Qgis::MarkerShape::CrossFill
<< Qgis::MarkerShape::Cross2
<< Qgis::MarkerShape::Line
<< Qgis::MarkerShape::HalfArc
<< Qgis::MarkerShape::ThirdArc
<< Qgis::MarkerShape::QuarterArc
<< Qgis::MarkerShape::ArrowHead
<< Qgis::MarkerShape::ArrowHeadFilled
<< Qgis::MarkerShape::SemiCircle
<< Qgis::MarkerShape::ThirdCircle
<< Qgis::MarkerShape::QuarterCircle
<< Qgis::MarkerShape::QuarterSquare
<< Qgis::MarkerShape::HalfSquare
<< Qgis::MarkerShape::DiagonalHalfSquare
<< Qgis::MarkerShape::RightHalfTriangle
<< Qgis::MarkerShape::LeftHalfTriangle
<< Qgis::MarkerShape::AsteriskFill;
return shapes;
}
QgsSimpleMarkerSymbolLayerBase::QgsSimpleMarkerSymbolLayerBase( QgsSimpleMarkerSymbolLayerBase::Shape shape, double size, double angle, Qgis::ScaleMethod scaleMethod )
QgsSimpleMarkerSymbolLayerBase::QgsSimpleMarkerSymbolLayerBase( Qgis::MarkerShape shape, double size, double angle, Qgis::ScaleMethod scaleMethod )
: mShape( shape )
{
mSize = size;
@ -110,41 +110,41 @@ QgsSimpleMarkerSymbolLayerBase::QgsSimpleMarkerSymbolLayerBase( QgsSimpleMarkerS
QgsSimpleMarkerSymbolLayerBase::~QgsSimpleMarkerSymbolLayerBase() = default;
bool QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( QgsSimpleMarkerSymbolLayerBase::Shape shape )
bool QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( Qgis::MarkerShape shape )
{
switch ( shape )
{
case Square:
case Diamond:
case Pentagon:
case Hexagon:
case Octagon:
case SquareWithCorners:
case Triangle:
case EquilateralTriangle:
case Star:
case Arrow:
case Circle:
case CrossFill:
case ArrowHeadFilled:
case SemiCircle:
case ThirdCircle:
case QuarterCircle:
case QuarterSquare:
case HalfSquare:
case DiagonalHalfSquare:
case RightHalfTriangle:
case LeftHalfTriangle:
case AsteriskFill:
case Qgis::MarkerShape::Square:
case Qgis::MarkerShape::Diamond:
case Qgis::MarkerShape::Pentagon:
case Qgis::MarkerShape::Hexagon:
case Qgis::MarkerShape::Octagon:
case Qgis::MarkerShape::SquareWithCorners:
case Qgis::MarkerShape::Triangle:
case Qgis::MarkerShape::EquilateralTriangle:
case Qgis::MarkerShape::Star:
case Qgis::MarkerShape::Arrow:
case Qgis::MarkerShape::Circle:
case Qgis::MarkerShape::CrossFill:
case Qgis::MarkerShape::ArrowHeadFilled:
case Qgis::MarkerShape::SemiCircle:
case Qgis::MarkerShape::ThirdCircle:
case Qgis::MarkerShape::QuarterCircle:
case Qgis::MarkerShape::QuarterSquare:
case Qgis::MarkerShape::HalfSquare:
case Qgis::MarkerShape::DiagonalHalfSquare:
case Qgis::MarkerShape::RightHalfTriangle:
case Qgis::MarkerShape::LeftHalfTriangle:
case Qgis::MarkerShape::AsteriskFill:
return true;
case Cross:
case Cross2:
case Line:
case ArrowHead:
case HalfArc:
case ThirdArc:
case QuarterArc:
case Qgis::MarkerShape::Cross:
case Qgis::MarkerShape::Cross2:
case Qgis::MarkerShape::Line:
case Qgis::MarkerShape::ArrowHead:
case Qgis::MarkerShape::HalfArc:
case Qgis::MarkerShape::ThirdArc:
case Qgis::MarkerShape::QuarterArc:
return false;
}
return true;
@ -220,14 +220,14 @@ void QgsSimpleMarkerSymbolLayerBase::renderPoint( QPointF point, QgsSymbolRender
//data defined shape?
bool createdNewPath = false;
bool ok = true;
Shape symbol = mShape;
Qgis::MarkerShape symbol = mShape;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyName ) )
{
context.setOriginalValueVariable( encodeShape( symbol ) );
const QVariant exprVal = mDataDefinedProperties.value( QgsSymbolLayer::PropertyName, context.renderContext().expressionContext() );
if ( !exprVal.isNull() )
{
const Shape decoded = decodeShape( exprVal.toString(), &ok );
const Qgis::MarkerShape decoded = decodeShape( exprVal.toString(), &ok );
if ( ok )
{
symbol = decoded;
@ -310,158 +310,158 @@ QRectF QgsSimpleMarkerSymbolLayerBase::bounds( QPointF point, QgsSymbolRenderCon
scaledSize ) );
}
QgsSimpleMarkerSymbolLayerBase::Shape QgsSimpleMarkerSymbolLayerBase::decodeShape( const QString &name, bool *ok )
Qgis::MarkerShape QgsSimpleMarkerSymbolLayerBase::decodeShape( const QString &name, bool *ok )
{
if ( ok )
*ok = true;
const QString cleaned = name.toLower().trimmed();
if ( cleaned == QLatin1String( "square" ) || cleaned == QLatin1String( "rectangle" ) )
return Square;
return Qgis::MarkerShape::Square;
else if ( cleaned == QLatin1String( "square_with_corners" ) )
return SquareWithCorners;
return Qgis::MarkerShape::SquareWithCorners;
else if ( cleaned == QLatin1String( "diamond" ) )
return Diamond;
return Qgis::MarkerShape::Diamond;
else if ( cleaned == QLatin1String( "pentagon" ) )
return Pentagon;
return Qgis::MarkerShape::Pentagon;
else if ( cleaned == QLatin1String( "hexagon" ) )
return Hexagon;
return Qgis::MarkerShape::Hexagon;
else if ( cleaned == QLatin1String( "octagon" ) )
return Octagon;
return Qgis::MarkerShape::Octagon;
else if ( cleaned == QLatin1String( "triangle" ) )
return Triangle;
return Qgis::MarkerShape::Triangle;
else if ( cleaned == QLatin1String( "equilateral_triangle" ) )
return EquilateralTriangle;
return Qgis::MarkerShape::EquilateralTriangle;
else if ( cleaned == QLatin1String( "star" ) || cleaned == QLatin1String( "regular_star" ) )
return Star;
return Qgis::MarkerShape::Star;
else if ( cleaned == QLatin1String( "arrow" ) )
return Arrow;
return Qgis::MarkerShape::Arrow;
else if ( cleaned == QLatin1String( "circle" ) )
return Circle;
return Qgis::MarkerShape::Circle;
else if ( cleaned == QLatin1String( "cross" ) )
return Cross;
return Qgis::MarkerShape::Cross;
else if ( cleaned == QLatin1String( "cross_fill" ) )
return CrossFill;
return Qgis::MarkerShape::CrossFill;
else if ( cleaned == QLatin1String( "cross2" ) || cleaned == QLatin1String( "x" ) )
return Cross2;
return Qgis::MarkerShape::Cross2;
else if ( cleaned == QLatin1String( "line" ) )
return Line;
return Qgis::MarkerShape::Line;
else if ( cleaned == QLatin1String( "arrowhead" ) )
return ArrowHead;
return Qgis::MarkerShape::ArrowHead;
else if ( cleaned == QLatin1String( "filled_arrowhead" ) )
return ArrowHeadFilled;
return Qgis::MarkerShape::ArrowHeadFilled;
else if ( cleaned == QLatin1String( "semi_circle" ) )
return SemiCircle;
return Qgis::MarkerShape::SemiCircle;
else if ( cleaned == QLatin1String( "third_circle" ) )
return ThirdCircle;
return Qgis::MarkerShape::ThirdCircle;
else if ( cleaned == QLatin1String( "quarter_circle" ) )
return QuarterCircle;
return Qgis::MarkerShape::QuarterCircle;
else if ( cleaned == QLatin1String( "quarter_square" ) )
return QuarterSquare;
return Qgis::MarkerShape::QuarterSquare;
else if ( cleaned == QLatin1String( "half_square" ) )
return HalfSquare;
return Qgis::MarkerShape::HalfSquare;
else if ( cleaned == QLatin1String( "diagonal_half_square" ) )
return DiagonalHalfSquare;
return Qgis::MarkerShape::DiagonalHalfSquare;
else if ( cleaned == QLatin1String( "right_half_triangle" ) )
return RightHalfTriangle;
return Qgis::MarkerShape::RightHalfTriangle;
else if ( cleaned == QLatin1String( "left_half_triangle" ) )
return LeftHalfTriangle;
return Qgis::MarkerShape::LeftHalfTriangle;
else if ( cleaned == QLatin1String( "asterisk_fill" ) )
return AsteriskFill;
return Qgis::MarkerShape::AsteriskFill;
else if ( cleaned == QLatin1String( "half_arc" ) )
return HalfArc;
return Qgis::MarkerShape::HalfArc;
else if ( cleaned == QLatin1String( "third_arc" ) )
return ThirdArc;
return Qgis::MarkerShape::ThirdArc;
else if ( cleaned == QLatin1String( "quarter_arc" ) )
return QuarterArc;
return Qgis::MarkerShape::QuarterArc;
if ( ok )
*ok = false;
return Circle;
return Qgis::MarkerShape::Circle;
}
QString QgsSimpleMarkerSymbolLayerBase::encodeShape( QgsSimpleMarkerSymbolLayerBase::Shape shape )
QString QgsSimpleMarkerSymbolLayerBase::encodeShape( Qgis::MarkerShape shape )
{
switch ( shape )
{
case Square:
case Qgis::MarkerShape::Square:
return QStringLiteral( "square" );
case QuarterSquare:
case Qgis::MarkerShape::QuarterSquare:
return QStringLiteral( "quarter_square" );
case HalfSquare:
case Qgis::MarkerShape::HalfSquare:
return QStringLiteral( "half_square" );
case DiagonalHalfSquare:
case Qgis::MarkerShape::DiagonalHalfSquare:
return QStringLiteral( "diagonal_half_square" );
case Diamond:
case Qgis::MarkerShape::Diamond:
return QStringLiteral( "diamond" );
case Pentagon:
case Qgis::MarkerShape::Pentagon:
return QStringLiteral( "pentagon" );
case Hexagon:
case Qgis::MarkerShape::Hexagon:
return QStringLiteral( "hexagon" );
case Octagon:
case Qgis::MarkerShape::Octagon:
return QStringLiteral( "octagon" );
case SquareWithCorners:
case Qgis::MarkerShape::SquareWithCorners:
return QStringLiteral( "square_with_corners" );
case Triangle:
case Qgis::MarkerShape::Triangle:
return QStringLiteral( "triangle" );
case EquilateralTriangle:
case Qgis::MarkerShape::EquilateralTriangle:
return QStringLiteral( "equilateral_triangle" );
case LeftHalfTriangle:
case Qgis::MarkerShape::LeftHalfTriangle:
return QStringLiteral( "left_half_triangle" );
case RightHalfTriangle:
case Qgis::MarkerShape::RightHalfTriangle:
return QStringLiteral( "right_half_triangle" );
case Star:
case Qgis::MarkerShape::Star:
return QStringLiteral( "star" );
case Arrow:
case Qgis::MarkerShape::Arrow:
return QStringLiteral( "arrow" );
case ArrowHeadFilled:
case Qgis::MarkerShape::ArrowHeadFilled:
return QStringLiteral( "filled_arrowhead" );
case CrossFill:
case Qgis::MarkerShape::CrossFill:
return QStringLiteral( "cross_fill" );
case Circle:
case Qgis::MarkerShape::Circle:
return QStringLiteral( "circle" );
case Cross:
case Qgis::MarkerShape::Cross:
return QStringLiteral( "cross" );
case Cross2:
case Qgis::MarkerShape::Cross2:
return QStringLiteral( "cross2" );
case Line:
case Qgis::MarkerShape::Line:
return QStringLiteral( "line" );
case ArrowHead:
case Qgis::MarkerShape::ArrowHead:
return QStringLiteral( "arrowhead" );
case SemiCircle:
case Qgis::MarkerShape::SemiCircle:
return QStringLiteral( "semi_circle" );
case ThirdCircle:
case Qgis::MarkerShape::ThirdCircle:
return QStringLiteral( "third_circle" );
case QuarterCircle:
case Qgis::MarkerShape::QuarterCircle:
return QStringLiteral( "quarter_circle" );
case AsteriskFill:
case Qgis::MarkerShape::AsteriskFill:
return QStringLiteral( "asterisk_fill" );
case HalfArc:
case Qgis::MarkerShape::HalfArc:
return QStringLiteral( "half_arc" );
case ThirdArc:
case Qgis::MarkerShape::ThirdArc:
return QStringLiteral( "third_arc" );
case QuarterArc:
case Qgis::MarkerShape::QuarterArc:
return QStringLiteral( "quarter_arc" );
}
return QString();
}
bool QgsSimpleMarkerSymbolLayerBase::prepareMarkerShape( QgsSimpleMarkerSymbolLayerBase::Shape shape )
bool QgsSimpleMarkerSymbolLayerBase::prepareMarkerShape( Qgis::MarkerShape shape )
{
return shapeToPolygon( shape, mPolygon );
}
bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerBase::Shape shape, QPolygonF &polygon ) const
bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( Qgis::MarkerShape shape, QPolygonF &polygon ) const
{
polygon.clear();
switch ( shape )
{
case Square:
case Qgis::MarkerShape::Square:
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 1, 1 ) ) );
return true;
case SquareWithCorners:
case Qgis::MarkerShape::SquareWithCorners:
{
static constexpr double VERTEX_OFFSET_FROM_ORIGIN = 0.6072;
@ -477,24 +477,24 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
return true;
}
case QuarterSquare:
case Qgis::MarkerShape::QuarterSquare:
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 0, 0 ) ) );
return true;
case HalfSquare:
case Qgis::MarkerShape::HalfSquare:
polygon = QPolygonF( QRectF( QPointF( -1, -1 ), QPointF( 0, 1 ) ) );
return true;
case DiagonalHalfSquare:
case Qgis::MarkerShape::DiagonalHalfSquare:
polygon << QPointF( -1, -1 ) << QPointF( 1, 1 ) << QPointF( -1, 1 ) << QPointF( -1, -1 );
return true;
case Diamond:
case Qgis::MarkerShape::Diamond:
polygon << QPointF( -1, 0 ) << QPointF( 0, 1 )
<< QPointF( 1, 0 ) << QPointF( 0, -1 ) << QPointF( -1, 0 );
return true;
case Pentagon:
case Qgis::MarkerShape::Pentagon:
/* angular-representation of hardcoded values used
polygon << QPointF( std::sin( DEG2RAD( 288.0 ) ), - std::cos( DEG2RAD( 288.0 ) ) )
<< QPointF( std::sin( DEG2RAD( 216.0 ) ), - std::cos( DEG2RAD( 216.0 ) ) )
@ -509,7 +509,7 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
<< QPointF( -0.9511, -0.3090 );
return true;
case Hexagon:
case Qgis::MarkerShape::Hexagon:
/* angular-representation of hardcoded values used
polygon << QPointF( std::sin( DEG2RAD( 300.0 ) ), - std::cos( DEG2RAD( 300.0 ) ) )
<< QPointF( std::sin( DEG2RAD( 240.0 ) ), - std::cos( DEG2RAD( 240.0 ) ) )
@ -526,7 +526,7 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
<< QPointF( -0.8660, -0.5 );
return true;
case Octagon:
case Qgis::MarkerShape::Octagon:
{
static constexpr double VERTEX_OFFSET_FROM_ORIGIN = 1.0 / ( 1 + M_SQRT2 );
@ -542,11 +542,11 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
return true;
}
case Triangle:
case Qgis::MarkerShape::Triangle:
polygon << QPointF( -1, 1 ) << QPointF( 1, 1 ) << QPointF( 0, -1 ) << QPointF( -1, 1 );
return true;
case EquilateralTriangle:
case Qgis::MarkerShape::EquilateralTriangle:
/* angular-representation of hardcoded values used
polygon << QPointF( std::sin( DEG2RAD( 240.0 ) ), - std::cos( DEG2RAD( 240.0 ) ) )
<< QPointF( std::sin( DEG2RAD( 120.0 ) ), - std::cos( DEG2RAD( 120.0 ) ) )
@ -557,15 +557,15 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
<< QPointF( -0.8660, 0.5 );
return true;
case LeftHalfTriangle:
case Qgis::MarkerShape::LeftHalfTriangle:
polygon << QPointF( 0, 1 ) << QPointF( 1, 1 ) << QPointF( 0, -1 ) << QPointF( 0, 1 );
return true;
case RightHalfTriangle:
case Qgis::MarkerShape::RightHalfTriangle:
polygon << QPointF( -1, 1 ) << QPointF( 0, 1 ) << QPointF( 0, -1 ) << QPointF( -1, 1 );
return true;
case Star:
case Qgis::MarkerShape::Star:
{
const double inner_r = std::cos( DEG2RAD( 72.0 ) ) / std::cos( DEG2RAD( 36.0 ) );
@ -583,7 +583,7 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
return true;
}
case Arrow:
case Qgis::MarkerShape::Arrow:
polygon << QPointF( 0, -1 )
<< QPointF( 0.5, -0.5 )
<< QPointF( 0.25, -0.5 )
@ -594,11 +594,11 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
<< QPointF( 0, -1 );
return true;
case ArrowHeadFilled:
case Qgis::MarkerShape::ArrowHeadFilled:
polygon << QPointF( 0, 0 ) << QPointF( -1, 1 ) << QPointF( -1, -1 ) << QPointF( 0, 0 );
return true;
case CrossFill:
case Qgis::MarkerShape::CrossFill:
polygon << QPointF( -1, -0.2 )
<< QPointF( -1, -0.2 )
<< QPointF( -1, 0.2 )
@ -615,7 +615,7 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
<< QPointF( -1, -0.2 );
return true;
case AsteriskFill:
case Qgis::MarkerShape::AsteriskFill:
{
static constexpr double THICKNESS = 0.3;
static constexpr double HALF_THICKNESS = THICKNESS / 2.0;
@ -651,107 +651,107 @@ bool QgsSimpleMarkerSymbolLayerBase::shapeToPolygon( QgsSimpleMarkerSymbolLayerB
return true;
}
case Circle:
case Cross:
case Cross2:
case Line:
case ArrowHead:
case SemiCircle:
case ThirdCircle:
case QuarterCircle:
case HalfArc:
case ThirdArc:
case QuarterArc:
case Qgis::MarkerShape::Circle:
case Qgis::MarkerShape::Cross:
case Qgis::MarkerShape::Cross2:
case Qgis::MarkerShape::Line:
case Qgis::MarkerShape::ArrowHead:
case Qgis::MarkerShape::SemiCircle:
case Qgis::MarkerShape::ThirdCircle:
case Qgis::MarkerShape::QuarterCircle:
case Qgis::MarkerShape::HalfArc:
case Qgis::MarkerShape::ThirdArc:
case Qgis::MarkerShape::QuarterArc:
return false;
}
return false;
}
bool QgsSimpleMarkerSymbolLayerBase::prepareMarkerPath( QgsSimpleMarkerSymbolLayerBase::Shape symbol )
bool QgsSimpleMarkerSymbolLayerBase::prepareMarkerPath( Qgis::MarkerShape symbol )
{
mPath = QPainterPath();
switch ( symbol )
{
case Circle:
case Qgis::MarkerShape::Circle:
mPath.addEllipse( QRectF( -1, -1, 2, 2 ) ); // x,y,w,h
return true;
case SemiCircle:
case Qgis::MarkerShape::SemiCircle:
mPath.arcTo( -1, -1, 2, 2, 0, 180 );
mPath.lineTo( 0, 0 );
return true;
case ThirdCircle:
case Qgis::MarkerShape::ThirdCircle:
mPath.arcTo( -1, -1, 2, 2, 90, 120 );
mPath.lineTo( 0, 0 );
return true;
case QuarterCircle:
case Qgis::MarkerShape::QuarterCircle:
mPath.arcTo( -1, -1, 2, 2, 90, 90 );
mPath.lineTo( 0, 0 );
return true;
case HalfArc:
case Qgis::MarkerShape::HalfArc:
mPath.moveTo( 1, 0 );
mPath.arcTo( -1, -1, 2, 2, 0, 180 );
return true;
case ThirdArc:
case Qgis::MarkerShape::ThirdArc:
mPath.moveTo( 0, -1 );
mPath.arcTo( -1, -1, 2, 2, 90, 120 );
return true;
case QuarterArc:
case Qgis::MarkerShape::QuarterArc:
mPath.moveTo( 0, -1 );
mPath.arcTo( -1, -1, 2, 2, 90, 90 );
return true;
case Cross:
case Qgis::MarkerShape::Cross:
mPath.moveTo( -1, 0 );
mPath.lineTo( 1, 0 ); // horizontal
mPath.moveTo( 0, -1 );
mPath.lineTo( 0, 1 ); // vertical
return true;
case Cross2:
case Qgis::MarkerShape::Cross2:
mPath.moveTo( -1, -1 );
mPath.lineTo( 1, 1 );
mPath.moveTo( 1, -1 );
mPath.lineTo( -1, 1 );
return true;
case Line:
case Qgis::MarkerShape::Line:
mPath.moveTo( 0, -1 );
mPath.lineTo( 0, 1 ); // vertical line
return true;
case ArrowHead:
case Qgis::MarkerShape::ArrowHead:
mPath.moveTo( -1, -1 );
mPath.lineTo( 0, 0 );
mPath.lineTo( -1, 1 );
return true;
case Square:
case SquareWithCorners:
case QuarterSquare:
case HalfSquare:
case DiagonalHalfSquare:
case Diamond:
case Pentagon:
case Hexagon:
case Octagon:
case Triangle:
case EquilateralTriangle:
case LeftHalfTriangle:
case RightHalfTriangle:
case Star:
case Arrow:
case ArrowHeadFilled:
case CrossFill:
case AsteriskFill:
case Qgis::MarkerShape::Square:
case Qgis::MarkerShape::SquareWithCorners:
case Qgis::MarkerShape::QuarterSquare:
case Qgis::MarkerShape::HalfSquare:
case Qgis::MarkerShape::DiagonalHalfSquare:
case Qgis::MarkerShape::Diamond:
case Qgis::MarkerShape::Pentagon:
case Qgis::MarkerShape::Hexagon:
case Qgis::MarkerShape::Octagon:
case Qgis::MarkerShape::Triangle:
case Qgis::MarkerShape::EquilateralTriangle:
case Qgis::MarkerShape::LeftHalfTriangle:
case Qgis::MarkerShape::RightHalfTriangle:
case Qgis::MarkerShape::Star:
case Qgis::MarkerShape::Arrow:
case Qgis::MarkerShape::ArrowHeadFilled:
case Qgis::MarkerShape::CrossFill:
case Qgis::MarkerShape::AsteriskFill:
return false;
}
return false;
@ -838,7 +838,7 @@ void QgsSimpleMarkerSymbolLayerBase::calculateOffsetAndRotation( QgsSymbolRender
// QgsSimpleMarkerSymbolLayer
//
QgsSimpleMarkerSymbolLayer::QgsSimpleMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Shape shape, double size, double angle, Qgis::ScaleMethod scaleMethod, const QColor &color, const QColor &strokeColor, Qt::PenJoinStyle penJoinStyle )
QgsSimpleMarkerSymbolLayer::QgsSimpleMarkerSymbolLayer( Qgis::MarkerShape shape, double size, double angle, Qgis::ScaleMethod scaleMethod, const QColor &color, const QColor &strokeColor, Qt::PenJoinStyle penJoinStyle )
: QgsSimpleMarkerSymbolLayerBase( shape, size, angle, scaleMethod )
, mStrokeColor( strokeColor )
, mPenJoinStyle( penJoinStyle )
@ -850,7 +850,7 @@ QgsSimpleMarkerSymbolLayer::~QgsSimpleMarkerSymbolLayer() = default;
QgsSymbolLayer *QgsSimpleMarkerSymbolLayer::create( const QVariantMap &props )
{
Shape shape = Circle;
Qgis::MarkerShape shape = Qgis::MarkerShape::Circle;
QColor color = DEFAULT_SIMPLEMARKER_COLOR;
QColor strokeColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR;
Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE;
@ -1092,7 +1092,7 @@ bool QgsSimpleMarkerSymbolLayer::prepareCache( QgsSymbolRenderContext &context )
return true;
}
void QgsSimpleMarkerSymbolLayer::draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path )
void QgsSimpleMarkerSymbolLayer::draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path )
{
//making changes here? Don't forget to also update ::bounds if the changes affect the bounding box
//of the rendered point!
@ -1389,7 +1389,7 @@ QgsSymbolLayer *QgsSimpleMarkerSymbolLayer::createFromSld( QDomElement &element
QPointF offset;
QgsSymbolLayerUtils::displacementFromSldElement( graphicElem, offset );
const Shape shape = decodeShape( name );
const Qgis::MarkerShape shape = decodeShape( name );
const QString uom = element.attribute( QStringLiteral( "uom" ) );
size = QgsSymbolLayerUtils::sizeInPixelsFromSldUom( uom, size );
@ -1506,7 +1506,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal
angle = mDataDefinedProperties.valueAsDouble( QgsSymbolLayer::PropertyAngle, context.renderContext().expressionContext(), mAngle ) + mLineAngle;
}
Shape shape = mShape;
Qgis::MarkerShape shape = mShape;
if ( mDataDefinedProperties.isActive( QgsSymbolLayer::PropertyName ) )
{
context.setOriginalValueVariable( encodeShape( shape ) );
@ -1549,7 +1549,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal
if ( mPen.style() != Qt::NoPen )
e.writePolyline( p, layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth );
}
else if ( shape == Circle )
else if ( shape == Qgis::MarkerShape::Circle )
{
shift += QPointF( off.x(), -off.y() );
if ( mBrush.style() != Qt::NoBrush )
@ -1557,7 +1557,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal
if ( mPen.style() != Qt::NoPen )
e.writeCircle( layerName, pc, QgsPoint( shift ), halfSize, QStringLiteral( "CONTINUOUS" ), strokeWidth );
}
else if ( shape == Line )
else if ( shape == Qgis::MarkerShape::Line )
{
const QPointF pt1 = t.map( QPointF( 0, -halfSize ) );
const QPointF pt2 = t.map( QPointF( 0, halfSize ) );
@ -1565,7 +1565,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal
if ( mPen.style() != Qt::NoPen )
e.writeLine( QgsPoint( pt1 ), QgsPoint( pt2 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth );
}
else if ( shape == Cross )
else if ( shape == Qgis::MarkerShape::Cross )
{
if ( mPen.style() != Qt::NoPen )
{
@ -1578,7 +1578,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal
e.writeLine( QgsPoint( pt3 ), QgsPoint( pt4 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth );
}
}
else if ( shape == Cross2 )
else if ( shape == Qgis::MarkerShape::Cross2 )
{
if ( mPen.style() != Qt::NoPen )
{
@ -1591,7 +1591,7 @@ bool QgsSimpleMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScal
e.writeLine( QgsPoint( pt3 ), QgsPoint( pt4 ), layerName, QStringLiteral( "CONTINUOUS" ), pc, strokeWidth );
}
}
else if ( shape == ArrowHead )
else if ( shape == Qgis::MarkerShape::ArrowHead )
{
if ( mPen.style() != Qt::NoPen )
{
@ -1720,7 +1720,7 @@ QColor QgsSimpleMarkerSymbolLayer::color() const
// QgsFilledMarkerSymbolLayer
//
QgsFilledMarkerSymbolLayer::QgsFilledMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Shape shape, double size, double angle, Qgis::ScaleMethod scaleMethod )
QgsFilledMarkerSymbolLayer::QgsFilledMarkerSymbolLayer( Qgis::MarkerShape shape, double size, double angle, Qgis::ScaleMethod scaleMethod )
: QgsSimpleMarkerSymbolLayerBase( shape, size, angle, scaleMethod )
{
mFill.reset( static_cast<QgsFillSymbol *>( QgsFillSymbol::createSimple( QVariantMap() ) ) );
@ -1889,7 +1889,7 @@ bool QgsFilledMarkerSymbolLayer::usesMapUnits() const
|| ( mFill && mFill->usesMapUnits() );
}
void QgsFilledMarkerSymbolLayer::draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path )
void QgsFilledMarkerSymbolLayer::draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path )
{
//making changes here? Don't forget to also update ::bounds if the changes affect the bounding box
//of the rendered point!

View File

@ -48,49 +48,15 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
public:
//! Marker symbol shapes
enum Shape
{
Square, //!< Square
Diamond, //!< Diamond
Pentagon, //!< Pentagon
Hexagon, //!< Hexagon
Triangle, //!< Triangle
EquilateralTriangle, //!< Equilateral triangle
Star, //!< Star
Arrow, //!< Arrow
Circle, //!< Circle
Cross, //!< Cross (lines only)
CrossFill, //!< Solid filled cross
Cross2, //!< Rotated cross (lines only), "x" shape
Line, //!< Vertical line
ArrowHead, //!< Right facing arrow head (unfilled, lines only)
ArrowHeadFilled, //!< Right facing filled arrow head
SemiCircle, //!< Semi circle (top half)
ThirdCircle, //!< One third circle (top left third)
QuarterCircle, //!< Quarter circle (top left quarter)
QuarterSquare, //!< Quarter square (top left quarter)
HalfSquare, //!< Half square (left half)
DiagonalHalfSquare, //!< Diagonal half square (bottom left half)
RightHalfTriangle, //!< Right half of triangle
LeftHalfTriangle, //!< Left half of triangle
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)
HalfArc, //!< A line-only half arc (since QGIS 3.20)
ThirdArc, //!< A line-only one third arc (since QGIS 3.20)
QuarterArc, //!< A line-only one quarter arc (since QGIS 3.20)
};
//! Returns a list of all available shape types.
static QList< QgsSimpleMarkerSymbolLayerBase::Shape > availableShapes();
static QList< Qgis::MarkerShape > availableShapes();
/**
* Returns TRUE if a symbol shape has a fill.
* \param shape shape to test
* \returns TRUE if shape uses a fill, or FALSE if shape uses lines only
*/
static bool shapeIsFilled( QgsSimpleMarkerSymbolLayerBase::Shape shape );
static bool shapeIsFilled( Qgis::MarkerShape shape );
/**
* Constructor for QgsSimpleMarkerSymbolLayerBase.
@ -99,7 +65,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
* \param angle symbol rotation angle
* \param scaleMethod scaling method for data defined scaling
*/
QgsSimpleMarkerSymbolLayerBase( QgsSimpleMarkerSymbolLayerBase::Shape shape = Circle,
QgsSimpleMarkerSymbolLayerBase( Qgis::MarkerShape shape = Qgis::MarkerShape::Circle,
double size = DEFAULT_SIMPLEMARKER_SIZE,
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD );
@ -110,14 +76,14 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
* Returns the shape for the rendered marker symbol.
* \see setShape()
*/
QgsSimpleMarkerSymbolLayerBase::Shape shape() const { return mShape; }
Qgis::MarkerShape shape() const { return mShape; }
/**
* Sets the rendered marker shape.
* \param shape new marker shape
* \see shape()
*/
void setShape( QgsSimpleMarkerSymbolLayerBase::Shape shape ) { mShape = shape; }
void setShape( Qgis::MarkerShape shape ) { mShape = shape; }
/**
* Attempts to decode a string representation of a shape name to the corresponding
@ -127,7 +93,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
* \returns decoded name
* \see encodeShape()
*/
static QgsSimpleMarkerSymbolLayerBase::Shape decodeShape( const QString &name, bool *ok = nullptr );
static Qgis::MarkerShape decodeShape( const QString &name, bool *ok = nullptr );
/**
* Encodes a shape to its string representation.
@ -135,7 +101,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
* \returns encoded string
* \see decodeShape()
*/
static QString encodeShape( QgsSimpleMarkerSymbolLayerBase::Shape shape );
static QString encodeShape( Qgis::MarkerShape shape );
void startRender( QgsSymbolRenderContext &context ) override;
void stopRender( QgsSymbolRenderContext &context ) override;
@ -147,12 +113,12 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
/**
* Prepares the layer for drawing the specified shape (QPolygonF version)
*/
bool prepareMarkerShape( Shape shape );
bool prepareMarkerShape( Qgis::MarkerShape shape );
/**
* Prepares the layer for drawing the specified shape (QPainterPath version)
*/
bool prepareMarkerPath( Shape symbol );
bool prepareMarkerPath( Qgis::MarkerShape symbol );
/**
* Creates a polygon representing the specified shape.
@ -160,7 +126,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
* \param polygon destination polygon for shape
* \returns TRUE if shape was successfully stored in polygon
*/
bool shapeToPolygon( Shape shape, QPolygonF &polygon ) const;
bool shapeToPolygon( Qgis::MarkerShape shape, QPolygonF &polygon ) const;
/**
* Calculates the desired size of the marker, considering data defined size overrides.
@ -187,7 +153,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
QPainterPath mPath;
//! Symbol shape
Shape mShape;
Qgis::MarkerShape mShape;
private:
@ -199,7 +165,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerBase : public QgsMarkerSymbolLayer
* in the path argument.
* \param path transformed painter path representing shape to draw
*/
virtual void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0 SIP_FORCE;
virtual void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) = 0 SIP_FORCE;
};
/**
@ -221,7 +187,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
* \param strokeColor stroke color for symbol
* \param penJoinStyle join style for stroke pen
*/
QgsSimpleMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Shape shape = Circle,
QgsSimpleMarkerSymbolLayer( Qgis::MarkerShape shape = Qgis::MarkerShape::Circle,
double size = DEFAULT_SIMPLEMARKER_SIZE,
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD,
@ -453,7 +419,7 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
private:
// cppcheck-suppress unusedPrivateFunction
void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
double mCachedOpacity = 1.0;
@ -477,7 +443,7 @@ class CORE_EXPORT QgsFilledMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
* \param angle symbol rotation angle
* \param scaleMethod size scaling method
*/
QgsFilledMarkerSymbolLayer( QgsSimpleMarkerSymbolLayerBase::Shape shape = Circle,
QgsFilledMarkerSymbolLayer( Qgis::MarkerShape shape = Qgis::MarkerShape::Circle,
double size = DEFAULT_SIMPLEMARKER_SIZE,
double angle = DEFAULT_SIMPLEMARKER_ANGLE,
Qgis::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD );
@ -511,7 +477,7 @@ class CORE_EXPORT QgsFilledMarkerSymbolLayer : public QgsSimpleMarkerSymbolLayer
#endif
// cppcheck-suppress unusedPrivateFunction
void draw( QgsSymbolRenderContext &context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
void draw( QgsSymbolRenderContext &context, Qgis::MarkerShape shape, const QPolygonF &polygon, const QPainterPath &path ) override SIP_FORCE;
//! Fill subsymbol
std::unique_ptr< QgsFillSymbol > mFill;

View File

@ -76,7 +76,7 @@ QgsStyle *QgsStyle::sDefaultStyle = nullptr;
QgsStyle::QgsStyle()
{
std::unique_ptr< QgsSimpleMarkerSymbolLayer > simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( QgsSimpleMarkerSymbolLayerBase::Circle,
std::unique_ptr< QgsSimpleMarkerSymbolLayer > simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( Qgis::MarkerShape::Circle,
1.6, 0, Qgis::ScaleMethod::ScaleArea, QColor( 84, 176, 74 ), QColor( 61, 128, 53 ) );
simpleMarker->setStrokeWidth( 0.4 );
mPatchMarkerSymbol = std::make_unique< QgsMarkerSymbol >( QgsSymbolLayerList() << simpleMarker.release() );

View File

@ -1783,7 +1783,7 @@ bool QgsMapBoxGlStyleConverter::parseSymbolLayerAsRenderer( const QVariantMap &j
if ( spacing < 1 )
{
// if spacing isn't specified, it's a central point marker only
lineSymbol->setPlacement( QgsTemplatedLineSymbolLayerBase::CentralPoint );
lineSymbol->setPlacement( Qgis::MarkerLinePlacement::CentralPoint );
}
QgsRasterMarkerSymbolLayer *markerLayer = new QgsRasterMarkerSymbolLayer( );

View File

@ -689,7 +689,7 @@ QgsSimpleMarkerSymbolLayerWidget::QgsSimpleMarkerSymbolLayerWidget( QgsVectorLay
const double markerSize = size * 0.8;
const auto shapes = QgsSimpleMarkerSymbolLayerBase::availableShapes();
for ( const QgsSimpleMarkerSymbolLayerBase::Shape shape : shapes )
for ( const Qgis::MarkerShape shape : shapes )
{
QgsSimpleMarkerSymbolLayer *lyr = new QgsSimpleMarkerSymbolLayer( shape, markerSize );
lyr->setSizeUnit( QgsUnitTypes::RenderPixels );
@ -727,10 +727,10 @@ void QgsSimpleMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
mLayer = static_cast<QgsSimpleMarkerSymbolLayer *>( layer );
// set values
const QgsSimpleMarkerSymbolLayerBase::Shape shape = mLayer->shape();
const Qgis::MarkerShape shape = mLayer->shape();
for ( int i = 0; i < lstNames->count(); ++i )
{
if ( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
if ( static_cast< Qgis::MarkerShape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
{
lstNames->setCurrentRow( i );
break;
@ -814,7 +814,7 @@ QgsSymbolLayer *QgsSimpleMarkerSymbolLayerWidget::symbolLayer()
void QgsSimpleMarkerSymbolLayerWidget::setShape()
{
mLayer->setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
mLayer->setShape( static_cast< Qgis::MarkerShape >( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
btnChangeColorFill->setEnabled( QgsSimpleMarkerSymbolLayerBase::shapeIsFilled( mLayer->shape() ) );
emit changed();
}
@ -1132,7 +1132,7 @@ QgsFilledMarkerSymbolLayerWidget::QgsFilledMarkerSymbolLayerWidget( QgsVectorLay
const double markerSize = size * 0.8;
const auto shapes = QgsSimpleMarkerSymbolLayerBase::availableShapes();
for ( const QgsSimpleMarkerSymbolLayerBase::Shape shape : shapes )
for ( const Qgis::MarkerShape shape : shapes )
{
QgsSimpleMarkerSymbolLayer *lyr = new QgsSimpleMarkerSymbolLayer( shape, markerSize );
lyr->setSizeUnit( QgsUnitTypes::RenderPixels );
@ -1166,10 +1166,10 @@ void QgsFilledMarkerSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
mLayer = static_cast<QgsFilledMarkerSymbolLayer *>( layer );
// set values
const QgsSimpleMarkerSymbolLayerBase::Shape shape = mLayer->shape();
const Qgis::MarkerShape shape = mLayer->shape();
for ( int i = 0; i < lstNames->count(); ++i )
{
if ( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
if ( static_cast< Qgis::MarkerShape >( lstNames->item( i )->data( Qt::UserRole ).toInt() ) == shape )
{
lstNames->setCurrentRow( i );
break;
@ -1210,7 +1210,7 @@ QgsSymbolLayer *QgsFilledMarkerSymbolLayerWidget::symbolLayer()
void QgsFilledMarkerSymbolLayerWidget::setShape()
{
mLayer->setShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
mLayer->setShape( static_cast< Qgis::MarkerShape >( lstNames->currentItem()->data( Qt::UserRole ).toInt() ) );
emit changed();
}
@ -1349,7 +1349,7 @@ void QgsGradientFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
btnChangeColor2->setColor( mLayer->color2() );
btnChangeColor2->blockSignals( false );
if ( mLayer->gradientColorType() == QgsGradientFillSymbolLayer::SimpleTwoColor )
if ( mLayer->gradientColorType() == Qgis::GradientColorSource::SimpleTwoColor )
{
radioTwoColor->setChecked( true );
btnColorRamp->setEnabled( false );
@ -1372,13 +1372,13 @@ void QgsGradientFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
cboGradientType->blockSignals( true );
switch ( mLayer->gradientType() )
{
case QgsGradientFillSymbolLayer::Linear:
case Qgis::GradientType::Linear:
cboGradientType->setCurrentIndex( 0 );
break;
case QgsGradientFillSymbolLayer::Radial:
case Qgis::GradientType::Radial:
cboGradientType->setCurrentIndex( 1 );
break;
case QgsGradientFillSymbolLayer::Conical:
case Qgis::GradientType::Conical:
cboGradientType->setCurrentIndex( 2 );
break;
}
@ -1387,12 +1387,12 @@ void QgsGradientFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
cboCoordinateMode->blockSignals( true );
switch ( mLayer->coordinateMode() )
{
case QgsGradientFillSymbolLayer::Viewport:
case Qgis::SymbolCoordinateReference::Viewport:
cboCoordinateMode->setCurrentIndex( 1 );
checkRefPoint1Centroid->setEnabled( false );
checkRefPoint2Centroid->setEnabled( false );
break;
case QgsGradientFillSymbolLayer::Feature:
case Qgis::SymbolCoordinateReference::Feature:
default:
cboCoordinateMode->setCurrentIndex( 0 );
break;
@ -1402,13 +1402,13 @@ void QgsGradientFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
cboGradientSpread->blockSignals( true );
switch ( mLayer->gradientSpread() )
{
case QgsGradientFillSymbolLayer::Pad:
case Qgis::GradientSpread::Pad:
cboGradientSpread->setCurrentIndex( 0 );
break;
case QgsGradientFillSymbolLayer::Repeat:
case Qgis::GradientSpread::Repeat:
cboGradientSpread->setCurrentIndex( 1 );
break;
case QgsGradientFillSymbolLayer::Reflect:
case Qgis::GradientSpread::Reflect:
cboGradientSpread->setCurrentIndex( 2 );
break;
}
@ -1494,11 +1494,11 @@ void QgsGradientFillSymbolLayerWidget::colorModeChanged()
{
if ( radioTwoColor->isChecked() )
{
mLayer->setGradientColorType( QgsGradientFillSymbolLayer::SimpleTwoColor );
mLayer->setGradientColorType( Qgis::GradientColorSource::SimpleTwoColor );
}
else
{
mLayer->setGradientColorType( QgsGradientFillSymbolLayer::ColorRamp );
mLayer->setGradientColorType( Qgis::GradientColorSource::ColorRamp );
}
emit changed();
}
@ -1517,7 +1517,7 @@ void QgsGradientFillSymbolLayerWidget::setGradientType( int index )
switch ( index )
{
case 0:
mLayer->setGradientType( QgsGradientFillSymbolLayer::Linear );
mLayer->setGradientType( Qgis::GradientType::Linear );
//set sensible default reference points
spinRefPoint1X->setValue( 0.5 );
spinRefPoint1Y->setValue( 0 );
@ -1525,7 +1525,7 @@ void QgsGradientFillSymbolLayerWidget::setGradientType( int index )
spinRefPoint2Y->setValue( 1 );
break;
case 1:
mLayer->setGradientType( QgsGradientFillSymbolLayer::Radial );
mLayer->setGradientType( Qgis::GradientType::Radial );
//set sensible default reference points
spinRefPoint1X->setValue( 0 );
spinRefPoint1Y->setValue( 0 );
@ -1533,7 +1533,7 @@ void QgsGradientFillSymbolLayerWidget::setGradientType( int index )
spinRefPoint2Y->setValue( 1 );
break;
case 2:
mLayer->setGradientType( QgsGradientFillSymbolLayer::Conical );
mLayer->setGradientType( Qgis::GradientType::Conical );
spinRefPoint1X->setValue( 0.5 );
spinRefPoint1Y->setValue( 0.5 );
spinRefPoint2X->setValue( 1 );
@ -1550,14 +1550,14 @@ void QgsGradientFillSymbolLayerWidget::setCoordinateMode( int index )
{
case 0:
//feature coordinate mode
mLayer->setCoordinateMode( QgsGradientFillSymbolLayer::Feature );
mLayer->setCoordinateMode( Qgis::SymbolCoordinateReference::Feature );
//allow choice of centroid reference positions
checkRefPoint1Centroid->setEnabled( true );
checkRefPoint2Centroid->setEnabled( true );
break;
case 1:
//viewport coordinate mode
mLayer->setCoordinateMode( QgsGradientFillSymbolLayer::Viewport );
mLayer->setCoordinateMode( Qgis::SymbolCoordinateReference::Viewport );
//disable choice of centroid reference positions
checkRefPoint1Centroid->setChecked( Qt::Unchecked );
checkRefPoint1Centroid->setEnabled( false );
@ -1574,13 +1574,13 @@ void QgsGradientFillSymbolLayerWidget::setGradientSpread( int index )
switch ( index )
{
case 0:
mLayer->setGradientSpread( QgsGradientFillSymbolLayer::Pad );
mLayer->setGradientSpread( Qgis::GradientSpread::Pad );
break;
case 1:
mLayer->setGradientSpread( QgsGradientFillSymbolLayer::Repeat );
mLayer->setGradientSpread( Qgis::GradientSpread::Repeat );
break;
case 2:
mLayer->setGradientSpread( QgsGradientFillSymbolLayer::Reflect );
mLayer->setGradientSpread( Qgis::GradientSpread::Reflect );
break;
}
@ -1956,17 +1956,17 @@ void QgsMarkerLineSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
spinOffset->blockSignals( true );
spinOffset->setValue( mLayer->offset() );
spinOffset->blockSignals( false );
if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::Interval )
if ( mLayer->placement() == Qgis::MarkerLinePlacement::Interval )
radInterval->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::Vertex )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::Vertex )
radVertex->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::LastVertex )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::LastVertex )
radVertexLast->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::CentralPoint )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::CentralPoint )
radCentralPoint->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::CurvePoint )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::CurvePoint )
radCurvePoint->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::SegmentCenter )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::SegmentCenter )
radSegmentCentralPoint->setChecked( true );
else
radVertexFirst->setChecked( true );
@ -2061,19 +2061,19 @@ void QgsMarkerLineSymbolLayerWidget::setPlacement()
mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
//mLayer->setPlacement( interval ? QgsMarkerLineSymbolLayer::Interval : QgsMarkerLineSymbolLayer::Vertex );
if ( radInterval->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::Interval );
mLayer->setPlacement( Qgis::MarkerLinePlacement::Interval );
else if ( radVertex->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::Vertex );
mLayer->setPlacement( Qgis::MarkerLinePlacement::Vertex );
else if ( radVertexLast->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::LastVertex );
mLayer->setPlacement( Qgis::MarkerLinePlacement::LastVertex );
else if ( radVertexFirst->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::FirstVertex );
mLayer->setPlacement( Qgis::MarkerLinePlacement::FirstVertex );
else if ( radCurvePoint->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::CurvePoint );
mLayer->setPlacement( Qgis::MarkerLinePlacement::CurvePoint );
else if ( radSegmentCentralPoint->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::SegmentCenter );
mLayer->setPlacement( Qgis::MarkerLinePlacement::SegmentCenter );
else
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::CentralPoint );
mLayer->setPlacement( Qgis::MarkerLinePlacement::CentralPoint );
emit changed();
}
@ -2208,17 +2208,17 @@ void QgsHashedLineSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer )
spinOffset->blockSignals( true );
spinOffset->setValue( mLayer->offset() );
spinOffset->blockSignals( false );
if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::Interval )
if ( mLayer->placement() == Qgis::MarkerLinePlacement::Interval )
radInterval->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::Vertex )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::Vertex )
radVertex->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::LastVertex )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::LastVertex )
radVertexLast->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::CentralPoint )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::CentralPoint )
radCentralPoint->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::CurvePoint )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::CurvePoint )
radCurvePoint->setChecked( true );
else if ( mLayer->placement() == QgsTemplatedLineSymbolLayerBase::SegmentCenter )
else if ( mLayer->placement() == Qgis::MarkerLinePlacement::SegmentCenter )
radSegmentCentralPoint->setChecked( true );
else
radVertexFirst->setChecked( true );
@ -2328,19 +2328,19 @@ void QgsHashedLineSymbolLayerWidget::setPlacement()
mAverageAngleUnit->setEnabled( mSpinAverageAngleLength->isEnabled() );
//mLayer->setPlacement( interval ? QgsMarkerLineSymbolLayer::Interval : QgsMarkerLineSymbolLayer::Vertex );
if ( radInterval->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::Interval );
mLayer->setPlacement( Qgis::MarkerLinePlacement::Interval );
else if ( radVertex->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::Vertex );
mLayer->setPlacement( Qgis::MarkerLinePlacement::Vertex );
else if ( radVertexLast->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::LastVertex );
mLayer->setPlacement( Qgis::MarkerLinePlacement::LastVertex );
else if ( radVertexFirst->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::FirstVertex );
mLayer->setPlacement( Qgis::MarkerLinePlacement::FirstVertex );
else if ( radCurvePoint->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::CurvePoint );
mLayer->setPlacement( Qgis::MarkerLinePlacement::CurvePoint );
else if ( radSegmentCentralPoint->isChecked() )
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::SegmentCenter );
mLayer->setPlacement( Qgis::MarkerLinePlacement::SegmentCenter );
else
mLayer->setPlacement( QgsTemplatedLineSymbolLayerBase::CentralPoint );
mLayer->setPlacement( Qgis::MarkerLinePlacement::CentralPoint );
emit changed();
}
@ -4348,8 +4348,8 @@ QgsRandomMarkerFillSymbolLayerWidget::QgsRandomMarkerFillSymbolLayerWidget( QgsV
{
setupUi( this );
mCountMethodComboBox->addItem( tr( "Absolute Count" ), QgsRandomMarkerFillSymbolLayer::AbsoluteCount );
mCountMethodComboBox->addItem( tr( "Density-based Count" ), QgsRandomMarkerFillSymbolLayer::DensityBasedCount );
mCountMethodComboBox->addItem( tr( "Absolute Count" ), static_cast< int >( Qgis::PointCountMethod::Absolute ) );
mCountMethodComboBox->addItem( tr( "Density-based Count" ), static_cast< int >( Qgis::PointCountMethod::DensityBased ) );
mPointCountSpinBox->setShowClearButton( true );
mPointCountSpinBox->setClearValue( 100 );
@ -4390,10 +4390,10 @@ void QgsRandomMarkerFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer
bool showDensityBasedCountWidgets = false;
switch ( mLayer->countMethod() )
{
case QgsRandomMarkerFillSymbolLayer::DensityBasedCount:
case Qgis::PointCountMethod::DensityBased:
showDensityBasedCountWidgets = true;
break;
case QgsRandomMarkerFillSymbolLayer::AbsoluteCount:
case Qgis::PointCountMethod::Absolute:
break;
}
mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
@ -4401,7 +4401,7 @@ void QgsRandomMarkerFillSymbolLayerWidget::setSymbolLayer( QgsSymbolLayer *layer
mDensityAreaUnitWidget->setVisible( showDensityBasedCountWidgets );
mDensityAreaDdbtn->setVisible( showDensityBasedCountWidgets );
whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData( mLayer->countMethod() ) );
whileBlocking( mCountMethodComboBox )->setCurrentIndex( mCountMethodComboBox->findData( static_cast< int >( mLayer->countMethod() ) ) );
whileBlocking( mDensityAreaSpinBox )->setValue( mLayer->densityArea() );
mDensityAreaUnitWidget->blockSignals( true );
mDensityAreaUnitWidget->setUnit( mLayer->densityAreaUnit() );
@ -4423,12 +4423,12 @@ void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged( int )
{
bool showDensityBasedCountWidgets = false;
switch ( static_cast< QgsRandomMarkerFillSymbolLayer::CountMethod >( mCountMethodComboBox->currentData().toInt() ) )
switch ( static_cast< Qgis::PointCountMethod >( mCountMethodComboBox->currentData().toInt() ) )
{
case QgsRandomMarkerFillSymbolLayer::DensityBasedCount:
case Qgis::PointCountMethod::DensityBased:
showDensityBasedCountWidgets = true;
break;
case QgsRandomMarkerFillSymbolLayer::AbsoluteCount:
case Qgis::PointCountMethod::Absolute:
break;
}
mDensityAreaLabel->setVisible( showDensityBasedCountWidgets );
@ -4438,7 +4438,7 @@ void QgsRandomMarkerFillSymbolLayerWidget::countMethodChanged( int )
if ( mLayer )
{
mLayer->setCountMethod( static_cast< QgsRandomMarkerFillSymbolLayer::CountMethod >( mCountMethodComboBox->currentData().toInt() ) );
mLayer->setCountMethod( static_cast< Qgis::PointCountMethod >( mCountMethodComboBox->currentData().toInt() ) );
emit changed();
}
}

View File

@ -215,7 +215,7 @@ void TestQgsArcGisRestUtils::testParseMarkerSymbol()
QgsSimpleMarkerSymbolLayer *markerLayer = dynamic_cast< QgsSimpleMarkerSymbolLayer * >( marker->symbolLayer( 0 ) );
QVERIFY( markerLayer );
QCOMPARE( markerLayer->fillColor(), QColor( 76, 115, 10, 200 ) );
QCOMPARE( markerLayer->shape(), QgsSimpleMarkerSymbolLayerBase::Square );
QCOMPARE( markerLayer->shape(), Qgis::MarkerShape::Square );
QCOMPARE( markerLayer->size(), 8.0 );
QCOMPARE( markerLayer->sizeUnit(), QgsUnitTypes::RenderPoints );
QCOMPARE( markerLayer->angle(), -10.0 ); // opposite direction to esri spec!

View File

@ -99,10 +99,10 @@ void TestQgsFilledMarkerSymbol::initTestCase()
QgsGradientFillSymbolLayer *gradientFill = new QgsGradientFillSymbolLayer();
gradientFill->setColor( QColor( "red" ) );
gradientFill->setColor2( QColor( "blue" ) );
gradientFill->setGradientType( QgsGradientFillSymbolLayer::Linear );
gradientFill->setGradientColorType( QgsGradientFillSymbolLayer::SimpleTwoColor );
gradientFill->setCoordinateMode( QgsGradientFillSymbolLayer::Feature );
gradientFill->setGradientSpread( QgsGradientFillSymbolLayer::Pad );
gradientFill->setGradientType( Qgis::GradientType::Linear );
gradientFill->setGradientColorType( Qgis::GradientColorSource::SimpleTwoColor );
gradientFill->setCoordinateMode( Qgis::SymbolCoordinateReference::Feature );
gradientFill->setGradientSpread( Qgis::GradientSpread::Pad );
gradientFill->setReferencePoint1( QPointF( 0, 0 ) );
gradientFill->setReferencePoint2( QPointF( 1, 1 ) );
QgsFillSymbol *fillSymbol = new QgsFillSymbol();
@ -141,14 +141,14 @@ void TestQgsFilledMarkerSymbol::cleanupTestCase()
void TestQgsFilledMarkerSymbol::filledMarkerSymbol()
{
mFilledMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Circle );
mFilledMarkerLayer->setShape( Qgis::MarkerShape::Circle );
mFilledMarkerLayer->setSize( 15 );
QVERIFY( imageCheck( "filledmarker" ) );
}
void TestQgsFilledMarkerSymbol::dataDefinedShape()
{
mFilledMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Circle );
mFilledMarkerLayer->setShape( Qgis::MarkerShape::Circle );
mFilledMarkerLayer->setSize( 10 );
mFilledMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyName, QgsProperty::fromExpression( QStringLiteral( "if(\"class\"='Jet','square','star')" ) ) );
const bool result = imageCheck( QStringLiteral( "filledmarker_datadefinedshape" ) );
@ -159,7 +159,7 @@ void TestQgsFilledMarkerSymbol::dataDefinedShape()
void TestQgsFilledMarkerSymbol::bounds()
{
mFilledMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mFilledMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Circle );
mFilledMarkerLayer->setShape( Qgis::MarkerShape::Circle );
mFilledMarkerLayer->setSize( 5 );
mFilledMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertySize, QgsProperty::fromExpression( QStringLiteral( "min(\"importance\" * 2, 6)" ) ) );

View File

@ -141,10 +141,10 @@ void TestQgsGradients::gradientSymbol()
mReport += QLatin1String( "<h2>Gradient symbol renderer test</h2>\n" );
mGradientFill->setColor( QColor( "red" ) );
mGradientFill->setColor2( QColor( "blue" ) );
mGradientFill->setGradientType( QgsGradientFillSymbolLayer::Linear );
mGradientFill->setGradientColorType( QgsGradientFillSymbolLayer::SimpleTwoColor );
mGradientFill->setCoordinateMode( QgsGradientFillSymbolLayer::Feature );
mGradientFill->setGradientSpread( QgsGradientFillSymbolLayer::Pad );
mGradientFill->setGradientType( Qgis::GradientType::Linear );
mGradientFill->setGradientColorType( Qgis::GradientColorSource::SimpleTwoColor );
mGradientFill->setCoordinateMode( Qgis::SymbolCoordinateReference::Feature );
mGradientFill->setGradientSpread( Qgis::GradientSpread::Pad );
mGradientFill->setReferencePoint1( QPointF( 0, 0 ) );
mGradientFill->setReferencePoint2( QPointF( 1, 1 ) );
QVERIFY( imageCheck( "gradient" ) );
@ -168,35 +168,35 @@ void TestQgsGradients::gradientSymbolRamp()
gradientRamp->setStops( stops );
mGradientFill->setColorRamp( gradientRamp );
mGradientFill->setGradientColorType( QgsGradientFillSymbolLayer::ColorRamp );
mGradientFill->setGradientColorType( Qgis::GradientColorSource::ColorRamp );
QVERIFY( imageCheck( "gradient_ramp" ) );
mGradientFill->setGradientColorType( QgsGradientFillSymbolLayer::SimpleTwoColor );
mGradientFill->setGradientColorType( Qgis::GradientColorSource::SimpleTwoColor );
}
void TestQgsGradients::gradientSymbolRadial()
{
mReport += QLatin1String( "<h2>Gradient symbol renderer radial test</h2>\n" );
mGradientFill->setGradientType( QgsGradientFillSymbolLayer::Radial );
mGradientFill->setGradientType( Qgis::GradientType::Radial );
QVERIFY( imageCheck( "gradient_radial" ) );
mGradientFill->setGradientType( QgsGradientFillSymbolLayer::Linear );
mGradientFill->setGradientType( Qgis::GradientType::Linear );
}
void TestQgsGradients::gradientSymbolConical()
{
mReport += QLatin1String( "<h2>Gradient symbol renderer conical test</h2>\n" );
mGradientFill->setGradientType( QgsGradientFillSymbolLayer::Conical );
mGradientFill->setGradientType( Qgis::GradientType::Conical );
mGradientFill->setReferencePoint1( QPointF( 0.5, 0.5 ) );
QVERIFY( imageCheck( "gradient_conical" ) );
mGradientFill->setReferencePoint1( QPointF( 0, 0 ) );
mGradientFill->setGradientType( QgsGradientFillSymbolLayer::Linear );
mGradientFill->setGradientType( Qgis::GradientType::Linear );
}
void TestQgsGradients::gradientSymbolViewport()
{
mReport += QLatin1String( "<h2>Gradient symbol renderer viewport test</h2>\n" );
mGradientFill->setCoordinateMode( QgsGradientFillSymbolLayer::Viewport );
mGradientFill->setCoordinateMode( Qgis::SymbolCoordinateReference::Viewport );
QVERIFY( imageCheck( "gradient_viewport" ) );
mGradientFill->setCoordinateMode( QgsGradientFillSymbolLayer::Feature );
mGradientFill->setCoordinateMode( Qgis::SymbolCoordinateReference::Feature );
}
void TestQgsGradients::gradientSymbolReferencePoints()
@ -224,9 +224,9 @@ void TestQgsGradients::gradientSymbolReflectSpread()
{
mReport += QLatin1String( "<h2>Gradient symbol renderer reflect spread test</h2>\n" );
mGradientFill->setReferencePoint2( QPointF( 0.5, 0.5 ) );
mGradientFill->setGradientSpread( QgsGradientFillSymbolLayer::Reflect );
mGradientFill->setGradientSpread( Qgis::GradientSpread::Reflect );
QVERIFY( imageCheck( "gradient_reflect" ) );
mGradientFill->setGradientSpread( QgsGradientFillSymbolLayer::Pad );
mGradientFill->setGradientSpread( Qgis::GradientSpread::Pad );
mGradientFill->setReferencePoint2( QPointF( 1, 1 ) );
}
@ -234,9 +234,9 @@ void TestQgsGradients::gradientSymbolRepeatSpread()
{
mReport += QLatin1String( "<h2>Gradient symbol renderer repeat spread test</h2>\n" );
mGradientFill->setReferencePoint2( QPointF( 0.5, 0.5 ) );
mGradientFill->setGradientSpread( QgsGradientFillSymbolLayer::Repeat );
mGradientFill->setGradientSpread( Qgis::GradientSpread::Repeat );
QVERIFY( imageCheck( "gradient_repeat" ) );
mGradientFill->setGradientSpread( QgsGradientFillSymbolLayer::Pad );
mGradientFill->setGradientSpread( Qgis::GradientSpread::Pad );
mGradientFill->setReferencePoint2( QPointF( 1, 1 ) );
}

View File

@ -146,7 +146,7 @@ void TestQgsMarkerLineSymbol::pointNumInterval()
mMapSettings->setLayers( QList<QgsMapLayer *>() << mLinesLayer );
QgsMarkerLineSymbolLayer *ml = new QgsMarkerLineSymbolLayer();
ml->setPlacement( QgsTemplatedLineSymbolLayerBase::Interval );
ml->setPlacement( Qgis::MarkerLinePlacement::Interval );
ml->setInterval( 4 );
QgsLineSymbol *lineSymbol = new QgsLineSymbol();
lineSymbol->changeSymbolLayer( 0, ml );
@ -176,7 +176,7 @@ void TestQgsMarkerLineSymbol::pointNumVertex()
mMapSettings->setLayers( QList<QgsMapLayer *>() << mLinesLayer );
QgsMarkerLineSymbolLayer *ml = new QgsMarkerLineSymbolLayer();
ml->setPlacement( QgsTemplatedLineSymbolLayerBase::Vertex );
ml->setPlacement( Qgis::MarkerLinePlacement::Vertex );
QgsLineSymbol *lineSymbol = new QgsLineSymbol();
lineSymbol->changeSymbolLayer( 0, ml );
QgsSingleSymbolRenderer *r = new QgsSingleSymbolRenderer( lineSymbol );

View File

@ -648,7 +648,7 @@ void TestQgsOgrUtils::convertStyleString()
QVERIFY( symbol );
QCOMPARE( symbol->symbolLayerCount(), 1 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->color().name(), QStringLiteral( "#5050ff" ) );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), QgsSimpleMarkerSymbolLayer::Square );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), Qgis::MarkerShape::Square );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->size(), 36.0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->angle(), 0.0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->sizeUnit(), QgsUnitTypes::RenderPoints );
@ -658,7 +658,7 @@ void TestQgsOgrUtils::convertStyleString()
QCOMPARE( symbol->symbolLayerCount(), 1 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->color().alpha(), 0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->strokeColor().name(), QStringLiteral( "#5050ff" ) );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), QgsSimpleMarkerSymbolLayer::Triangle );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), Qgis::MarkerShape::Triangle );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->size(), 36.0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->angle(), 0.0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->sizeUnit(), QgsUnitTypes::RenderPoints );
@ -667,7 +667,7 @@ void TestQgsOgrUtils::convertStyleString()
QVERIFY( symbol );
QCOMPARE( symbol->symbolLayerCount(), 1 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->color().name(), QStringLiteral( "#5050ff" ) );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), QgsSimpleMarkerSymbolLayer::Square );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), Qgis::MarkerShape::Square );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->size(), 36.0 );
// OGR symbol angles are opposite direction to qgis marker angles
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->angle(), -20.0 );
@ -677,7 +677,7 @@ void TestQgsOgrUtils::convertStyleString()
QVERIFY( symbol );
QCOMPARE( symbol->symbolLayerCount(), 1 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->color().name(), QStringLiteral( "#5050ff" ) );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), QgsSimpleMarkerSymbolLayer::Square );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), Qgis::MarkerShape::Square );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->size(), 36.0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->angle(), 0.0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->sizeUnit(), QgsUnitTypes::RenderPoints );
@ -713,7 +713,7 @@ void TestQgsOgrUtils::convertStyleString()
QVERIFY( symbol );
QCOMPARE( symbol->symbolLayerCount(), 1 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->color().name(), QStringLiteral( "#00ff00" ) );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), QgsSimpleMarkerSymbolLayer::Star );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->shape(), Qgis::MarkerShape::Star );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->size(), 12.0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->angle(), 0.0 );
QCOMPARE( qgis::down_cast<QgsSimpleMarkerSymbolLayer * >( symbol->symbolLayer( 0 ) )->sizeUnit(), QgsUnitTypes::RenderPoints );

View File

@ -164,39 +164,39 @@ void TestQgsSimpleMarkerSymbol::decodeShape_data()
QTest::addColumn<int>( "shape" );
QTest::addColumn<bool>( "ok" );
QTest::newRow( "empty string" ) << "" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Circle ) << false;
QTest::newRow( "invalid character" ) << "@" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Circle ) << false;
QTest::newRow( "square" ) << "square" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Square ) << true;
QTest::newRow( "square case" ) << "SQUARE" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Square ) << true;
QTest::newRow( "square case spaces" ) << " SQUARE " << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Square ) << true;
QTest::newRow( "square_with_corners" ) << "square_with_corners" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::SquareWithCorners ) << true;
QTest::newRow( "rectangle" ) << "rectangle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Square ) << true;
QTest::newRow( "diamond" ) << "diamond" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Diamond ) << true;
QTest::newRow( "pentagon" ) << "pentagon" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Pentagon ) << true;
QTest::newRow( "hexagon" ) << "hexagon" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Hexagon ) << true;
QTest::newRow( "octagon" ) << "octagon" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Octagon ) << true;
QTest::newRow( "triangle" ) << "triangle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Triangle ) << true;
QTest::newRow( "equilateral_triangle" ) << "equilateral_triangle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::EquilateralTriangle ) << true;
QTest::newRow( "star" ) << "star" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Star ) << true;
QTest::newRow( "regular_star" ) << "regular_star" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Star ) << true;
QTest::newRow( "arrow" ) << "arrow" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Arrow ) << true;
QTest::newRow( "circle" ) << "circle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Circle ) << true;
QTest::newRow( "cross" ) << "cross" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Cross ) << true;
QTest::newRow( "cross_fill" ) << "cross_fill" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::CrossFill ) << true;
QTest::newRow( "cross2" ) << "cross2" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Cross2 ) << true;
QTest::newRow( "x" ) << "x" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Cross2 ) << true;
QTest::newRow( "line" ) << "line" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::Line ) << true;
QTest::newRow( "arrowhead" ) << "arrowhead" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::ArrowHead ) << true;
QTest::newRow( "filled_arrowhead" ) << "filled_arrowhead" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::ArrowHeadFilled ) << true;
QTest::newRow( "semi_circle" ) << "semi_circle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::SemiCircle ) << true;
QTest::newRow( "third_circle" ) << "third_circle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::ThirdCircle ) << true;
QTest::newRow( "quarter_circle" ) << "quarter_circle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::QuarterCircle ) << true;
QTest::newRow( "quarter_square" ) << "quarter_square" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::QuarterSquare ) << true;
QTest::newRow( "half_square" ) << "half_square" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::HalfSquare ) << true;
QTest::newRow( "diagonal_half_square" ) << "diagonal_half_square" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::DiagonalHalfSquare ) << true;
QTest::newRow( "right_half_triangle" ) << "right_half_triangle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::RightHalfTriangle ) << true;
QTest::newRow( "left_half_triangle" ) << "left_half_triangle" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::LeftHalfTriangle ) << true;
QTest::newRow( "asterisk_fill" ) << "asterisk_fill" << static_cast< int >( QgsSimpleMarkerSymbolLayerBase::AsteriskFill ) << true;
QTest::newRow( "empty string" ) << "" << static_cast< int >( Qgis::MarkerShape::Circle ) << false;
QTest::newRow( "invalid character" ) << "@" << static_cast< int >( Qgis::MarkerShape::Circle ) << false;
QTest::newRow( "square" ) << "square" << static_cast< int >( Qgis::MarkerShape::Square ) << true;
QTest::newRow( "square case" ) << "SQUARE" << static_cast< int >( Qgis::MarkerShape::Square ) << true;
QTest::newRow( "square case spaces" ) << " SQUARE " << static_cast< int >( Qgis::MarkerShape::Square ) << true;
QTest::newRow( "square_with_corners" ) << "square_with_corners" << static_cast< int >( Qgis::MarkerShape::SquareWithCorners ) << true;
QTest::newRow( "rectangle" ) << "rectangle" << static_cast< int >( Qgis::MarkerShape::Square ) << true;
QTest::newRow( "diamond" ) << "diamond" << static_cast< int >( Qgis::MarkerShape::Diamond ) << true;
QTest::newRow( "pentagon" ) << "pentagon" << static_cast< int >( Qgis::MarkerShape::Pentagon ) << true;
QTest::newRow( "hexagon" ) << "hexagon" << static_cast< int >( Qgis::MarkerShape::Hexagon ) << true;
QTest::newRow( "octagon" ) << "octagon" << static_cast< int >( Qgis::MarkerShape::Octagon ) << true;
QTest::newRow( "triangle" ) << "triangle" << static_cast< int >( Qgis::MarkerShape::Triangle ) << true;
QTest::newRow( "equilateral_triangle" ) << "equilateral_triangle" << static_cast< int >( Qgis::MarkerShape::EquilateralTriangle ) << true;
QTest::newRow( "star" ) << "star" << static_cast< int >( Qgis::MarkerShape::Star ) << true;
QTest::newRow( "regular_star" ) << "regular_star" << static_cast< int >( Qgis::MarkerShape::Star ) << true;
QTest::newRow( "arrow" ) << "arrow" << static_cast< int >( Qgis::MarkerShape::Arrow ) << true;
QTest::newRow( "circle" ) << "circle" << static_cast< int >( Qgis::MarkerShape::Circle ) << true;
QTest::newRow( "cross" ) << "cross" << static_cast< int >( Qgis::MarkerShape::Cross ) << true;
QTest::newRow( "cross_fill" ) << "cross_fill" << static_cast< int >( Qgis::MarkerShape::CrossFill ) << true;
QTest::newRow( "cross2" ) << "cross2" << static_cast< int >( Qgis::MarkerShape::Cross2 ) << true;
QTest::newRow( "x" ) << "x" << static_cast< int >( Qgis::MarkerShape::Cross2 ) << true;
QTest::newRow( "line" ) << "line" << static_cast< int >( Qgis::MarkerShape::Line ) << true;
QTest::newRow( "arrowhead" ) << "arrowhead" << static_cast< int >( Qgis::MarkerShape::ArrowHead ) << true;
QTest::newRow( "filled_arrowhead" ) << "filled_arrowhead" << static_cast< int >( Qgis::MarkerShape::ArrowHeadFilled ) << true;
QTest::newRow( "semi_circle" ) << "semi_circle" << static_cast< int >( Qgis::MarkerShape::SemiCircle ) << true;
QTest::newRow( "third_circle" ) << "third_circle" << static_cast< int >( Qgis::MarkerShape::ThirdCircle ) << true;
QTest::newRow( "quarter_circle" ) << "quarter_circle" << static_cast< int >( Qgis::MarkerShape::QuarterCircle ) << true;
QTest::newRow( "quarter_square" ) << "quarter_square" << static_cast< int >( Qgis::MarkerShape::QuarterSquare ) << true;
QTest::newRow( "half_square" ) << "half_square" << static_cast< int >( Qgis::MarkerShape::HalfSquare ) << true;
QTest::newRow( "diagonal_half_square" ) << "diagonal_half_square" << static_cast< int >( Qgis::MarkerShape::DiagonalHalfSquare ) << true;
QTest::newRow( "right_half_triangle" ) << "right_half_triangle" << static_cast< int >( Qgis::MarkerShape::RightHalfTriangle ) << true;
QTest::newRow( "left_half_triangle" ) << "left_half_triangle" << static_cast< int >( Qgis::MarkerShape::LeftHalfTriangle ) << true;
QTest::newRow( "asterisk_fill" ) << "asterisk_fill" << static_cast< int >( Qgis::MarkerShape::AsteriskFill ) << true;
}
void TestQgsSimpleMarkerSymbol::decodeShape()
@ -210,7 +210,7 @@ void TestQgsSimpleMarkerSymbol::decodeShape()
QCOMPARE( res, ok );
// round trip through encode
QCOMPARE( static_cast< int >( QgsSimpleMarkerSymbolLayerBase::decodeShape( QgsSimpleMarkerSymbolLayerBase::encodeShape( static_cast< QgsSimpleMarkerSymbolLayerBase::Shape>( shape ) ) ) ), shape );
QCOMPARE( static_cast< int >( QgsSimpleMarkerSymbolLayerBase::decodeShape( QgsSimpleMarkerSymbolLayerBase::encodeShape( static_cast< Qgis::MarkerShape >( shape ) ) ) ), shape );
}
void TestQgsSimpleMarkerSymbol::simpleMarkerSymbol()
@ -219,7 +219,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSymbol()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Circle );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Circle );
mSimpleMarkerLayer->setSize( 5 );
mSimpleMarkerLayer->setStrokeWidth( 1 );
QVERIFY( imageCheck( "simplemarker" ) );
@ -231,7 +231,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSymbolRotation()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Square );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Square );
mSimpleMarkerLayer->setSize( 15 );
mSimpleMarkerLayer->setAngle( 45 );
mSimpleMarkerLayer->setStrokeWidth( 0.2 );
@ -248,7 +248,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSymbolPreviewRotation()
QgsSimpleMarkerSymbolLayer *simpleMarkerLayer = new QgsSimpleMarkerSymbolLayer();
markerSymbol.changeSymbolLayer( 0, simpleMarkerLayer );
simpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Shape::Arrow );
simpleMarkerLayer->setShape( Qgis::MarkerShape::Arrow );
simpleMarkerLayer->setAngle( angle );
simpleMarkerLayer->setSize( 20 );
simpleMarkerLayer->setColor( Qt::red );
@ -276,7 +276,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSymbolBevelJoin()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Triangle );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Triangle );
mSimpleMarkerLayer->setSize( 25 );
mSimpleMarkerLayer->setAngle( 0 );
mSimpleMarkerLayer->setStrokeWidth( 3 );
@ -290,7 +290,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSymbolMiterJoin()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Triangle );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Triangle );
mSimpleMarkerLayer->setSize( 25 );
mSimpleMarkerLayer->setStrokeWidth( 3 );
mSimpleMarkerLayer->setPenJoinStyle( Qt::MiterJoin );
@ -303,7 +303,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSymbolRoundJoin()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Triangle );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Triangle );
mSimpleMarkerLayer->setSize( 25 );
mSimpleMarkerLayer->setStrokeWidth( 3 );
mSimpleMarkerLayer->setPenJoinStyle( Qt::RoundJoin );
@ -316,7 +316,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSymbolCapStyle()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::ArrowHead );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::ArrowHead );
mSimpleMarkerLayer->setSize( 25 );
mSimpleMarkerLayer->setStrokeWidth( 3 );
mSimpleMarkerLayer->setPenCapStyle( Qt::RoundCap );
@ -329,7 +329,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerOctagon()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Octagon );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Octagon );
mSimpleMarkerLayer->setSize( 25 );
mSimpleMarkerLayer->setStrokeWidth( 2 );
mSimpleMarkerLayer->setPenJoinStyle( Qt::MiterJoin );
@ -342,7 +342,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerSquareWithCorners()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::SquareWithCorners );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::SquareWithCorners );
mSimpleMarkerLayer->setSize( 25 );
mSimpleMarkerLayer->setStrokeWidth( 2 );
mSimpleMarkerLayer->setPenJoinStyle( Qt::MiterJoin );
@ -355,7 +355,7 @@ void TestQgsSimpleMarkerSymbol::simpleMarkerAsterisk()
mSimpleMarkerLayer->setColor( Qt::blue );
mSimpleMarkerLayer->setStrokeColor( Qt::black );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::AsteriskFill );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::AsteriskFill );
mSimpleMarkerLayer->setSize( 25 );
mSimpleMarkerLayer->setStrokeWidth( 2 );
mSimpleMarkerLayer->setPenJoinStyle( Qt::MiterJoin );
@ -366,7 +366,7 @@ void TestQgsSimpleMarkerSymbol::bounds()
{
mSimpleMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mSimpleMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Circle );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Circle );
mSimpleMarkerLayer->setSize( 5 );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertySize, QgsProperty::fromExpression( QStringLiteral( "min(\"importance\" * 2, 6)" ) ) );
mSimpleMarkerLayer->setStrokeWidth( 0.5 );
@ -382,7 +382,7 @@ void TestQgsSimpleMarkerSymbol::boundsWithOffset()
{
mSimpleMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mSimpleMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Circle );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Circle );
mSimpleMarkerLayer->setSize( 5 );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyOffset, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, '5,10', '10, 5')" ) ) );
mSimpleMarkerLayer->setStrokeWidth( 0.5 );
@ -398,7 +398,7 @@ void TestQgsSimpleMarkerSymbol::boundsWithRotation()
{
mSimpleMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mSimpleMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Square );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Square );
mSimpleMarkerLayer->setSize( 5 );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, QgsProperty::fromExpression( QStringLiteral( "importance * 20" ) ) );
mSimpleMarkerLayer->setStrokeWidth( 0.5 );
@ -414,7 +414,7 @@ void TestQgsSimpleMarkerSymbol::boundsWithRotationAndOffset()
{
mSimpleMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mSimpleMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Square );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Square );
mSimpleMarkerLayer->setSize( 5 );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyOffset, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, '5,10', '10, 5')" ) ) );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyAngle, QgsProperty::fromExpression( QStringLiteral( "heading" ) ) );
@ -437,13 +437,13 @@ void TestQgsSimpleMarkerSymbol::colors()
marker.setFillColor( QColor( 100, 100, 100 ) );
//start with a filled shape - color should be fill color
marker.setShape( QgsSimpleMarkerSymbolLayerBase::Circle );
marker.setShape( Qgis::MarkerShape::Circle );
QCOMPARE( marker.color(), QColor( 100, 100, 100 ) );
marker.setColor( QColor( 150, 150, 150 ) );
QCOMPARE( marker.fillColor(), QColor( 150, 150, 150 ) );
//now try with a non-filled (stroke only) shape - color should be stroke color
marker.setShape( QgsSimpleMarkerSymbolLayerBase::Cross );
marker.setShape( Qgis::MarkerShape::Cross );
QCOMPARE( marker.color(), QColor( 200, 200, 200 ) );
marker.setColor( QColor( 250, 250, 250 ) );
QCOMPARE( marker.strokeColor(), QColor( 250, 250, 250 ) );
@ -453,7 +453,7 @@ void TestQgsSimpleMarkerSymbol::opacityWithDataDefinedColor()
{
mSimpleMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mSimpleMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Square );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Square );
mSimpleMarkerLayer->setSize( 5 );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'red', 'green')" ) ) );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'blue', 'magenta')" ) ) );
@ -471,7 +471,7 @@ void TestQgsSimpleMarkerSymbol::dataDefinedOpacity()
{
mSimpleMarkerLayer->setColor( QColor( 200, 200, 200 ) );
mSimpleMarkerLayer->setStrokeColor( QColor( 0, 0, 0 ) );
mSimpleMarkerLayer->setShape( QgsSimpleMarkerSymbolLayerBase::Square );
mSimpleMarkerLayer->setShape( Qgis::MarkerShape::Square );
mSimpleMarkerLayer->setSize( 5 );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyFillColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'red', 'green')" ) ) );
mSimpleMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyStrokeColor, QgsProperty::fromExpression( QStringLiteral( "if(importance > 2, 'blue', 'magenta')" ) ) );

View File

@ -179,7 +179,7 @@ void TestQgsSymbol::testCanvasClip()
ms.setLayers( QList<QgsMapLayer *>() << mpLinesLayer );
QgsMarkerLineSymbolLayer *markerLine = new QgsMarkerLineSymbolLayer();
markerLine->setPlacement( QgsTemplatedLineSymbolLayerBase::CentralPoint );
markerLine->setPlacement( Qgis::MarkerLinePlacement::CentralPoint );
static_cast< QgsSimpleMarkerSymbolLayer *>( markerLine->subSymbol()->symbolLayer( 0 ) )->setStrokeColor( Qt::black );
QgsLineSymbol *lineSymbol = new QgsLineSymbol();
lineSymbol->changeSymbolLayer( 0, markerLine );