def initGui(self): """Create the menu entries and toolbar icons inside the QGIS GUI.""" icon_path = os.path.join(self.plugin_dir,"lib","icoAnaglyph.png") self.add_action( icon_path, text=self.tr(u'Visual surveys'), callback=self.run, parent=self.iface.mainWindow()) self.wdg = stereoSurveysDialog() self.apdockwidget=QDockWidget("stereoSurveys" , self.iface.mainWindow() ) self.apdockwidget.setObjectName("stereoSurveys") self.apdockwidget.setWidget(self.wdg) self.apdockwidget.setAllowedAreas(Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea) self.iface.addDockWidget( Qt.TopDockWidgetArea, self.apdockwidget) self.apdockwidget.update() #defaults self.actualPointDx = None self.actualPointSx = None self.intersectionPoint = QgsPoint(0,0) self.actualLocDx = {"lat":0.0,"lon":0.0,"heading":0.0} self.actualLocSx = {"lat":0.0,"lon":0.0,"heading":0.0} self.pressed = None self.updateCalibration(0,0) self.googleCameraHeight = 3 #network connections self.wdg.webViewSx.page().setNetworkAccessManager(QgsNetworkAccessManager.instance()) self.wdg.webViewDx.page().setNetworkAccessManager(QgsNetworkAccessManager.instance()) self.wdg.webViewPlan.page().setNetworkAccessManager(QgsNetworkAccessManager.instance()) #signals self.wdg.pushButton.clicked.connect(self.digitize) self.wdg.webViewSx.page().statusBarMessage.connect(self.catchJSeventsSx) self.wdg.webViewDx.page().statusBarMessage.connect(self.catchJSeventsDx) self.wdg.webViewPlan.page().statusBarMessage.connect(self.catchJSeventsCx) self.wdg.correzioneSx.textEdited.connect(self.correggi) self.wdg.correzioneDx.textEdited.connect(self.correggi) self.wdg.pushButtonDx.clicked.connect(self.setViewDx) self.wdg.pushButtonSx.clicked.connect(self.setViewSx) self.wdg.acquireButtonDx.clicked.connect(self.acquireDx) self.wdg.acquireButtonSx.clicked.connect(self.acquireSx) #startup self.defaults()
def __init__(self, iface): """Constructor. :param iface: An interface instance that will be passed to this class which provides the hook by which you can manipulate the QGIS application at run time. :type iface: QgsInterface """ # Save reference to the QGIS interface self.iface = iface # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'stereoSurveys_{}.qm'.format(locale)) if os.path.exists(locale_path): self.translator = QTranslator() self.translator.load(locale_path) if qVersion() > '4.3.3': QCoreApplication.installTranslator(self.translator) # Create the dialog (after translation) and keep reference self.dlg = stereoSurveysDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&visual surveys') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'stereoSurveys') self.toolbar.setObjectName(u'stereoSurveys') self.canvas = self.iface.mapCanvas() QgsMapTool.__init__(self, self.canvas)