Commit 7638ba44 authored by benjamin.jakimow@geo.hu-berlin.de's avatar benjamin.jakimow@geo.hu-berlin.de
Browse files

mapvisualization: added highlighting of dates and map views

parent 4e0aafde
......@@ -75,7 +75,8 @@ DIR_UI = jp(DIR,*['ui'])
DIR_DOCS = jp(DIR,'docs')
DIR_EXAMPLES = jp(DIR_REPO, 'example')
PATH_EXAMPLE_TIMESERIES = jp(DIR_EXAMPLES,'ExampleTimeSeries.csv')
PATH_LICENSE = jp(DIR_REPO, 'LICENSE.txt')
PATH_LICENSE = jp(DIR_REPO, 'LICENSE.html')
PATH_CHANGELOG = jp(DIR_REPO, 'CHANGES.html')
DEBUG = True
import site
......
......@@ -59,10 +59,12 @@ class MapViewUI(QFrame, loadUi('mapviewdefinition.ui')):
assert isinstance(sensor, SensorInstrument)
w = MapViewSensorSettings(sensor)
l = self.gbRasterRendering.layout()
#sizePolicy = QSizePolicy(QSize)
#w.ui.
l = self.renderSettingsLayout
assert sensor not in self.mSensors.keys()
lastWidgetIndex = l.count()
lastWidgetIndex = l.count()-1
l.insertWidget(lastWidgetIndex, w.ui)
self.mSensors[sensor] = w
#self.resize(self.sizeHint())
......@@ -76,7 +78,7 @@ class MapViewUI(QFrame, loadUi('mapviewdefinition.ui')):
sensorSettings = self.mSensors.pop(sensor)
assert isinstance(sensorSettings, MapViewSensorSettings)
l = self.scrollAreaWidgetContents.layout()
l = self.renderSettingsLayout
l.removeWidget(sensorSettings.ui)
sensorSettings.ui.close()
#self.resize(self.sizeHint())
......@@ -195,6 +197,22 @@ class MapView(QObject):
if old != self.mCrosshairStyle:
self.sigCrosshairStyleChanged.emit(self.mCrosshairStyle)
def setHighlighted(self, b=True, timeout=1000):
styleOn = """.MapCanvas {
border: 4px solid red;
border-radius: 4px;
}"""
styleOff = """"""
if b is True:
for mapCanvas in self.mapCanvases():
mapCanvas.setStyleSheet(styleOn)
if timeout > 0:
QTimer.singleShot(timeout, lambda : self.setHighlighted(False))
else:
for mapCanvas in self.mapCanvases():
mapCanvas.setStyleSheet(styleOff)
def setShowCrosshair(self, b):
assert isinstance(b, bool)
self.mShowCrosshair = b
......@@ -263,7 +281,7 @@ class MapView(QObject):
class MapViewRenderSettingsUI(QGroupBox, loadUi('mapviewrendersettings.ui')):
class MapViewRenderSettingsUI(QgsCollapsibleGroupBox, loadUi('mapviewrendersettings.ui')):
def __init__(self, parent=None):
"""Constructor."""
......@@ -459,8 +477,8 @@ class MapViewSensorSettings(QObject):
def onSensorNameChanged(self, newName):
self.sensor.sigNameChanged.connect(self.ui.labelTitle.setText)
self.ui.labelTitle.setText(self.sensor.name())
self.ui.setTitle(self.sensor.name())
self.ui.actionApplyStyle.setToolTip('Apply style to all map view images from "{}"'.format(self.sensor.name()))
def pasteStyleFromClipboard(self):
......@@ -518,16 +536,16 @@ class MapViewSensorSettings(QObject):
cw = self.ui.stackedWidget.currentWidget()
text = ''
if cw == self.ui.pageMultiBand:
text = 'RGB {} {} {}'.format(
text = 'Multiband({} {} {})'.format(
self.ui.sliderRed.value(),
self.ui.sliderGreen.value(),
self.ui.sliderBlue.value()
)
elif cw == self.ui.pageSingleBand:
text = 'Band {}'.format(self.ui.sliderSingleBand.value())
text = 'Singleband({})'.format(self.ui.sliderSingleBand.value())
self.ui.labelSummary.setText(text)
text = '{} - {}'.format(self.sensor.name(), text)
self.ui.setTitle(text)
def setLayerRenderer(self, renderer):
......@@ -709,6 +727,19 @@ class DatumView(QObject):
self.ui.setVisible(b)
self.sigVisibilityChanged.emit(b)
def setHighlighted(self, b=True, timeout=1000):
styleOn = """.QFrame {
border: 4px solid red;
border-radius: 4px;
}"""
styleOff = """"""
if b is True:
self.ui.setStyleSheet(styleOn)
if timeout > 0:
QTimer.singleShot(timeout, lambda : self.setHighlighted(b=False))
else:
self.ui.setStyleSheet(styleOff)
def setMapViewVisibility(self, bandView, isVisible):
self.mapCanvases[bandView].setVisible(isVisible)
......@@ -1145,6 +1176,16 @@ class DateViewCollection(QObject):
self.sigResizeRequired.emit()
def highlightDate(self, tsd):
"""
Highlights a time series data for a specific time our
:param tsd:
:return:
"""
tsdView = self.tsdView(tsd)
if isinstance(tsdView, DatumView):
tsdView.setHighlight(True)
def setFocusView(self, tsd):
self.focusView = tsd
......@@ -1568,9 +1609,11 @@ class MapViewCollectionDock(QgsDockWidget, loadUi('mapviewdockV2.ui')):
self.btnAddMapView.setDefaultAction(self.actionAddMapView)
self.btnRemoveMapView.setDefaultAction(self.actionRemoveMapView)
self.btnRefresh.setDefaultAction(self.actionApplyStyles)
self.btnHighlightMapView.setDefaultAction(self.actionHighlightMapView)
self.actionAddMapView.triggered.connect(self.createMapView)
self.actionRemoveMapView.triggered.connect(lambda : self.removeMapView(self.currentMapView()))
self.actionHighlightMapView.triggered.connect(lambda : self.currentMapView().setHighlighted(True))
self.mMapViews = MapViewListModel()
self.mMapViews.sigMapViewsRemoved.connect(self.onMapViewsRemoved)
......
......@@ -292,7 +292,7 @@ def sandboxTestdata():
#imgs = file_search(searchDir, '*.tif', recursive=True)#[0:1] # [0:5]
import example.Images
imgs = [example.Images.Img_2014_08_11_LC82270652014223LGN00_BOA,
example.Images.re_2014_08_20]
example.Images.re_2014_08_26]
S.addTimeSeriesImages(imgs)
......
......@@ -9,12 +9,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<width>630</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -25,18 +25,12 @@
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>524</width>
<height>650</height>
</size>
</property>
<property name="windowTitle">
<string>About HUB TimeSeriesViewer</string>
</property>
<property name="windowIcon">
<iconset resource="resources.qrc">
<normaloff>:/timeseriesviewer/icons/icon.png</normaloff>:/timeseriesviewer/icons/icon.png</iconset>
<normaloff>:/timeseriesviewer/icons/icon.svg</normaloff>:/timeseriesviewer/icons/icon.svg</iconset>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
......@@ -44,7 +38,7 @@
<property name="modal">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>6</number>
</property>
......@@ -53,13 +47,40 @@
</property>
<item>
<widget class="QSplitter" name="splitter">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="opaqueResize">
<bool>false</bool>
</property>
<property name="handleWidth">
<number>4</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QFrame" name="listWidgetFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
......@@ -73,7 +94,7 @@
<item>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -84,12 +105,6 @@
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>About</string>
......@@ -100,11 +115,6 @@
<string>Changes</string>
</property>
</item>
<item>
<property name="text">
<string>Credits</string>
</property>
</item>
<item>
<property name="text">
<string>License</string>
......@@ -115,6 +125,12 @@
</layout>
</widget>
<widget class="QFrame" name="stackWidgetFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
......@@ -128,8 +144,8 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<sizepolicy hsizetype="Ignored" vsizetype="Expanding">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
......@@ -159,53 +175,138 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>10</number>
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources.qrc">:/timeseriesviewer/icons/icon.png</pixmap>
<pixmap resource="resources.qrc">:/timeseriesviewer/icons/IconTimeSeries.svg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Verdana</family>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255,0);</string>
</property>
<property name="text">
<string>HUB
Time Series Viewer</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelVersion">
<property name="text">
<string>&lt;version&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255,0);</string>
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>HUB TimeSeriesViewer</string>
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
<property name="pixmap">
<pixmap resource="resources.qrc">:/timeseriesviewer/icons/logo_hub.svg</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>false</bool>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
......@@ -214,7 +315,10 @@
<item>
<widget class="QLabel" name="labelAboutText">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Licenced under the GNU General Public Licence&lt;br/&gt;&lt;a href=&quot;http://www.gnu.org/licenses/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Website, Source Code and more&lt;br/&gt;&lt;a href=https://bitbucket.org/jakimowb/hub-timeseriesviewer&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://bitbucket.org/jakimowb/hub-timeseriesviewer&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Licenced under the GNU General Public Licence Version 2&lt;br/&gt;&lt;a href=&quot;http://www.gnu.org/licenses/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;
The HUB Time Series Viewer is developed at Humboldt-Universit&amp;auml;t zu Berlin (HUB). Born in the SenseCarbon project, it was funded by the German Aerospace Centre (DLR) and granted by the Federal Ministry of Education and Research (BMBF, grant no. 50EE1254). Since 2017 it is developed under contract by the German Research Centre for Geosciences (GFZ) as part of the EnMAP Core Science Team activities (&lt;a href=&quot;http://www.enmap.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.enmap.org&lt;/span&gt;&lt;/a&gt;), funded by DLR and granted by the Federal Ministry of Economic Affairs and Energy (BMWi, grant no. 50EE1529).
&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
......@@ -249,96 +353,6 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="pageCredits">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="btnQGIS">
<property name="text">
<string>QGIS</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/timeseriesviewer/icons/qgis-icon.png</normaloff>:/timeseriesviewer/icons/qgis-icon.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnPyQtGraph">
<property name="text">
<string>PyQtGraph</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>1</number>
</property>
<item>
<widget class="QWebView" name="webViewCredits">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageLicense">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
......@@ -367,8 +381,8 @@
</action>
<action name="actionShowCreditsQgis">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/timeseriesviewer/icons/qgis-icon.png</normaloff>:/timeseriesviewer/icons/qgis-icon.png</iconset>
<iconset>
<normaloff>:/timeseriesviewer/icons/qgis-icon.svg</normaloff>:/timeseriesviewer/icons/qgis-icon.svg</iconset>
</property>
<property name="text">
<string>showCreditsQgis</string>
......@@ -380,15 +394,9 @@
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources>
<include location="resources.qrc"/>
<include location="C:/Users/geo_beja/.designer/backup/resources.qrc"/>
</resources>
<connections>
<connection>
......
......@@ -26,7 +26,7 @@
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/timeseriesviewer/icons/copyright_label.png</normaloff>:/timeseriesviewer/icons/copyright_label.png</iconset>
<normaloff>:/timeseriesviewer/icons/copyright_label.svg</normaloff>:/timeseriesviewer/icons/copyright_label.svg</iconset>
</property>
</widget>
</item>
......@@ -37,7 +37,7 @@
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/timeseriesviewer/icons/mActionRemove.png</normaloff>:/timeseriesviewer/icons/mActionRemove.png</iconset>
<normaloff>:/timeseriesviewer/icons/mActionRemove.svg</normaloff>:/timeseriesviewer/icons/mActionRemove.svg</iconset>
</property>
</widget>
</item>
......@@ -48,7 +48,7 @@
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/timeseriesviewer/icons/mActionAdd.png</normaloff>:/timeseriesviewer/icons/mActionAdd.png</iconset>