-
Notifications
You must be signed in to change notification settings - Fork 5
/
VideoGis_dockwidget.py
120 lines (91 loc) · 3.89 KB
/
VideoGis_dockwidget.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# -*- 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 : [email protected]
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
'''
import os
import sys
from PyQt5 import QtGui, uic , QtWidgets
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QFileDialog
from NewProject import NewProject
from QGisMap import QGisMap
import resources
FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'VideoGis_dockwidget_base.ui'), resource_suffix='')
class VideoGisDockWidget(QtWidgets.QDockWidget, FORM_CLASS):
closingPlugin = pyqtSignal()
def __init__(self,iface, parent=None):
"""Constructor."""
super(VideoGisDockWidget, self).__init__(parent)
# Set up the user interface from Designer.
# After setupUI you can access any designer object by doing
# self.<objectname>, and you can use autoconnect slots - see
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
# #widgets-and-dialogs-with-auto-connect
self.setupUi(self)
self.iface = iface
self.pushButton_2.setEnabled(False)
self.lineEdit_2.setEnabled(False)
self.pushButton_8.clicked.connect(self.close)
self.pushButton_7.clicked.connect(self.NewProj)
self.pushButton_5.clicked.connect(self.LoadProj)
self.pushButton_2.clicked.connect(self.Start)
self.QGisMapWindow = None
self.NewProjectWindow = None
self.groupBox.hide()
def closeEvent(self, event):
if self.QGisMapWindow != None:
self.QGisMapWindow.close()
if self.NewProjectWindow != None:
self.NewProjectWindow.close()
self.closingPlugin.emit()
event.accept()
def NewProj(self):
self.projectfile = None
self.pushButton_2.setEnabled(False)
self.lineEdit_2.clear()
projectfile, _ = QFileDialog.getSaveFileName(caption = 'Save Project file', filter = "Video UAV Tracker Prj (*.vgp)")
if projectfile:
self.NewProjectWindow = NewProject(projectfile,self)
#self.NewProjectWindow.setWindowModality(2)
self.NewProjectWindow.show()
def LoadProjFromNew(self,VutPrj):
self.NewProjectWindow = None
self.lineEdit_2.setText(VutPrj)
self.projectfile = VutPrj
self.pushButton_2.setEnabled(True)
def LoadProj(self):
self.pushButton_2.setEnabled(False)
self.lineEdit_2.clear()
self.projectfile, _ = QFileDialog.getOpenFileName(caption = "Select Video UAV Tracker Prj",filter = "Video UAV Tracker Prj (*.vgp)")
if self.projectfile != '':
with open(self.projectfile,'r') as File:
for line in File:
if line[0:23] == 'Video start at msecond:':
self.lineEdit_2.setText(self.projectfile)
self.pushButton_2.setEnabled(True)
break
def Start(self):
self.QGisMapWindow = QGisMap(self.projectfile,self)
#self.QGisMapWindow.setWindowModality(2)
self.QGisMapWindow.show()