QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Protected Member Functions | List of all members
QgsMapCanvasSnappingUtils Class Reference

Snapping utils instance that is connected to a canvas and updates the configuration (map settings + current layer) whenever that is changed in the canvas. More...

#include <qgsmapcanvassnappingutils.h>

Inheritance diagram for QgsMapCanvasSnappingUtils:
Inheritance graph
[legend]

Public Member Functions

 QgsMapCanvasSnappingUtils (QgsMapCanvas *canvas, QObject *parent=nullptr)
 Construct map canvas snapping utils object. More...
 
- Public Member Functions inherited from QgsSnappingUtils
 QgsSnappingUtils (QObject *parent=nullptr, bool enableSnappingForInvisibleFeature=true)
 Constructor for QgsSnappingUtils. More...
 
 ~QgsSnappingUtils () override
 
void addExtraSnapLayer (QgsVectorLayer *vl)
 Supply an extra snapping layer (typically a memory layer). More...
 
QgsSnappingConfig config () const
 The snapping configuration controls the behavior of this object. More...
 
QgsVectorLayercurrentLayer () const
 The current layer used if mode is SnapCurrentLayer. More...
 
QString dump ()
 Gets extra information about the instance. More...
 
QSet< QgsVectorLayer * > getExtraSnapLayers ()
 Returns the list of extra snapping layers. More...
 
IndexingStrategy indexingStrategy () const
 Find out which strategy is used for indexing - by default hybrid indexing is used. More...
 
QList< QgsSnappingUtils::LayerConfiglayers () const
 Query layers used for snapping. More...
 
QgsPointLocatorlocatorForLayer (QgsVectorLayer *vl)
 Gets a point locator for the given layer. More...
 
QgsMapSettings mapSettings () const
 
void removeExtraSnapLayer (QgsVectorLayer *vl)
 Removes an extra snapping layer. More...
 
void setCurrentLayer (QgsVectorLayer *layer)
 Sets current layer so that if mode is SnapCurrentLayer we know which layer to use. More...
 
void setEnableSnappingForInvisibleFeature (bool enable)
 Set if invisible features must be snapped or not. More...
 
void setIndexingStrategy (IndexingStrategy strategy)
 Sets a strategy for indexing geometry data - determines how fast and memory consuming the data structures will be. More...
 
void setMapSettings (const QgsMapSettings &settings)
 Assign current map settings to the utils - used for conversion between screen coords to map coords. More...
 
QgsPointLocator::Match snapToCurrentLayer (QPoint point, QgsPointLocator::Types type, QgsPointLocator::MatchFilter *filter=nullptr)
 Snap to current layer. More...
 
QgsPointLocator::Match snapToMap (const QgsPointXY &pointMap, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
 Snap to map according to the current configuration. More...
 
QgsPointLocator::Match snapToMap (QPoint point, QgsPointLocator::MatchFilter *filter=nullptr, bool relaxed=false)
 Snap to map according to the current configuration. More...
 

Protected Member Functions

void prepareIndexProgress (int index) override
 Called when finished indexing a layer with snapToMap. When index == count the indexing is complete. More...
 
void prepareIndexStarting (int count) override
 Called when starting to index with snapToMap - can be overridden and e.g. progress dialog can be provided. More...
 
- Protected Member Functions inherited from QgsSnappingUtils
void clearAllLocators ()
 Deletes all existing locators (e.g. when destination CRS has changed and we need to reindex) More...
 
virtual void prepareIndexProgress (int index)
 Called when finished indexing a layer with snapToMap. When index == count the indexing is complete. More...
 
virtual void prepareIndexStarting (int count)
 Called when starting to index with snapToMap - can be overridden and e.g. progress dialog can be provided. More...
 

Additional Inherited Members

- Public Types inherited from QgsSnappingUtils
enum  IndexingStrategy { IndexAlwaysFull , IndexNeverFull , IndexHybrid , IndexExtent }
 
- Public Slots inherited from QgsSnappingUtils
void setConfig (const QgsSnappingConfig &snappingConfig)
 The snapping configuration controls the behavior of this object. More...
 
void toggleEnabled ()
 Toggles the state of snapping. More...
 
- Signals inherited from QgsSnappingUtils
void configChanged (const QgsSnappingConfig &snappingConfig)
 Emitted when the snapping settings object changes. More...
 
- Properties inherited from QgsSnappingUtils
QgsSnappingConfig config
 

Detailed Description

Snapping utils instance that is connected to a canvas and updates the configuration (map settings + current layer) whenever that is changed in the canvas.

Definition at line 32 of file qgsmapcanvassnappingutils.h.

Constructor & Destructor Documentation

◆ QgsMapCanvasSnappingUtils()

QgsMapCanvasSnappingUtils::QgsMapCanvasSnappingUtils ( QgsMapCanvas canvas,
QObject *  parent = nullptr 
)

Construct map canvas snapping utils object.

Parameters
canvasmap canvas
parentparent object if false it will block until indexing is done

Definition at line 25 of file qgsmapcanvassnappingutils.cpp.

Member Function Documentation

◆ prepareIndexProgress()

void QgsMapCanvasSnappingUtils::prepareIndexProgress ( int  index)
overrideprotectedvirtual

Called when finished indexing a layer with snapToMap. When index == count the indexing is complete.

Reimplemented from QgsSnappingUtils.

Definition at line 70 of file qgsmapcanvassnappingutils.cpp.

◆ prepareIndexStarting()

void QgsMapCanvasSnappingUtils::prepareIndexStarting ( int  count)
overrideprotectedvirtual

Called when starting to index with snapToMap - can be overridden and e.g. progress dialog can be provided.

Reimplemented from QgsSnappingUtils.

Definition at line 63 of file qgsmapcanvassnappingutils.cpp.


The documentation for this class was generated from the following files: