QGIS API Documentation  2.99.0-Master (b2587b7)
Classes | Public Types | Public Member Functions | List of all members
QgsSnapper Class Reference

A class that allows advanced snapping operations on a set of vector layers. More...

#include <qgssnapper.h>


struct  SnapLayer

Public Types

enum  SnappingMode { SnapWithOneResult, SnapWithResultsForSamePosition, SnapWithResultsWithinTolerances }
enum  SnappingType { SnapToVertex, SnapToSegment, SnapToVertexAndSegment }
 Snap to vertex, to segment or both. More...

Public Member Functions

 QgsSnapper (const QgsMapSettings &mapSettings)
void setSnapLayers (const QList< QgsSnapper::SnapLayer > &snapLayers)
void setSnapMode (QgsSnapper::SnappingMode snapMode)
int snapMapPoint (const QgsPoint &mapCoordPoint, QList< QgsSnappingResult > &snappingResult, const QList< QgsPoint > &excludePoints=QList< QgsPoint >())
 Does the snapping operation. More...

Detailed Description

A class that allows advanced snapping operations on a set of vector layers.

Definition at line 64 of file qgssnapper.h.

Member Enumeration Documentation

§ SnappingMode


Only one snapping result is returned.


Several snapping results which have the same position are returned.

This is useful for topological editing


All results within the given layer tolerances are returned.

Definition at line 76 of file qgssnapper.h.

§ SnappingType

Snap to vertex, to segment or both.


Definition at line 68 of file qgssnapper.h.

Constructor & Destructor Documentation

§ QgsSnapper()

QgsSnapper::QgsSnapper ( const QgsMapSettings mapSettings)

Definition at line 27 of file qgssnapper.cpp.

Member Function Documentation

§ setSnapLayers()

void QgsSnapper::setSnapLayers ( const QList< QgsSnapper::SnapLayer > &  snapLayers)

Definition at line 132 of file qgssnapper.cpp.

§ setSnapMode()

void QgsSnapper::setSnapMode ( QgsSnapper::SnappingMode  snapMode)

Definition at line 138 of file qgssnapper.cpp.

§ snapMapPoint()

int QgsSnapper::snapMapPoint ( const QgsPoint mapCoordPoint,
QList< QgsSnappingResult > &  snappingResult,
const QList< QgsPoint > &  excludePoints = QList<QgsPoint>() 

Does the snapping operation.

mapCoordPointthe start point for snapping (in map coordinates)
snappingResultthe list where the results are inserted (everything in map coordinate system)
excludePointsa list with (map coordinate) points that should be excluded in the snapping result. Useful e.g. for vertex moves where a vertex should not be snapped to its original position
0 in case of success

Definition at line 33 of file qgssnapper.cpp.

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