Skip to content
Permalink
Browse files
Make placement options in marker and hash line symbol layers checkbox…
…es instead of mutually exclusive buttons

Makes it considerably quicker to create a marker line with the
markers on the first AND last vertex, amongst other things...

Fixes #18433

Sponsored by North Road, thanks to SLYR
  • Loading branch information
nyalldawson committed Nov 11, 2021
1 parent 1d01ad1 commit aaafd786dfe2bf89fb933ff72f03cbb515608011
@@ -1040,6 +1040,8 @@
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
Qgis.MarkerLinePlacements.baseClass = Qgis
MarkerLinePlacements = Qgis # dirty hack since SIP seems to introduce the flags in module
QgsGradientFillSymbolLayer.GradientColorType = Qgis.GradientColorSource
# monkey patching scoped based enum
QgsGradientFillSymbolLayer.SimpleTwoColor = Qgis.GradientColorSource.SimpleTwoColor
@@ -668,6 +668,8 @@ The development version
CurvePoint,
SegmentCenter,
};
typedef QFlags<Qgis::MarkerLinePlacement> MarkerLinePlacements;


enum class GradientColorSource
{
@@ -852,6 +854,8 @@ QFlags<Qgis::RenderContextFlag> operator|(Qgis::RenderContextFlag f1, QFlags<Qgi

QFlags<Qgis::VectorLayerTypeFlag> operator|(Qgis::VectorLayerTypeFlag f1, QFlags<Qgis::VectorLayerTypeFlag> f2);

QFlags<Qgis::MarkerLinePlacement> operator|(Qgis::MarkerLinePlacement f1, QFlags<Qgis::MarkerLinePlacement> f2);




@@ -676,18 +676,42 @@ Returns the map unit scale for the interval between symbols.
.. seealso:: :py:func:`interval`
%End

Qgis::MarkerLinePlacement placement() const;
Qgis::MarkerLinePlacement placement() const /Deprecated/;
%Docstring
Returns the placement of the symbols.

.. seealso:: :py:func:`setPlacement`

.. deprecated::
use :py:func:`~QgsTemplatedLineSymbolLayerBase.placements` instead
%End

void setPlacement( Qgis::MarkerLinePlacement placement );
void setPlacement( Qgis::MarkerLinePlacement placement ) /Deprecated/;
%Docstring
Sets the ``placement`` of the symbols.

.. seealso:: :py:func:`placement`

.. deprecated::
use :py:func:`~QgsTemplatedLineSymbolLayerBase.setPlacements` instead
%End

Qgis::MarkerLinePlacements placements() const;
%Docstring
Returns the placement of the symbols.

.. seealso:: :py:func:`setPlacements`

.. versionadded:: 3.24
%End

void setPlacements( Qgis::MarkerLinePlacements placements );
%Docstring
Sets the ``placement`` of the symbols.

.. seealso:: :py:func:`placements`

.. versionadded:: 3.24
%End

double offsetAlongLine() const;
@@ -1058,15 +1058,17 @@ class CORE_EXPORT Qgis
*/
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
Interval = 1 << 0, //!< Place symbols at regular intervals
Vertex = 1 << 1, //!< Place symbols on every vertex in the line
LastVertex = 1 << 2, //!< Place symbols on the last vertex in the line
FirstVertex = 1 << 3, //!< Place symbols on the first vertex in the line
CentralPoint = 1 << 4, //!< Place symbols at the mid point of the line
CurvePoint = 1 << 5, //!< Place symbols at every virtual curve point in the line (used when rendering curved geometry types only)
SegmentCenter = 1 << 6, //!< Place symbols at the center of every line segment
};
Q_ENUM( MarkerLinePlacement )
Q_DECLARE_FLAGS( MarkerLinePlacements, MarkerLinePlacement )
Q_FLAG( MarkerLinePlacements )

/**
* Gradient color sources.
@@ -1362,6 +1364,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::AnnotationItemGuiFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::MapSettingsFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::RenderContextFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::VectorLayerTypeFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::MarkerLinePlacements )


// hack to workaround warnings when casting void pointers
Loading

0 comments on commit aaafd78

Please sign in to comment.