Skip to content

Commit

Permalink
Merge pull request #35110 from obrix/snapping_zoomlvl_optim
Browse files Browse the repository at this point in the history
Snapping enabled on a configurable scale range
  • Loading branch information
3nids committed Apr 7, 2020
2 parents ff380c5 + a7c4bbb commit 6ba8ccc
Show file tree
Hide file tree
Showing 14 changed files with 789 additions and 32 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -684,6 +684,7 @@
<file>themes/default/mIconSnappingArea.svg</file>
<file>themes/default/mIconSnappingCentroid.svg</file>
<file>themes/default/mIconSnappingMiddle.svg</file>
<file>themes/default/mIconSnappingOnScale.svg</file>
<file>themes/default/mIconSnappingVertex.svg</file>
<file>themes/default/mIconSnappingSegment.svg</file>
<file>themes/default/mIconTopologicalEditing.svg</file>
Expand Down
158 changes: 158 additions & 0 deletions images/themes/default/mIconSnappingOnScale.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions python/core/auto_additions/qgssnappingconfig.py
Expand Up @@ -3,3 +3,4 @@
QgsSnappingConfig.SnappingTypes.baseClass = QgsSnappingConfig
QgsSnappingConfig.SnappingTypeFlag.baseClass = QgsSnappingConfig
SnappingTypeFlag = QgsSnappingConfig # dirty hack since SIP seems to introduce the flags in module
QgsSnappingConfig.ScaleDependencyMode.baseClass = QgsSnappingConfig
81 changes: 80 additions & 1 deletion python/core/auto_generated/qgssnappingconfig.sip.in
Expand Up @@ -51,6 +51,13 @@ This is a container for configuration of the snapping of the project
typedef QFlags<QgsSnappingConfig::SnappingTypes> SnappingTypeFlag;


enum ScaleDependencyMode
{
Disabled,
Global,
PerLayer
};

static const QString snappingTypeFlagToString( SnappingTypeFlag type );
%Docstring
Convenient method to returns the translated name of the enum type
Expand Down Expand Up @@ -86,14 +93,16 @@ IndividualLayerSettings
use the method with SnappingTypeFlag instead.
%End

IndividualLayerSettings( bool enabled, SnappingTypeFlag type, double tolerance, QgsTolerance::UnitType units );
IndividualLayerSettings( bool enabled, SnappingTypeFlag type, double tolerance, QgsTolerance::UnitType units, double minScale = 0.0, double maxScale = 0.0 );
%Docstring
IndividualLayerSettings

:param enabled:
:param type:
:param tolerance:
:param units:
:param minScale: 0.0 disable scale limit
:param maxScale: 0.0 disable scale limit

.. versionadded:: 3.12
%End
Expand Down Expand Up @@ -166,6 +175,34 @@ Returns the type of units
void setUnits( QgsTolerance::UnitType units );
%Docstring
Sets the type of units
%End

double minimumScale() const;
%Docstring
Returns minimum scale on which snapping is limited

.. versionadded:: 3.14
%End

void setMinimumScale( double minScale );
%Docstring
Sets the min scale value on which snapping is used, 0.0 disable scale limit

.. versionadded:: 3.14
%End

double maximumScale() const;
%Docstring
Returns max scale on which snapping is limited

.. versionadded:: 3.14
%End

void setMaximumScale( double maxScale );
%Docstring
Sets the max scale value on which snapping is used, 0.0 disable scale limit

.. versionadded:: 3.14
%End

bool operator!= ( const QgsSnappingConfig::IndividualLayerSettings &other ) const;
Expand Down Expand Up @@ -244,6 +281,48 @@ Returns the tolerance
void setTolerance( double tolerance );
%Docstring
Sets the tolerance
%End

double minimumScale() const;
%Docstring
Returns the min scale

.. versionadded:: 3.14
%End

void setMinimumScale( double minScale );
%Docstring
Sets the min scale on which snapping is enabled, 0.0 disable scale limit

.. versionadded:: 3.14
%End

double maximumScale() const;
%Docstring
Returns the max scale

.. versionadded:: 3.14
%End

void setMaximumScale( double maxScale );
%Docstring
Set the max scale on which snapping is enabled, 0.0 disable scale limit

.. versionadded:: 3.14
%End

void setScaleDependencyMode( ScaleDependencyMode mode );
%Docstring
Set the scale dependency mode

.. versionadded:: 3.14
%End

ScaleDependencyMode scaleDependencyMode() const;
%Docstring
Returns the scale dependency mode

.. versionadded:: 3.14
%End

QgsTolerance::UnitType units() const;
Expand Down

0 comments on commit 6ba8ccc

Please sign in to comment.