QGIS/python/core/auto_generated/qgssnappingutils.sip.in

206 lines
6.2 KiB
Plaintext
Raw Normal View History

2017-05-22 09:01:45 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgssnappingutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsSnappingUtils : QObject
{
2017-05-22 09:01:45 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
This class has all the configuration of snapping and can return answers to snapping queries.
Internally, it keeps a cache of QgsPointLocator instances for multiple layers.
2017-05-22 09:01:45 +02:00
2017-12-15 10:36:55 -04:00
Currently it supports the following queries:
- snapToMap() - has multiple modes of operation
- snapToCurrentLayer()
For more complex queries it is possible to use locatorForLayer() method that returns
point locator instance with layer's indexed data.
2017-05-22 09:01:45 +02:00
2017-12-15 10:36:55 -04:00
Indexing strategy determines how fast the queries will be and how much memory will be used.
2017-05-22 09:01:45 +02:00
2017-12-15 10:36:55 -04:00
When working with map canvas, it may be useful to use derived class QgsMapCanvasSnappingUtils
which keeps the configuration in sync with map canvas (e.g. current view, active layer).
2017-05-22 09:01:45 +02:00
.. versionadded:: 2.8
%End
2017-05-22 09:01:45 +02:00
%TypeHeaderCode
#include "qgssnappingutils.h"
%End
public:
QgsSnappingUtils( QObject *parent /TransferThis/ = 0, bool enableSnappingForInvisibleFeature = true,
bool asynchronous = false );
%Docstring
Constructor for QgsSnappingUtils
:param parent: parent object
:param enableSnappingForInvisibleFeature: ``True`` if we want to snap feature even if there are not visible
:param asynchronous: indicated if point locator creation has to be made asynchronously (see :py:class:`QgsPointLocator`())
%End
~QgsSnappingUtils();
QgsPointLocator *locatorForLayer( QgsVectorLayer *vl );
2017-05-22 09:01:45 +02:00
%Docstring
Gets a point locator for the given layer. If such locator does not exist, it will be created
2017-05-22 09:01:45 +02:00
%End
QgsPointLocator::Match snapToMap( QPoint point, QgsPointLocator::MatchFilter *filter = 0 );
2017-05-22 09:01:45 +02:00
%Docstring
Snap to map according to the current configuration. Optional filter allows discarding unwanted matches.
2017-05-22 09:01:45 +02:00
%End
QgsPointLocator::Match snapToMap( const QgsPointXY &pointMap, QgsPointLocator::MatchFilter *filter = 0 );
QgsPointLocator::Match snapToCurrentLayer( QPoint point, QgsPointLocator::Types type, QgsPointLocator::MatchFilter *filter = 0 );
2017-05-22 09:01:45 +02:00
%Docstring
Snap to current layer
2017-05-22 09:01:45 +02:00
%End
void setMapSettings( const QgsMapSettings &settings );
2017-05-22 09:01:45 +02:00
%Docstring
Assign current map settings to the utils - used for conversion between screen coords to map coords
%End
QgsMapSettings mapSettings() const;
void setCurrentLayer( QgsVectorLayer *layer );
2017-05-22 09:01:45 +02:00
%Docstring
Sets current layer so that if mode is SnapCurrentLayer we know which layer to use
2017-05-22 09:01:45 +02:00
%End
QgsVectorLayer *currentLayer() const;
2017-05-22 09:01:45 +02:00
%Docstring
The current layer used if mode is SnapCurrentLayer
%End
enum IndexingStrategy
{
2017-05-22 09:01:45 +02:00
IndexAlwaysFull,
IndexNeverFull,
IndexHybrid,
IndexExtent
};
void setIndexingStrategy( IndexingStrategy strategy );
2017-05-22 09:01:45 +02:00
%Docstring
Sets a strategy for indexing geometry data - determines how fast and memory consuming the data structures will be
2017-05-22 09:01:45 +02:00
%End
IndexingStrategy indexingStrategy() const;
2017-05-22 09:01:45 +02:00
%Docstring
Find out which strategy is used for indexing - by default hybrid indexing is used
%End
struct LayerConfig
{
2017-05-22 09:01:45 +02:00
LayerConfig( QgsVectorLayer *l, QgsPointLocator::Types t, double tol, QgsTolerance::UnitType u );
2017-05-22 09:01:45 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Create a new configuration for a snapping layer.
2017-05-22 09:01:45 +02:00
```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])
```
:param l: The vector layer for which this configuration is
:param t: Which parts of the geometry should be snappable
2017-12-15 10:36:55 -04:00
:param tol: The tolerance radius in which the snapping will trigger
:param u: The unit in which the tolerance is specified
2017-05-22 09:01:45 +02:00
%End
bool operator==( const QgsSnappingUtils::LayerConfig &other ) const;
bool operator!=( const QgsSnappingUtils::LayerConfig &other ) const;
2016-01-11 20:57:28 +01:00
QgsVectorLayer *layer;
2015-09-26 13:21:56 +02:00
QgsPointLocator::Types type;
double tolerance;
QgsTolerance::UnitType unit;
};
QList<QgsSnappingUtils::LayerConfig> layers() const;
2017-05-22 09:01:45 +02:00
%Docstring
Query layers used for snapping
%End
QString dump();
2017-05-22 09:01:45 +02:00
%Docstring
Gets extra information about the instance
2017-12-15 10:36:55 -04:00
2017-05-22 09:01:45 +02:00
.. versionadded:: 2.14
%End
QgsSnappingConfig config() const;
2017-05-22 09:01:45 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
The snapping configuration controls the behavior of this object
2018-03-20 19:08:04 +01:00
%End
void setEnableSnappingForInvisibleFeature( bool enable );
%Docstring
Set if invisible features must be snapped or not.
:param enable: Enable or not this feature
.. versionadded:: 3.2
2017-05-22 09:01:45 +02:00
%End
public slots:
2017-05-22 09:01:45 +02:00
void setConfig( const QgsSnappingConfig &snappingConfig );
2017-05-22 09:01:45 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
The snapping configuration controls the behavior of this object
2017-05-22 09:01:45 +02:00
%End
void toggleEnabled();
2017-05-22 09:01:45 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Toggles the state of snapping
2017-05-22 09:01:45 +02:00
.. versionadded:: 3.0
%End
2016-01-11 20:57:28 +01:00
signals:
2017-05-22 09:01:45 +02:00
void configChanged( const QgsSnappingConfig &snappingConfig );
2017-05-22 09:01:45 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the snapping settings object changes.
2017-05-22 09:01:45 +02:00
%End
2016-01-11 20:57:28 +01:00
protected:
2019-09-03 14:45:42 +02:00
virtual void prepareIndexStarting( int count );
2017-05-22 09:01:45 +02:00
%Docstring
2019-09-03 14:45:42 +02:00
This methods is now deprecated and never called
2017-05-22 09:01:45 +02:00
%End
2019-09-03 14:45:42 +02:00
virtual void prepareIndexProgress( int index );
2017-05-22 09:01:45 +02:00
%Docstring
2019-09-03 14:45:42 +02:00
This methods is now deprecated and never called
%End
void clearAllLocators();
%Docstring
Deletes all existing locators (e.g. when destination CRS has changed and we need to reindex)
2017-05-22 09:01:45 +02:00
%End
};
2017-05-22 09:01:45 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgssnappingutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/