Commit b76b87cf authored by Benjamin Jakimow's avatar Benjamin Jakimow
Browse files

backup: several changes related to MapWidget restructuring


Signed-off-by: Benjamin Jakimow's avatarBenjamin Jakimow <benjamin.jakimow@geo.hu-berlin.de>
parent 89d44c6e
......@@ -410,7 +410,7 @@ class TimeSeriesViewer(QgisInterface, QObject):
self.ui.actionSelectFeatures.setMenu(m)
# create edit toolbar
tb = self.ui.toolBarEditing
tb = self.ui.toolBarVectorFeatures
assert isinstance(tb, QToolBar)
tb.addAction(self.ui.dockLabeling.labelingWidget().actionToggleEditing())
tb.addAction(self.ui.dockLabeling.labelingWidget().actionSaveEdits())
......@@ -498,11 +498,9 @@ class TimeSeriesViewer(QgisInterface, QObject):
self.initQGISConnection()
for toolBar in self.ui.findChildren(QToolBar):
for toolButton in toolBar.findChildren(QToolButton):
assert isinstance(toolButton, QToolButton)
if isinstance(toolButton.defaultAction(), QAction) and isinstance(toolButton.defaultAction().menu(), QMenu):
toolButton.setPopupMode(QToolButton.MenuButtonPopup)
fixMenuButtons(toolBar)
self.ui.dockTimeSeries.setFloating(True)
......@@ -704,6 +702,7 @@ class TimeSeriesViewer(QgisInterface, QObject):
a = self.sender()
m = self.ui.actionSelectFeatures.menu()
if isinstance(a, QAction) and isinstance(m, QMenu) and a in m.actions():
for ca in m.actions():
assert isinstance(ca, QAction)
......@@ -780,15 +779,15 @@ class TimeSeriesViewer(QgisInterface, QObject):
v = value(Keys.MapUpdateInterval)
if isinstance(v, int) and v > 0:
self.spatialTemporalVis.mMapRefreshTimer.start(v)
self.ui.mapWidget.mMapRefreshTimer.start(v)
v = value(Keys.MapBackgroundColor)
if isinstance(v, QColor):
self.spatialTemporalVis.setMapBackgroundColor(v)
self.ui.dockMapViews.setMapBackgroundColor(v)
v = value(Keys.MapSize)
if isinstance(v, QSize):
self.spatialTemporalVis.setMapSize(v)
self.ui.mapWidget.setMapSize(v)
def setMapTool(self, mapToolKey, *args, **kwds):
"""
......@@ -798,7 +797,7 @@ class TimeSeriesViewer(QgisInterface, QObject):
:param kwds:
:return:
"""
self.spatialTemporalVis.setMapTool(mapToolKey)
self.ui.mapWidget.setMapTool(mapToolKey, *args)
kwds = {}
......
......@@ -120,9 +120,17 @@ class MapCanvasInfoItem(QgsMapCanvasItem):
self.mVisibility = True
def setColor(self, color:QColor):
"""
Sets the map info color
:param color: QColor
"""
self.mPenColor = color
def color(self)->QColor:
"""
Returns the info text color
:return: QColor
"""
return self.mPenColor
def setVisibility(self, b:bool):
......@@ -240,7 +248,9 @@ class MapCanvasMapTools(QObject):
self.mCanvas.setMapTool(self.mtAddFeature)
elif mapToolKey == MapTools.SelectFeature:
self.mCanvas.setMapTool(self.mtSelectFeature)
if 'mode' in kwds.keys():
mt = self.mCanvas.mapTool()
assert isinstance(mt, QgsF)
s = ""
else:
......@@ -274,7 +284,7 @@ class MapCanvas(QgsMapCanvas):
sigCrosshairPositionChanged = pyqtSignal(SpatialPoint)
sigCrosshairVisibilityChanged = pyqtSignal(bool)
sigDestinationCrsChanged = pyqtSignal(QgsCoordinateReferenceSystem)
sigCrosshairStyleChanged = pyqtSignal(CrosshairStyle)
def __init__(self, parent=None):
......@@ -326,6 +336,7 @@ class MapCanvas(QgsMapCanvas):
self.extentsChanged.connect(lambda : self.sigSpatialExtentChanged.emit(self.spatialExtent()))
self.destinationCrsChanged.connect(lambda : self.sigDestinationCrsChanged.emit(self.crs()))
def userInputWidget(self)->QgsUserInputWidget:
"""
......@@ -334,6 +345,14 @@ class MapCanvas(QgsMapCanvas):
"""
return self.mUserInputWidget
def infoItem(self)->MapCanvasInfoItem:
"""
Returns the MapCanvasInfoItem, e.g. to plot text on top of the map canvas
:return: MapCanvasInfoItem
"""
return self.mInfoItem
def mapView(self):
"""
Returns the MapView this MapCanvas is linked to
......@@ -397,13 +416,17 @@ class MapCanvas(QgsMapCanvas):
:param tsd:
:return:
"""
if self.mTSD == tsd:
return
# disconnect old TSD
if isinstance(self.mTSD, TimeSeriesDate):
self.mTSD.sensor().sigNameChanged.disconnect(self.updateScope)
self.mTSD = tsd
if isinstance(tsd, TimeSeriesDate):
self.mTSD = tsd
self.mTSD.sensor().sigNameChanged.connect(self.updateScope)
def updateScope(self):
......@@ -535,6 +558,11 @@ class MapCanvas(QgsMapCanvas):
existing = self.layers()
existingSources = [l.source() for l in existing]
if not self.mapView():
return
if not self.tsd():
return
for lyr in self.mMapView.layers():
assert isinstance(lyr, QgsMapLayer)
......
This diff is collapsed.
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>324</width>
<height>348</height>
<width>277</width>
<height>269</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -36,8 +36,26 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QToolButton" name="btnToggleMapViewVisibility">
<property name="sizePolicy">
......@@ -105,6 +123,34 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnInfoOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>T</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="popupMode">
<enum>QToolButton::DelayedPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnAddVectorLayer">
<property name="sizePolicy">
......@@ -169,17 +215,10 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tbName">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -297,6 +336,39 @@
<string>Add a raster layer</string>
</property>
</action>
<action name="optionShowSensorName">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Sensor Name</string>
</property>
<property name="toolTip">
<string>Activate to show the sensor name</string>
</property>
</action>
<action name="optionShowMapViewName">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Map View Name</string>
</property>
<property name="toolTip">
<string>Activate to show the name of the map view</string>
</property>
</action>
<action name="optionShowDate">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Date</string>
</property>
<property name="toolTip">
<string>Activate to show the observate date</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
......
......@@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>287</width>
<height>244</height>
<width>286</width>
<height>340</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>151</height>
<height>164</height>
</size>
</property>
<property name="windowTitle">
......@@ -133,8 +133,8 @@ QToolBox::tab:selected { /* italicize selected tabs */
<rect>
<x>0</x>
<y>0</y>
<width>283</width>
<height>162</height>
<width>282</width>
<height>250</height>
</rect>
</property>
<attribute name="icon">
......@@ -144,199 +144,65 @@ QToolBox::tab:selected { /* italicize selected tabs */
<attribute name="label">
<string>Map Properties</string>
</attribute>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Width</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0">
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<property name="spacing">
<number>1</number>
</property>
<item row="1" column="2">
<widget class="QPushButton" name="btnApplySizeChanges">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="buddy">
<cstring>spinBoxMapSizeY</cstring>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QSpinBox" name="spinBoxMapSizeX">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Max. length of an image chip on screen.</string>
</property>
<property name="specialValueText">
<string/>
</property>
<property name="suffix">
<string>px</string>
</property>
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="singleStep">
<number>25</number>
</property>
<property name="value">
<number>250</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnApplySizeChanges">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Height</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>spinBoxMapSizeY</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QSpinBox" name="spinBoxMapSizeY">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="suffix">
<string>px</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="singleStep">
<number>25</number>
</property>
<property name="value">
<number>250</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxKeepSubsetAspectRatio">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>keep ratio</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_15">
<property name="enabled">
<bool>true</bool>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="toolTip">
<string>Number of observation dates or maps per map view</string>
</property>
<property name="text">
<string>Color</string>
<string>Dates</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>spinBoxMapSizeY</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="4" column="1">
<widget class="QgsColorButton" name="btnMapCanvasColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
......@@ -350,10 +216,10 @@ QToolBox::tab:selected { /* italicize selected tabs */
<height>0</height>
</size>
</property>
<property name="colorDialogTitle">
<property name="colorDialogTitle" stdset="0">
<string>Select Map Canvas Background Color</string>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
......@@ -362,6 +228,118 @@ QToolBox::tab:selected { /* italicize selected tabs */
</property>
</widget>
</item>
<item row="2" column="3">
<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>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBoxMapSizeY">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="suffix">
<string>px</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="singleStep">
<number>25</number>
</property>
<property name="value">
<number>250</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="sbMpMV">
<property name="sizePolicy">