-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathUtils.py
32 lines (29 loc) · 888 Bytes
/
Utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from qgis.core import *
from qgis.gui import *
from qgis.PyQt.QtCore import QPoint
class ClickTool(QgsMapTool):
def __init__(self, iface, callback):
QgsMapTool.__init__(self,iface.mapCanvas())
self.iface = iface
self.callback = callback
self.canvas = iface.mapCanvas()
self.drugging = False
return None
def canvasPressEvent(self,e):
self.drugging = True
point = QPoint(e.pos().x(),e.pos().y())
self.callback(point)
return None
'''
def canvasMoveEvent(self,e):
if self.drugging == False:
return None
point = QPoint(e.pos().x(),e.pos().y())
self.callback(point)
return None
def canvasReleaseEvent(self,e):
point = QPoint(e.pos().x(),e.pos().y())
self.callback(point)
self.drugging = False
return None
'''