mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Minor fixes and doxymentation for QgsSnappingUtils
This commit is contained in:
parent
318a835039
commit
dab157f70f
@ -29,11 +29,11 @@ class QgsPointLocator : QObject
|
||||
|
||||
enum Type
|
||||
{
|
||||
Invalid,
|
||||
Vertex,
|
||||
Edge,
|
||||
Area,
|
||||
All
|
||||
Invalid = 0, //!< Invalid
|
||||
Vertex = 1, //!< Snapped to a vertex. Can be a vertex of the geometry or an intersection.
|
||||
Edge = 2, //!< Snapped to an edge
|
||||
Area = 4, //!< Snapped to an area
|
||||
All = 7 //!< Combination of vertex, edge and area
|
||||
};
|
||||
|
||||
typedef QFlags<QgsPointLocator::Type> Types;
|
||||
|
@ -69,7 +69,7 @@ class QgsSnappingUtils : QObject
|
||||
*/
|
||||
struct LayerConfig
|
||||
{
|
||||
LayerConfig( QgsVectorLayer* l, const QgsPointLocator::Types& t, double tol, QgsTolerance::UnitType u );
|
||||
LayerConfig( QgsVectorLayer* l, QgsPointLocator::Types t, double tol, QgsTolerance::UnitType u );
|
||||
|
||||
bool operator==( const QgsSnappingUtils::LayerConfig& other ) const;
|
||||
bool operator!=( const QgsSnappingUtils::LayerConfig& other ) const;
|
||||
|
@ -77,10 +77,10 @@ class CORE_EXPORT QgsPointLocator : public QObject
|
||||
*/
|
||||
enum Type
|
||||
{
|
||||
Invalid = 0, //!< Invalid
|
||||
Vertex = 1, //!< Snapped to a vertex. Can be a vertex of the geometry or an intersection.
|
||||
Edge = 2, //!< Snapped to an edge
|
||||
Area = 4, //!< Snapped to an area
|
||||
Invalid = 0, //!< Invalid
|
||||
Vertex = 1, //!< Snapped to a vertex. Can be a vertex of the geometry or an intersection.
|
||||
Edge = 2, //!< Snapped to an edge
|
||||
Area = 4, //!< Snapped to an area
|
||||
All = Vertex | Edge | Area //!< Combination of vertex, edge and area
|
||||
};
|
||||
|
||||
|
@ -90,7 +90,7 @@ class CORE_EXPORT QgsProject : public QObject
|
||||
|
||||
/** Sets the project's title.
|
||||
* @param title new title
|
||||
* @note added in 2.4
|
||||
* @note added in 2.4
|
||||
* @see title()
|
||||
*/
|
||||
void setTitle( const QString& title );
|
||||
|
@ -65,6 +65,7 @@ class CORE_EXPORT QgsSnappingUtils : public QObject
|
||||
|
||||
/** Set current layer so that if mode is SnapCurrentLayer we know which layer to use */
|
||||
void setCurrentLayer( QgsVectorLayer* layer );
|
||||
/** The current layer used if mode is SnapCurrentLayer */
|
||||
QgsVectorLayer* currentLayer() const { return mCurrentLayer; }
|
||||
|
||||
|
||||
@ -105,7 +106,25 @@ class CORE_EXPORT QgsSnappingUtils : public QObject
|
||||
*/
|
||||
struct LayerConfig
|
||||
{
|
||||
LayerConfig( QgsVectorLayer* l, const QgsPointLocator::Types& t, double tol, QgsTolerance::UnitType u )
|
||||
/**
|
||||
* Create a new configuration for a snapping layer.
|
||||
|
||||
```py
|
||||
snapper = QgsMapCanvasSnappingUtils(mapCanvas)
|
||||
|
||||
snapping_layer1 = QgsSnappingUtils.LayerConfig(layer1, QgsPointLocator.Vertex, 10, QgsTolerance.Pixels)
|
||||
snapping_layer2 = QgsSnappingUtils.LayerConfig(layer2, QgsPointLocator.Vertex and QgsPointLocator.Edge, 10, QgsTolerance.Pixels)
|
||||
|
||||
snapper.setLayers([snapping_layer1, snapping_layer2])
|
||||
snapper.setSnapToMapMode(QgsSnappingUtils.SnapAdvanced)
|
||||
```
|
||||
|
||||
* @param l The vector layer for which this configuration is
|
||||
* @param t Which parts of the geometry should be snappable
|
||||
* @param tol The tolerance radius in which the snapping will trigger
|
||||
* @param u The unit in which the tolerance is specified
|
||||
*/
|
||||
LayerConfig( QgsVectorLayer* l, QgsPointLocator::Types t, double tol, QgsTolerance::UnitType u )
|
||||
: layer( l )
|
||||
, type( t )
|
||||
, tolerance( tol )
|
||||
|
Loading…
x
Reference in New Issue
Block a user