QGIS API Documentation
2.0.1-Dufour
|
A class that allows advanced snapping operations on a set of vector layers. More...
#include <qgssnapper.h>
Classes | |
struct | SnapLayer |
Public Types | |
enum | SnappingType { SnapToVertex, SnapToSegment, SnapToVertexAndSegment } |
Snap to vertex, to segment or both. More... | |
enum | SnappingMode { SnapWithOneResult, SnapWithResultsForSamePosition, SnapWithResultsWithinTolerances } |
Public Member Functions | |
QgsSnapper (QgsMapRenderer *mapRender) | |
~QgsSnapper () | |
int | snapPoint (const QPoint &startPoint, QList< QgsSnappingResult > &snappingResult, const QList< QgsPoint > &excludePoints=QList< QgsPoint >()) |
Does the snapping operation. | |
void | setSnapLayers (const QList< QgsSnapper::SnapLayer > &snapLayers) |
void | setSnapMode (QgsSnapper::SnappingMode snapMode) |
Private Member Functions | |
QgsSnapper () | |
Don't use the default constructor. | |
void | cleanResultList (QMultiMap< double, QgsSnappingResult > &list, const QList< QgsPoint > &excludeList) const |
Removes the snapping results that contains points in exclude list. |
Private Attributes | |
QgsMapRenderer * | mMapRenderer |
The maprender object contains information about the output coordinate system of the map and about the relationship between pixel space and map space. | |
QgsSnapper::SnappingMode | mSnapMode |
Snap mode to apply. | |
QList< QgsSnapper::SnapLayer > | mSnapLayers |
List of layers to which snapping is applied. |
A class that allows advanced snapping operations on a set of vector layers.
Definition at line 61 of file qgssnapper.h.
Definition at line 73 of file qgssnapper.h.
Snap to vertex, to segment or both.
Definition at line 65 of file qgssnapper.h.
QgsSnapper::QgsSnapper | ( | QgsMapRenderer * | mapRender | ) |
Definition at line 27 of file qgssnapper.cpp.
QgsSnapper::~QgsSnapper | ( | ) |
Definition at line 37 of file qgssnapper.cpp.
|
private |
Don't use the default constructor.
Definition at line 32 of file qgssnapper.cpp.
|
private |
Removes the snapping results that contains points in exclude list.
Definition at line 135 of file qgssnapper.cpp.
References QgsSnappingResult::snappedVertex, and QgsSnappingResult::snappedVertexNr.
Referenced by snapPoint().
void QgsSnapper::setSnapLayers | ( | const QList< QgsSnapper::SnapLayer > & | snapLayers | ) |
Definition at line 124 of file qgssnapper.cpp.
References mSnapLayers.
Referenced by QgsMapCanvasSnapper::snapToBackgroundLayers(), and QgsMapCanvasSnapper::snapToCurrentLayer().
void QgsSnapper::setSnapMode | ( | QgsSnapper::SnappingMode | snapMode | ) |
Definition at line 130 of file qgssnapper.cpp.
References mSnapMode.
Referenced by QgsMapCanvasSnapper::snapToBackgroundLayers(), and QgsMapCanvasSnapper::snapToCurrentLayer().
int QgsSnapper::snapPoint | ( | const QPoint & | startPoint, |
QList< QgsSnappingResult > & | snappingResult, | ||
const QList< QgsPoint > & | excludePoints = QList<QgsPoint>() |
||
) |
Does the snapping operation.
startPoint | the start point for snapping (in pixel coordinates) |
snappingResult | the list where the results are inserted (everything in map coordinate system) |
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 |
Definition at line 42 of file qgssnapper.cpp.
References QgsSnappingResult::afterVertex, QgsSnappingResult::beforeVertex, cleanResultList(), QgsMapRenderer::coordinateTransform(), QgsMapRenderer::layerToMapCoordinates(), QgsMapRenderer::mapToLayerCoordinates(), mMapRenderer, mSnapLayers, mSnapMode, QgsSnappingResult::snappedVertex, SnapWithOneResult, SnapWithResultsForSamePosition, QgsPoint::sqrDist(), QgsTolerance::toleranceInMapUnits(), and QgsMapToPixel::toMapCoordinates().
Referenced by QgsMapCanvasSnapper::snapToBackgroundLayers(), and QgsMapCanvasSnapper::snapToCurrentLayer().
|
private |
The maprender object contains information about the output coordinate system of the map and about the relationship between pixel space and map space.
Definition at line 118 of file qgssnapper.h.
Referenced by snapPoint().
|
private |
List of layers to which snapping is applied.
Definition at line 122 of file qgssnapper.h.
Referenced by setSnapLayers(), and snapPoint().
|
private |
Snap mode to apply.
Definition at line 120 of file qgssnapper.h.
Referenced by setSnapMode(), and snapPoint().