This class reads the snapping properties from the current project and configures a QgsSnapper to perform the snapping.
More...
#include <qgsmapcanvassnapper.h>
Detailed Description
This class reads the snapping properties from the current project and configures a QgsSnapper to perform the snapping.
Snapping can be done to the active layer (useful for selecting a vertex to manipulate) or to background layers
Constructor & Destructor Documentation
QgsMapCanvasSnapper::QgsMapCanvasSnapper |
( |
QgsMapCanvas * |
canvas | ) |
|
Constructor.
- Parameters
-
canvas | the map canvas to snap to |
QgsMapCanvasSnapper::QgsMapCanvasSnapper |
( |
| ) |
|
QgsMapCanvasSnapper::~QgsMapCanvasSnapper |
( |
| ) |
|
Member Function Documentation
void QgsMapCanvasSnapper::setMapCanvas |
( |
QgsMapCanvas * |
canvas | ) |
|
int QgsMapCanvasSnapper::snapToBackgroundLayers |
( |
const QPoint & |
p, |
|
|
QList< QgsSnappingResult > & |
results, |
|
|
const QList< QgsPoint > & |
excludePoints = QList<QgsPoint>() |
|
) |
| |
Snaps to the background layers.
This method is useful to align the features of the edited layers to those of other layers (as described in the project properties). Uses snap mode QgsSnapper::SnapWithOneResult. Therefore, only the closest result is returned.
- Parameters
-
p | start point of the snap (in pixel coordinates) |
results | snapped points |
excludePoints | a 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 |
- Returns
- 0 in case of success
Does a snap to the current layer.
Uses snap mode QgsSnapper::SnapWithResultsForSamePosition if topological editing is enabled and QgsSnapper::SnapWithOneResult_BY_SEGMENT if not. As this method is usually used to find vertices/segments for editing operations, it uses the search radius for vertex editing from the qgis options.
- Parameters
-
p | start point of the snap (in pixel coordinates) |
results | list to which the results are appended |
snap_to | snap to vertex or to segment |
snappingTol | snapping tolerance. -1 means that the search radius for vertex edits is taken |
excludePoints | a 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 |
The documentation for this class was generated from the following files: