示例#1
0
	def removePathPreviews(self):
		"""Remove recorded path previews from the map canvas"""
		for rb in self.previousPaths:
			self.canvas.scene().removeItem(rb)
		SourcePlugins.callMethodOnEach("clearMapCanvasItems", ())
		self.previousPaths=[]
		self.canvas.refresh()
示例#2
0
	def terminateAndCleanup(self):
		"""Stop gathering process."""
		self.msleep(500) #fixes video crashing when stopped immediately after start; TODO: do it better
		SourcePlugins.callMethodOnEach("stopRecording", ())
		
		self.controller.gpsDaemon.stopRecording()
		self.disconnect(self.controller.gpsDaemon, SIGNAL("newTrackPoint(PyQt_PyObject)"), self.onNewTrackPoint)
		
		self.alive=False
示例#3
0
	def initialize(self):
		"""Initializes data gathering."""
		self.outputDirectory=self.getDataDirectory()
		
		SourcePlugins.callMethodOnEach("startRecording", (self.outputDirectory,))

		self.controller.gpsDaemon.startRecording(self.outputDirectory+"nmea.log", self.outputDirectory+"path.gpx")
		
		self.connect(self.controller.gpsDaemon, SIGNAL("newTrackPoint(PyQt_PyObject)"), self.onNewTrackPoint)
示例#4
0
	def run(self):
		"""Main execution method, that periodically polls for data."""
		self.stopMe=0
		
		while (self.stopMe==0) and self.controller.gpsDaemon.ok():
			QThread.msleep(50)
			SourcePlugins.callMethodOnEach("pollRecording", ())
		
		#let the caller know we finished
		self.emit(SIGNAL("gathererEvent(PyQt_PyObject)"), ("recordingTerminated", self.stopMe))
示例#5
0
    def run(self):
        """Main execution method, that periodically polls for data."""
        self.stopMe = 0

        while (self.stopMe == 0) and self.controller.gpsDaemon.ok():
            QThread.msleep(50)
            SourcePlugins.callMethodOnEach("pollRecording", ())

        #let the caller know we finished
        self.emit(SIGNAL("gathererEvent(PyQt_PyObject)"),
                  ("recordingTerminated", self.stopMe))
示例#6
0
    def terminateAndCleanup(self):
        """Stop gathering process."""
        self.msleep(
            500
        )  #fixes video crashing when stopped immediately after start; TODO: do it better
        SourcePlugins.callMethodOnEach("stopRecording", ())

        self.controller.gpsDaemon.stopRecording()
        self.disconnect(self.controller.gpsDaemon,
                        SIGNAL("newTrackPoint(PyQt_PyObject)"),
                        self.onNewTrackPoint)

        self.alive = False
示例#7
0
    def initialize(self):
        """Initializes data gathering."""
        self.outputDirectory = self.getDataDirectory()

        SourcePlugins.callMethodOnEach("startRecording",
                                       (self.outputDirectory, ))

        self.controller.gpsDaemon.startRecording(
            self.outputDirectory + "nmea.log",
            self.outputDirectory + "path.gpx")

        self.connect(self.controller.gpsDaemon,
                     SIGNAL("newTrackPoint(PyQt_PyObject)"),
                     self.onNewTrackPoint)
示例#8
0
	def initGui(self):
		""" Initialize plugin's UI """

		self.initLogging()
		self.recording=False
		self.loadPlugins()
		self.loadConfiguration()
		self.rubberBand=None
		self.lastPosition=None
		self.timer=None
		self.previousPaths=[] #previews of previously recorded paths
		
		self.gpsDaemon=GpsDaemon(self, self)
		self.canvas=self.iface.mapCanvas()
		
		self.gatherer=None
		self.dockWidget=None
		self.dockWidget_simple=None
    
		self.dockWidget=DockWidget(self)
		self.dockWidget_simple=DockWidget_simple(self)
		
		self.actionDockWidget=QAction("Show Gatherer dock widget",self.iface.mainWindow())
		self.actionDockWidget.setCheckable(True)
		QObject.connect(self.actionDockWidget, SIGNAL("triggered()"), self.showHideDockWidget)
		self.iface.addPluginToMenu("Qgis-&mapper", self.actionDockWidget)
		QObject.connect(self.dockWidget, SIGNAL("visibilityChanged(bool)"), lambda : self.__dockwidgetVisibilityChanged(0))
		QObject.connect(self.dockWidget_simple, SIGNAL("visibilityChanged(bool)"), lambda : self.__dockwidgetVisibilityChanged(1))
		
		SourcePlugins.initializeUI(self.dockWidget.dataInputPlugins_tabWidget)
		
		self.curDockWidget=None
		self.showInterface(self.interface_simple)
		
		self.canvas=self.iface.mapCanvas()
		self.positionMarker=PositionMarker(self.canvas)
		self.connect(self.gpsDaemon, SIGNAL("newTrackPoint(PyQt_PyObject)"), self.gotNewTrackPoint)
示例#9
0
	def unload(self):
		""" Cleanup and unload the plugin """

		self.canvas.scene().removeItem(self.positionMarker)
		self.positionMarker=None
		
		if self.recording:
			self.recordingStop()
		
		self.saveConfiguration()
		SourcePlugins.unloadPlugins()

		self.gpsDaemon.terminate()
		
		self.dockWidget.unload()
		self.showInterface(None)
		
		del self.dockWidget
		del self.dockWidget_simple
		
		self.iface.removePluginMenu("Qgis-&mapper",self.actionDockWidget)
		del self.actionDockWidget
		
		logging.debug("Plugin terminated.")
示例#10
0
	def loadPlugins(self):
		"""Load all existing plugins"""
		SourcePlugins.loadPlugins(self)