-
Notifications
You must be signed in to change notification settings - Fork 5
/
AddPoint.py
105 lines (83 loc) · 3.28 KB
/
AddPoint.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# -*- coding: utf-8 -*-
'''
Video Uav Tracker v 2.0
Replay a video in sync with a gps track displayed on the map.
-------------------
copyright : (C) 2017 by Salvatore Agosta
email : sagost@katamail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
INSTRUCTION:
Syncing:
- Create new project
- Select video and .gpx track (1 trkpt per second)
- Identify first couple Frame/GpsTime and select it.
- Push Synchronize
- Push Start
Replay:
- Move on map
- Create associated DB shapefile
- Add POI with associated video frame saved
- Extract frames with associated coordinates for rapid photogrammetry use
'''
from qgis.gui import QgsMapTool
from PyQt5.QtGui import QCursor,QPixmap
from PyQt5.QtCore import Qt
class AddPointTool(QgsMapTool):
def __init__(self, canvas, layer,Parent):
QgsMapTool.__init__(self,canvas)
self.Parent = Parent
self.canvas=canvas
self.layer = layer
self.geom = None
self.rb = None
self.x0 = None
self.y0 = None
#our own fancy cursor
self.cursor = QCursor(QPixmap(["16 16 3 1",
" c None",
". c #FF0000",
"+ c #17a51a",
" ",
" +.+ ",
" ++.++ ",
" +.....+ ",
" +. . .+ ",
" +. . .+ ",
" +. . .+ ",
" ++. . .++",
" ... ...+... ...",
" ++. . .++",
" +. . .+ ",
" +. . .+ ",
" ++. . .+ ",
" ++.....+ ",
" ++.++ ",
" +.+ "]))
def canvasPressEvent(self,event):
layer = self.layer
x = event.pos().x()
y = event.pos().y()
point = self.toLayerCoordinates(layer,event.pos())
pointMap = self.toMapCoordinates(layer, point)
self.x0 = pointMap.x()
self.y0 = pointMap.y()
self.Parent.AddPoint(point.x(),point.y())
def canvasMoveEvent(self,event):
pass
def canvasReleaseEvent(self,event):
pass
def showSettingsWarning(self):
pass
def activate(self):
self.canvas.setCursor(self.cursor)
def deactivate(self):
pass
def isZoomTool(self):
return False
def isTransient(self):
return False
def isEditTool(self):
return True