Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix PyQgsLayerDependencies test and add some doc.
  • Loading branch information
obrix committed Apr 7, 2020
1 parent 6b9fb08 commit 30a52ac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions python/core/auto_generated/qgssnappingconfig.sip.in
Expand Up @@ -81,8 +81,8 @@ IndividualLayerSettings
:param type:
:param tolerance:
:param units:
:param minScale:
:param maxScale:
:param minScale: 0.0 disable scale limit
:param maxScale: 0.0 disable scale limit

.. deprecated:: QGIS 3.12
use the method with SnappingTypeFlag instead.
Expand All @@ -96,8 +96,8 @@ IndividualLayerSettings
:param type:
:param tolerance:
:param units:
:param minScale:
:param maxScale:
:param minScale: 0.0 disable scale limit
:param maxScale: 0.0 disable scale limit

.. versionadded:: 3.12
%End
Expand Down Expand Up @@ -179,7 +179,7 @@ Returns min scale on which snapping is limited

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

double maxScale() const;
Expand All @@ -189,7 +189,7 @@ Returns max scale on which snapping is limite

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

bool operator!= ( const QgsSnappingConfig::IndividualLayerSettings &other ) const;
Expand Down Expand Up @@ -277,7 +277,7 @@ Returns the min scale

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

double maxScale() const;
Expand All @@ -287,7 +287,7 @@ Returns the max scale

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

bool limitToScale() const;
Expand All @@ -297,7 +297,7 @@ Returns limit to scale

void setLimitToScale( bool pLimitSnapping );
%Docstring
Set limit to scale
Set limit to scale, true means snapping will be limited to the [minScale, maxScale] range
%End

QgsTolerance::UnitType units() const;
Expand Down
22 changes: 11 additions & 11 deletions src/core/qgssnappingconfig.h
Expand Up @@ -116,8 +116,8 @@ class CORE_EXPORT QgsSnappingConfig
* \param type
* \param tolerance
* \param units
* \param minScale
* \param maxScale
* \param minScale 0.0 disable scale limit
* \param maxScale 0.0 disable scale limit
* \deprecated since QGIS 3.12 use the method with SnappingTypeFlag instead.
*/
Q_DECL_DEPRECATED IndividualLayerSettings( bool enabled, SnappingType type, double tolerance, QgsTolerance::UnitType units, double minScale, double maxScale ) SIP_DEPRECATED;
Expand All @@ -128,8 +128,8 @@ class CORE_EXPORT QgsSnappingConfig
* \param type
* \param tolerance
* \param units
* \param minScale
* \param maxScale
* \param minScale 0.0 disable scale limit
* \param maxScale 0.0 disable scale limit
* \since QGIS 3.12
*/
IndividualLayerSettings( bool enabled, SnappingTypeFlag type, double tolerance, QgsTolerance::UnitType units, double minScale, double maxScale );
Expand Down Expand Up @@ -187,13 +187,13 @@ class CORE_EXPORT QgsSnappingConfig
//! Returns min scale on which snapping is limited
double minScale() const;

//! Sets the min scale value on which snapping is used
//! Sets the min scale value on which snapping is used, 0.0 disable scale limit
void setMinScale( double p_minScale );

//! Returns max scale on which snapping is limite
double maxScale() const;

//! Sets the max scale value on which snapping is used
//! Sets the max scale value on which snapping is used, 0.0 disable scale limit
void setMaxScale( double p_maxScale );

/**
Expand All @@ -209,8 +209,8 @@ class CORE_EXPORT QgsSnappingConfig
SnappingTypeFlag mType = VertexFlag;
double mTolerance = 0;
QgsTolerance::UnitType mUnits = QgsTolerance::Pixels;
double mMinScale = -1.0;
double mMaxScale = -1.0;
double mMinScale = 0.0;
double mMaxScale = 0.0;
};

/**
Expand Down Expand Up @@ -268,19 +268,19 @@ class CORE_EXPORT QgsSnappingConfig
//! Returns the min scale
double minScale() const;

//! Sets the min scale
//! Sets the min scale on which snapping is enabled, 0.0 disable scale limit
void setMinScale( double pMinScale );

//! Returns the max scale
double maxScale() const;

//! Set the max scale
//! Set the max scale on which snapping is enabled, 0.0 disable scale limit
void setMaxScale( double pMaxScale );

//! Returns limit to scale
bool limitToScale() const;

//! Set limit to scale
//! Set limit to scale, true means snapping will be limited to the [minScale, maxScale] range
void setLimitToScale( bool pLimitSnapping );

//! Returns the type of units
Expand Down
8 changes: 4 additions & 4 deletions tests/src/python/test_layer_dependencies.py
Expand Up @@ -113,7 +113,7 @@ def test_resetSnappingIndex(self):
cfg.setMode(QgsSnappingConfig.AdvancedConfiguration)
cfg.setIndividualLayerSettings(self.pointsLayer,
QgsSnappingConfig.IndividualLayerSettings(True,
QgsSnappingConfig.Vertex, 20, QgsTolerance.Pixels))
QgsSnappingConfig.Vertex, 20, QgsTolerance.Pixels, 0.0, 0.0))
u.setConfig(cfg)

m = u.snapToMap(QPoint(95, 100))
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_resetSnappingIndex(self):
# test chained layer dependencies A -> B -> C
cfg.setIndividualLayerSettings(self.pointsLayer2,
QgsSnappingConfig.IndividualLayerSettings(True,
QgsSnappingConfig.Vertex, 20, QgsTolerance.Pixels))
QgsSnappingConfig.Vertex, 20, QgsTolerance.Pixels, 0.0, 0.0))
u.setConfig(cfg)
self.pointsLayer.setDependencies([QgsMapLayerDependency(self.linesLayer.id())])
self.pointsLayer2.setDependencies([QgsMapLayerDependency(self.pointsLayer.id())])
Expand Down Expand Up @@ -304,10 +304,10 @@ def test_signalConnection(self):
cfg.setMode(QgsSnappingConfig.AdvancedConfiguration)
cfg.setIndividualLayerSettings(self.pointsLayer,
QgsSnappingConfig.IndividualLayerSettings(True,
QgsSnappingConfig.Vertex, 20, QgsTolerance.Pixels))
QgsSnappingConfig.Vertex, 20, QgsTolerance.Pixels, 0.0, 0.0))
cfg.setIndividualLayerSettings(self.pointsLayer2,
QgsSnappingConfig.IndividualLayerSettings(True,
QgsSnappingConfig.Vertex, 20, QgsTolerance.Pixels))
QgsSnappingConfig.Vertex, 20, QgsTolerance.Pixels, 0.0, 0.0))
u.setConfig(cfg)
# add another line
f = QgsFeature(self.linesLayer.fields())
Expand Down

0 comments on commit 30a52ac

Please sign in to comment.