Skip to content
Permalink
Browse files
Promote some symbol layer enums to enum classes, move to Qgis
  • Loading branch information
nyalldawson committed Oct 22, 2021
1 parent b89cda5 commit fc0d1869bca724e982dede9bf5bb7519c4feaffd
Showing with 1,217 additions and 816 deletions.
  1. +179 −0 python/core/auto_additions/qgis.py
  2. +76 −0 python/core/auto_generated/qgis.sip.in
  3. +100 −56 python/core/auto_generated/symbology/qgsfillsymbollayer.sip.in
  4. +2 −13 python/core/auto_generated/symbology/qgslinesymbollayer.sip.in
  5. +15 −48 python/core/auto_generated/symbology/qgsmarkersymbollayer.sip.in
  6. +1 −1 src/app/decorations/qgsdecorationgrid.cpp
  7. +3 −3 src/core/labeling/qgsvectorlayerlabeling.cpp
  8. +9 −9 src/core/providers/arcgis/qgsarcgisrestutils.cpp
  9. +1 −1 src/core/providers/arcgis/qgsarcgisrestutils.h
  10. +133 −0 src/core/qgis.h
  11. +14 −14 src/core/qgsogrutils.cpp
  12. +43 −43 src/core/symbology/qgsfillsymbollayer.cpp
  13. +125 −64 src/core/symbology/qgsfillsymbollayer.h
  14. +70 −70 src/core/symbology/qgslinesymbollayer.cpp
  15. +4 −18 src/core/symbology/qgslinesymbollayer.h
  16. +79 −79 src/core/symbology/qgsmapinfosymbolconverter.cpp
  17. +199 −199 src/core/symbology/qgsmarkersymbollayer.cpp
  18. +16 −50 src/core/symbology/qgsmarkersymbollayer.h
  19. +1 −1 src/core/symbology/qgsstyle.cpp
  20. +1 −1 src/core/vectortile/qgsmapboxglstyleconverter.cpp
  21. +62 −62 src/gui/symbology/qgssymbollayerwidget.cpp
  22. +1 −1 tests/src/core/testqgsarcgisrestutils.cpp
  23. +7 −7 tests/src/core/testqgsfilledmarker.cpp
  24. +16 −16 tests/src/core/testqgsgradients.cpp
  25. +2 −2 tests/src/core/testqgsmarkerlinesymbol.cpp
  26. +5 −5 tests/src/core/testqgsogrutils.cpp
  27. +52 −52 tests/src/core/testqgssimplemarker.cpp
  28. +1 −1 tests/src/core/testqgssymbol.cpp

Large diffs are not rendered by default.

@@ -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;
@@ -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
Returns the type of gradient, e.g., linear or radial.

.. seealso:: :py:func:`setGradientType`
%End

void setGradientType( Qgis::GradientType gradientType );
%Docstring
Type of gradient, e.g., linear or radial
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 setGradientType( GradientType gradientType );

GradientColorType gradientColorType() const;
void setGradientColorType( Qgis::GradientColorSource gradientColorType );
%Docstring
Gradient color mode, controls how gradient color stops are created
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 );
%Docstring
Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.

.. seealso:: :py:func:`color2`
%End

GradientCoordinateMode coordinateMode() const;
Qgis::SymbolCoordinateReference coordinateMode() const;
%Docstring
Coordinate mode for gradient. Controls how the gradient stops are positioned.
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 setCoordinateMode( GradientCoordinateMode coordinateMode );

GradientSpread gradientSpread() const;
void setGradientSpread( Qgis::GradientSpread gradientSpread );
%Docstring
Gradient spread mode. Controls how the gradient behaves outside of the predefined stops
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.

@@ -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.

0 comments on commit fc0d186

Please sign in to comment.