Skip to content
Snippets Groups Projects
Commit 195a57b0 authored by benjamin.jakimow@geo.hu-berlin.de's avatar benjamin.jakimow@geo.hu-berlin.de
Browse files

set CRS using QgsProjectionSelectionWidget

parent e3b9ab27
No related branches found
No related tags found
No related merge requests found
......@@ -103,10 +103,11 @@ class NavigationDockUI(TsvDockWidgetBase, load('navigationdock.ui')):
def __init__(self, parent=None):
super(NavigationDockUI, self).__init__(parent)
self.setupUi(self)
self.mCrs = None
#default: disable QgsSync box
self.gbSyncQgs.setEnabled(False)
self.btnCrs.crsChanged.connect(self.sigCrsChanged.emit)
self.btnCrs.crsChanged.connect(self.onCrsUpdated)
self.cbSyncQgsMapExtent.clicked.connect(self.qgsSyncStateChanged)
self.cbSyncQgsMapCenter.clicked.connect(self.qgsSyncStateChanged)
......@@ -146,14 +147,16 @@ class NavigationDockUI(TsvDockWidgetBase, load('navigationdock.ui')):
sigCrsChanged = pyqtSignal(QgsCoordinateReferenceSystem)
def setCrs(self, crs):
assert isinstance(crs, QgsCoordinateReferenceSystem)
old = self.mCrs
self.mCrs = crs
self.textBoxCRSInfo.setPlainText(crs.toWkt())
if self.mCrs != old:
self.sigCrsChanged.emit(crs)
self.btnCrs.setCrs(crs)
self.btnCrs.setLayerCrs(crs)
self.onCrsUpdated(crs)
def crs(self):
return self.mCrs
return self.btnCrs.crs()
def onCrsUpdated(self, crs):
self.gbCrs.setTitle(crs.authid())
self.textBoxCRSInfo.setPlainText(crs.toWkt())
sigSpatialExtentChanged = pyqtSignal(SpatialExtent)
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>237</width>
<height>217</height>
<width>397</width>
<height>309</height>
</rect>
</property>
<property name="windowTitle">
......@@ -291,103 +291,113 @@
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QToolButton" name="btnCRS">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/timeseriesviewer/icons/CRS.png</normaloff>:/timeseriesviewer/icons/CRS.png</iconset>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPlainTextEdit" name="textBoxCRSInfo">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="gbSyncQgs">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<widget class="QgsCollapsibleGroupBox" name="gbCrs">
<property name="title">
<string>Sync with QGIS on...</string>
<string>&lt;Coordinate Reference System&gt;</string>
</property>
<property name="flat">
<bool>false</bool>
<property name="collapsed">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="cbSyncQgsMapCenter">
<property name="text">
<string>center</string>
</property>
</widget>
</item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="cbSyncQgsMapExtent">
<property name="text">
<string>exent</string>
<widget class="QPlainTextEdit" name="textBoxCRSInfo">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbSyncQgsCRS">
<property name="text">
<string>CRS</string>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="sizeHint" stdset="0">
<property name="maximumSize">
<size>
<width>40</width>
<height>20</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</spacer>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QgsProjectionSelectionWidget" name="btnCrs"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gbSyncQgs">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="title">
<string>Sync with QGIS on...</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="cbSyncQgsMapCenter">
<property name="text">
<string>center</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbSyncQgsMapExtent">
<property name="text">
<string>exent</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbSyncQgsCRS">
<property name="text">
<string>CRS</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
......@@ -455,6 +465,20 @@
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QGroupBox</extends>
<header>qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsProjectionSelectionWidget</class>
<extends>QWidget</extends>
<header>qgsprojectionselectionwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="resources.qrc"/>
</resources>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment