QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
QgsGeometrySnapper allows a geometry to be snapped to the geometries within a different reference layer. More...
#include <qgsgeometrysnapper.h>
Public Types | |
enum | SnapMode { PreferNodes = 0 , PreferClosest , PreferNodesNoExtraVertices , PreferClosestNoExtraVertices , EndPointPreferNodes , EndPointPreferClosest , EndPointToEndPoint } |
Snapping modes. More... | |
Signals | |
void | featureSnapped () |
Emitted each time a feature has been processed when calling snapFeatures() | |
Public Member Functions | |
QgsGeometrySnapper (QgsFeatureSource *referenceSource) | |
Constructor for QgsGeometrySnapper. | |
QgsFeatureList | snapFeatures (const QgsFeatureList &features, double snapTolerance, SnapMode mode=PreferNodes) |
Snaps a set of features to the reference layer and returns the result. | |
QgsGeometry | snapGeometry (const QgsGeometry &geometry, double snapTolerance, SnapMode mode=PreferNodes) const |
Snaps a geometry to the reference layer and returns the result. | |
Static Public Member Functions | |
static QgsGeometry | snapGeometry (const QgsGeometry &geometry, double snapTolerance, const QList< QgsGeometry > &referenceGeometries, SnapMode mode=PreferNodes) |
Snaps a single geometry against a list of reference geometries. | |
QgsGeometrySnapper allows a geometry to be snapped to the geometries within a different reference layer.
Vertices in the geometries will be modified to match the reference layer features within a specified snap tolerance.
Definition at line 41 of file qgsgeometrysnapper.h.
Snapping modes.
Definition at line 47 of file qgsgeometrysnapper.h.
QgsGeometrySnapper::QgsGeometrySnapper | ( | QgsFeatureSource * | referenceSource | ) |
Constructor for QgsGeometrySnapper.
A reference feature source which contains geometries to snap to must be set. It is assumed that all geometries snapped using this object will have the same CRS as the reference source (ie, no reprojection is performed).
Definition at line 299 of file qgsgeometrysnapper.cpp.
|
signal |
Emitted each time a feature has been processed when calling snapFeatures()
QgsFeatureList QgsGeometrySnapper::snapFeatures | ( | const QgsFeatureList & | features, |
double | snapTolerance, | ||
SnapMode | mode = PreferNodes |
||
) |
Snaps a set of features to the reference layer and returns the result.
This operation is multithreaded for performance. The featureSnapped() signal will be emitted each time a feature is processed. The snap tolerance is specified in the layer units for the reference layer.
Definition at line 306 of file qgsgeometrysnapper.cpp.
|
static |
Snaps a single geometry against a list of reference geometries.
Definition at line 364 of file qgsgeometrysnapper.cpp.
QgsGeometry QgsGeometrySnapper::snapGeometry | ( | const QgsGeometry & | geometry, |
double | snapTolerance, | ||
SnapMode | mode = PreferNodes |
||
) | const |
Snaps a geometry to the reference layer and returns the result.
The geometry must be in the same CRS as the reference layer, and must have the same type as the reference layer geometry. The snap tolerance is specified in the layer units for the reference layer.
Definition at line 320 of file qgsgeometrysnapper.cpp.