예제 #1
0
    def chooseProjection(self):
        """
        Let the user choose a SCR
        """
        # crs Dialog parameters
        header = "Choose CRS"
        sentence = ""
        projSelector = QgsProjectionSelectionTreeWidget(self.dlg)
        projSelector.setMessage("<h2>%s</h2>%s" % (header.encode('UTF8'), sentence.encode('UTF8')))

        if projSelector.exec_():
            self.crs = QgsCoordinateReferenceSystem(projSelector.selectedCrsId(), QgsCoordinateReferenceSystem.InternalCrsId)
            if len(projSelector.selectedAuthId()) == 0:
                QMessageBox.information(
                    self,
                    self.tr('Layer Board'),
                    self.tr("No spatial reference system has been chosen")
                )
                return
            else:
                self.dlg.inCrs.clear()
                self.dlg.inCrs.setText(self.crs.authid())

        else:
            return
예제 #2
0
 def on_srsButton_clicked(self):
     '''
     Opens the dialog to select CRS
     '''
     projSelector = QgsProjectionSelectionTreeWidget()
     message = self.tr('Select the Spatial Reference System!')
     projSelector.setMessage(theMessage=message)
     if not projSelector.exec_():
         QMessageBox.warning(self, self.tr("Warning!"), message)
         return
     else:
         self.epsg = int(projSelector.selectedAuthId().split(':')[-1])
     srs = QgsCoordinateReferenceSystem(self.epsg, QgsCoordinateReferenceSystem.EpsgCrsId)
     self.srLineEdit.setText(srs.description())
예제 #3
0
 def postgisCrsButtonClicked(self):
     dlg = QgsProjectionSelectionTreeWidget(self)
     dlg.setMessage('Select Postgis CRS')
     dlg.setSelectedAuthId('EPSG:%s' % self.srid.text())
     if dlg.exec_():
         self.srid.setText(dlg.selectedAuthId().replace('EPSG:', ''))
예제 #4
0
 def geomapfishCrsButtonClicked(self):
     dlg = QgsProjectionSelectionTreeWidget(self)
     dlg.setMessage('Select GeoMapFish CRS')
     dlg.setSelectedAuthId(self.geomapfishCrs.text())
     if dlg.exec_():
         self.geomapfishCrs.setText(dlg.selectedAuthId())