QGIS API Documentation  2.99.0-Master (0a63d1f)
qgsmapcanvassnapper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmapcanvassnapper.h
3  ---------------------
4  begin : June 21, 2007
5  copyright : (C) 2007 by Marco Hugentobler
6  email : marco dot hugentobler at karto dot baug dot ethz dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSMAPCANVASSNAPPER_H
19 #define QGSMAPCANVASSNAPPER_H
20 
21 #include <QList>
22 #include "qgssnapper.h"
23 #include "qgis_gui.h"
24 
25 class QgsMapCanvas;
26 class QPoint;
27 
34 class GUI_EXPORT QgsMapCanvasSnapper
35 {
36  public:
37 
41 
43 
45 
47  QgsMapCanvasSnapper( const QgsMapCanvasSnapper& rh ) = delete;
49  QgsMapCanvasSnapper& operator=( const QgsMapCanvasSnapper& rh ) = delete;
50 
63  int snapToCurrentLayer( QPoint p, QList<QgsSnappingResult>& results, QgsSnapper::SnappingType snap_to, double snappingTol = -1, const QList<QgsPoint>& excludePoints = QList<QgsPoint>(), bool allResutInTolerance = false );
64 
74  int snapToBackgroundLayers( QPoint p, QList<QgsSnappingResult>& results, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );
75 
76  // @note not available in python bindings
77  int snapToBackgroundLayers( const QgsPoint& point, QList<QgsSnappingResult>& results, const QList<QgsPoint>& excludePoints = QList<QgsPoint>() );
78 
79  void setMapCanvas( QgsMapCanvas* canvas );
80 
81  private:
83  QgsMapCanvas* mMapCanvas;
85  QgsSnapper* mSnapper;
86 
87 };
88 
89 #endif
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
SnappingType
Snap to vertex, to segment or both.
Definition: qgssnapper.h:72
A class that allows advanced snapping operations on a set of vector layers.
Definition: qgssnapper.h:68
A class to represent a point.
Definition: qgspoint.h:143
This class reads the snapping properties from the current project and configures a QgsSnapper to perf...