Ejemplo n.º 1
0
class GdalToolsSRSDialog(QDialog):
    def __init__(self, title, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(title)

        layout = QVBoxLayout()
        self.selector = QgsProjectionSelector(self)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Close)

        layout.addWidget(self.selector)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

    def authid(self):
        return str(self.selector.selectedAuthId())

    def proj4string(self):
        return self.selector.selectedProj4String()

    def getProjection(self):
        if self.authid().upper().startswith("EPSG:"):
            return self.authid()

        if self.selector.selectedProj4String():
            return self.proj4string()

        return ''
Ejemplo n.º 2
0
class GdalToolsSRSDialog(QDialog):

    def __init__(self, title, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(title)

        layout = QVBoxLayout()
        self.selector = QgsProjectionSelector(self)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close)

        layout.addWidget(self.selector)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

    def authid(self):
        return str(self.selector.selectedAuthId())

    def proj4string(self):
        return self.selector.selectedProj4String()

    def getProjection(self):
        if self.authid().upper().startswith("EPSG:"):
            return self.authid()

        if self.selector.selectedProj4String():
            return self.proj4string()

        return ''
Ejemplo n.º 3
0
class SRSChooserDialog(QtGui.QDialog):
    """Inspired by:
    `<http://code.google.com/p/qspatialite/source/browse/trunk/dialogSRS.py?spec=svn45&r=45>`_
    """
    def __init__(self, title):
        QtGui.QDialog.__init__(self)
        self.setWindowTitle(title)
        layout = QtGui.QVBoxLayout()
        self.selector = QgsProjectionSelector(self)
        buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok |
                                           QtGui.QDialogButtonBox.Close)

        layout.addWidget(self.selector)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

        self.connect(buttonBox, QtCore.SIGNAL("accepted()"), self.accept)
        self.connect(buttonBox, QtCore.SIGNAL("rejected()"), self.reject)

    def epsg(self):
        return str(self.selector.selectedEpsg())

    def proj4string(self):
        return self.selector.selectedProj4String()

    def getProjection(self):
        if self.selector.selectedEpsg() != 0:
            return self.epsg()

        if not self.selector.selectedProj4String().isEmpty():
            return self.proj4string()

        return QtCore.QString()
Ejemplo n.º 4
0
class SelectCrsDlg(QDialog):
  def __init__(self, title, parent=None):
      QDialog.__init__(self)
      self.setWindowTitle( title )

      layout = QVBoxLayout()
      self.selector = QgsProjectionSelector(self)
      buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close)

      layout.addWidget(self.selector)
      layout.addWidget(buttonBox)
      self.setLayout(layout)

      self.connect(buttonBox, SIGNAL("accepted()"), self.accept)
      self.connect(buttonBox, SIGNAL("rejected()"), self.reject)

  def epsg(self):
      return "EPSG:" + str(self.selector.selectedEpsg())

  def proj4string(self):
      return self.selector.selectedProj4String()

  def getProjection(self):
      if self.selector.selectedEpsg() != 0:
        return self.epsg()

      if not self.selector.selectedProj4String().isEmpty():
        return self.proj4string()

      return QString()
Ejemplo n.º 5
0
    def __init__(self, title, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(title)

        layout = QVBoxLayout()
        self.selector = QgsProjectionSelector(self)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close)

        layout.addWidget(self.selector)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Ejemplo n.º 6
0
    def __init__(self, title, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(title)

        layout = QVBoxLayout()
        self.selector = QgsProjectionSelector(self)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close)

        layout.addWidget(self.selector)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Ejemplo n.º 7
0
    def __init__(self, title):
        QtGui.QDialog.__init__(self)
        self.setWindowTitle(title)
        layout = QtGui.QVBoxLayout()
        self.selector = QgsProjectionSelector(self)
        buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok |
                                           QtGui.QDialogButtonBox.Close)

        layout.addWidget(self.selector)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

        self.connect(buttonBox, QtCore.SIGNAL("accepted()"), self.accept)
        self.connect(buttonBox, QtCore.SIGNAL("rejected()"), self.reject)
Ejemplo n.º 8
0
# coding: utf-8
from PyQt4.QtGui import QDialog, QVBoxLayout
from qgis.gui import QgsProjectionSelector

new_dialog = QDialog()
new_dialog.resize(800, 800)

layout = QVBoxLayout()

projection_selector = QgsProjectionSelector(new_dialog)  # Widget based

layout.addWidget(projection_selector)

new_dialog.setLayout(layout)

new_dialog.show()