Skip to content

Commit

Permalink
[FEATURE][symbology] Add options to dynamically tweak dash pattern
Browse files Browse the repository at this point in the history
in simple line symbol layers

New options are:

- Align dash pattern to line length: If checked, the dash pattern lengths
will be subtely adjusted in order to ensure that when a line is rendered
it will end with a complete dash element, instead of a gap element or
partial dash element

- Tweak dash pattern at sharp corners: If checked, this option dynamically
adjusts the dash pattern placement so that sharp corners are represented
by a full dash element coming into and out of the sharp corner. It's designed
to better represent the underlying geometry while rendering dashed lines,
especially for jagged lines
  • Loading branch information
nyalldawson committed Jul 24, 2020
1 parent 0641f3f commit 75635db
Show file tree
Hide file tree
Showing 5 changed files with 666 additions and 185 deletions.
58 changes: 58 additions & 0 deletions python/core/auto_generated/symbology/qgslinesymbollayer.sip.in
Expand Up @@ -311,6 +311,64 @@ This setting only has an effect when the line symbol is being
used to render polygon rings.

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

bool alignDashPattern() const;
%Docstring
Returns ``True`` if dash patterns should be aligned to the start and end of lines, by
applying subtle tweaks to the pattern sizing in order to ensure that the end of
a line is represented by a complete dash element.

.. seealso:: :py:func:`setAlignDashPattern`

.. seealso:: :py:func:`tweakDashPatternOnCorners`

.. versionadded:: 3.16
%End

void setAlignDashPattern( bool enabled );
%Docstring
Sets whether dash patterns should be aligned to the start and end of lines, by
applying subtle tweaks to the pattern sizing in order to ensure that the end of
a line is represented by a complete dash element.

.. seealso:: :py:func:`alignDashPattern`

.. seealso:: :py:func:`setTweakDashPatternOnCorners`

.. versionadded:: 3.16
%End

bool tweakDashPatternOnCorners() const;
%Docstring
Returns ``True`` if dash patterns tweaks should be applied on sharp corners, to ensure
that a double-length dash is drawn running into and out of the corner.

.. note::

This setting is only applied if :py:func:`~QgsSimpleLineSymbolLayer.alignDashPattern` is ``True``.

.. seealso:: :py:func:`setTweakDashPatternOnCorners`

.. seealso:: :py:func:`alignDashPattern`

.. versionadded:: 3.16
%End

void setTweakDashPatternOnCorners( bool enabled );
%Docstring
Sets whether dash patterns tweaks should be applied on sharp corners, to ensure
that a double-length dash is drawn running into and out of the corner.

.. note::

This setting is only applied if :py:func:`~QgsSimpleLineSymbolLayer.alignDashPattern` is ``True``.

.. seealso:: :py:func:`tweakDashPatternOnCorners`

.. seealso:: :py:func:`setAlignDashPattern`

.. versionadded:: 3.16
%End

};
Expand Down

0 comments on commit 75635db

Please sign in to comment.