Skip to content

Commit

Permalink
Make placement options in marker and hash line symbol layers checkbox…
Browse files Browse the repository at this point in the history
…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 aaafd78
Show file tree
Hide file tree
Showing 16 changed files with 338 additions and 294 deletions.
2 changes: 2 additions & 0 deletions python/core/auto_additions/qgis.py
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions python/core/auto_generated/qgis.sip.in
Expand Up @@ -668,6 +668,8 @@ The development version
CurvePoint,
SegmentCenter,
};
typedef QFlags<Qgis::MarkerLinePlacement> MarkerLinePlacements;


enum class GradientColorSource
{
Expand Down Expand Up @@ -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);




Expand Down
28 changes: 26 additions & 2 deletions python/core/auto_generated/symbology/qgslinesymbollayer.sip.in
Expand Up @@ -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;
Expand Down
17 changes: 10 additions & 7 deletions src/core/qgis.h
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit aaafd78

Please sign in to comment.