Commit 5d7545c wonder
committed
1 parent 4e8c14e commit 5d7545c Copy full SHA for 5d7545c
File tree 6 files changed +118
-0
lines changed
6 files changed +118
-0
lines changed Original file line number Diff line number Diff line change 15
15
%Include qgsmapcanvasitem.sip
16
16
%Include qgsmapcanvasmap.sip
17
17
%Include qgsmaptool.sip
18
+ %Include qgsmaptoolemitpoint.sip
18
19
%Include qgsmaptoolpan.sip
19
20
%Include qgsmaptoolzoom.sip
20
21
%Include qgsmapoverviewcanvas.sip
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ class QgsMapTool : QObject
10
10
sipClass = sipClass_QgsMapToolZoom;
11
11
else if (dynamic_cast<QgsMapToolPan*>(sipCpp) != NULL)
12
12
sipClass = sipClass_QgsMapToolPan;
13
+ else if (dynamic_cast<QgsMapToolEmitPoint*>(sipCpp) != NULL)
14
+ sipClass = sipClass_QgsMapToolEmitPoint;
13
15
else
14
16
sipClass = NULL;
15
17
%End
Original file line number Diff line number Diff line change
1
+
2
+ class QgsMapToolEmitPoint : QgsMapTool
3
+ {
4
+ %TypeHeaderCode
5
+ #include <qgsmaptoolemitpoint.h>
6
+ %End
7
+
8
+ public:
9
+ //! constructor
10
+ QgsMapToolEmitPoint(QgsMapCanvas* canvas);
11
+
12
+ //! Overridden mouse move event
13
+ virtual void canvasMoveEvent(QMouseEvent * e);
14
+
15
+ //! Overridden mouse press event - emits the signal
16
+ virtual void canvasPressEvent(QMouseEvent * e);
17
+
18
+ //! Overridden mouse release event
19
+ virtual void canvasReleaseEvent(QMouseEvent * e);
20
+
21
+ signals:
22
+
23
+ //! signal emitted on canvas click
24
+ void gotPoint(QgsPoint& point, Qt::MouseButton button);
25
+ };
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ qgsmapcanvasitem.cpp
12
12
qgsmapcanvasmap.cpp
13
13
qgsmapoverviewcanvas.cpp
14
14
qgsmaptool.cpp
15
+ qgsmaptoolemitpoint.cpp
15
16
qgsmaptoolpan.cpp
16
17
qgsmaptoolzoom.cpp
17
18
qgsmessageviewer.cpp
@@ -26,6 +27,7 @@ qgsencodingfiledialog.h
26
27
qgslayerprojectionselector.h
27
28
qgsmapcanvas.h
28
29
qgsmapoverviewcanvas.h
30
+ qgsmaptoolemitpoint.h
29
31
qgsprojectionselector.h
30
32
)
31
33
@@ -81,6 +83,7 @@ qgsmapcanvasitem.h
81
83
qgsmapcanvasmap.h
82
84
qgsmapoverviewcanvas.h
83
85
qgsmaptool.h
86
+ qgsmaptoolemitpoint.h
84
87
qgsmaptoolpan.h
85
88
qgsmaptoolzoom.h
86
89
qgsmessageviewer.h
Original file line number Diff line number Diff line change
1
+ /* **************************************************************************
2
+ qgsmaptoolemitpoint.cpp - map tool that emits a signal on click
3
+ ---------------------
4
+ begin : June 2007
5
+ copyright : (C) 2007 by Martin Dobias
6
+ email : wonder.sk at gmail dot com
7
+ ***************************************************************************
8
+ * *
9
+ * This program is free software; you can redistribute it and/or modify *
10
+ * it under the terms of the GNU General Public License as published by *
11
+ * the Free Software Foundation; either version 2 of the License, or *
12
+ * (at your option) any later version. *
13
+ * *
14
+ ***************************************************************************/
15
+ /* $Id$ */
16
+
17
+
18
+ #include " qgsmaptoolemitpoint.h"
19
+ #include " qgsmapcanvas.h"
20
+
21
+
22
+ QgsMapToolEmitPoint::QgsMapToolEmitPoint (QgsMapCanvas* canvas)
23
+ : QgsMapTool(canvas)
24
+ {
25
+ }
26
+
27
+ void QgsMapToolEmitPoint::canvasMoveEvent (QMouseEvent * e)
28
+ {
29
+ }
30
+
31
+ void QgsMapToolEmitPoint::canvasPressEvent (QMouseEvent * e)
32
+ {
33
+ QgsPoint pnt = toMapCoords (e->pos ());
34
+ emit gotPoint (pnt, e->button ());
35
+ }
36
+
37
+ void QgsMapToolEmitPoint::canvasReleaseEvent (QMouseEvent * e)
38
+ {
39
+ }
Original file line number Diff line number Diff line change
1
+ /* **************************************************************************
2
+ qgsmaptoolemitpoint.h - map tool that emits a signal on click
3
+ ---------------------
4
+ begin : June 2007
5
+ copyright : (C) 2007 by Martin Dobias
6
+ email : wonder.sk at gmail dot com
7
+ ***************************************************************************
8
+ * *
9
+ * This program is free software; you can redistribute it and/or modify *
10
+ * it under the terms of the GNU General Public License as published by *
11
+ * the Free Software Foundation; either version 2 of the License, or *
12
+ * (at your option) any later version. *
13
+ * *
14
+ ***************************************************************************/
15
+ /* $Id$ */
16
+
17
+ #ifndef QGSMAPTOOLEMITPOINT_H
18
+ #define QGSMAPTOOLEMITPOINT_H
19
+
20
+ #include " qgspoint.h"
21
+ #include " qgsmaptool.h"
22
+ class QgsMapCanvas ;
23
+
24
+
25
+ class GUI_EXPORT QgsMapToolEmitPoint : public QgsMapTool
26
+ {
27
+ Q_OBJECT
28
+
29
+ public:
30
+ // ! constructor
31
+ QgsMapToolEmitPoint (QgsMapCanvas* canvas);
32
+
33
+ // ! Overridden mouse move event
34
+ virtual void canvasMoveEvent (QMouseEvent * e);
35
+
36
+ // ! Overridden mouse press event - emits the signal
37
+ virtual void canvasPressEvent (QMouseEvent * e);
38
+
39
+ // ! Overridden mouse release event
40
+ virtual void canvasReleaseEvent (QMouseEvent * e);
41
+
42
+ signals:
43
+
44
+ // ! signal emitted on canvas click
45
+ void gotPoint (QgsPoint& point, Qt::MouseButton button);
46
+ };
47
+
48
+ #endif
You can’t perform that action at this time.
0 commit comments