Commit c77848c0 authored by Benjamin Jakimow's avatar Benjamin Jakimow
Browse files
parent e3bb7207
...@@ -991,13 +991,15 @@ class EOTimeSeriesViewer(QgisInterface, QObject): ...@@ -991,13 +991,15 @@ class EOTimeSeriesViewer(QgisInterface, QObject):
else: else:
print('Unsupported moveTo action') print('Unsupported moveTo action')
def setCurrentDate(self, tsd: TimeSeriesDate): def setCurrentDate(self, tsd: TimeSeriesDate, show_if_hidden: bool =True) :
""" """
Moves the viewport of the scroll window to a specific TimeSeriesDate Moves the viewport of the scroll window to a specific TimeSeriesDate
:param tsd: TimeSeriesDate or numpy.datetime64 :param tsd: TimeSeriesDate or numpy.datetime64
""" """
tsd = self.timeSeries().findDate(tsd) tsd = self.timeSeries().findDate(tsd)
if isinstance(tsd, TimeSeriesDate): if isinstance(tsd, TimeSeriesDate):
if show_if_hidden:
self.mTimeSeries.showTSDs([tsd], b=True)
self.ui.mMapWidget.setCurrentDate(tsd) self.ui.mMapWidget.setCurrentDate(tsd)
def mapCanvases(self) -> typing.List[MapCanvas]: def mapCanvases(self) -> typing.List[MapCanvas]:
......
...@@ -1377,7 +1377,7 @@ class TimeSeries(QAbstractItemModel): ...@@ -1377,7 +1377,7 @@ class TimeSeries(QAbstractItemModel):
self.mSensorMatchingFlags = SensorMatching.PX_DIMS self.mSensorMatchingFlags = SensorMatching.PX_DIMS
self.mLUT_Path2TSD = {} self.mLUT_Path2TSD = {}
self.mVisibleDate = [] self.mVisibleDates: typing.Set[TimeSeriesDate] = set()
self.mCurrentSpatialExtent = None self.mCurrentSpatialExtent = None
self.cnDate = 'Date' self.cnDate = 'Date'
...@@ -1490,8 +1490,8 @@ class TimeSeries(QAbstractItemModel): ...@@ -1490,8 +1490,8 @@ class TimeSeries(QAbstractItemModel):
Sets the TimeSeriesDates currently shown Sets the TimeSeriesDates currently shown
:param tsds: [list-of-TimeSeriesDate] :param tsds: [list-of-TimeSeriesDate]
""" """
self.mVisibleDate.clear() self.mVisibleDates.clear()
self.mVisibleDate.extend(tsds) self.mVisibleDates.update(tsds)
for tsd in tsds: for tsd in tsds:
assert isinstance(tsd, TimeSeriesDate) assert isinstance(tsd, TimeSeriesDate)
if tsd in self: if tsd in self:
...@@ -1708,6 +1708,7 @@ class TimeSeries(QAbstractItemModel): ...@@ -1708,6 +1708,7 @@ class TimeSeries(QAbstractItemModel):
idx0 = self.tsdToIdx(tsds[0]) idx0 = self.tsdToIdx(tsds[0])
idx1 = self.tsdToIdx(tsds[-1]) idx1 = self.tsdToIdx(tsds[-1])
for i, tsd in enumerate(tsds): for i, tsd in enumerate(tsds):
assert isinstance(tsd, TimeSeriesDate) assert isinstance(tsd, TimeSeriesDate)
for tss in tsd: for tss in tsd:
...@@ -2303,7 +2304,7 @@ class TimeSeries(QAbstractItemModel): ...@@ -2303,7 +2304,7 @@ class TimeSeries(QAbstractItemModel):
print(ext) print(ext)
return None return None
if role == Qt.BackgroundColorRole and tsd in self.mVisibleDate: if role == Qt.BackgroundColorRole and tsd in self.mVisibleDates:
return QColor('yellow') return QColor('yellow')
if isinstance(node, TimeSeriesDate): if isinstance(node, TimeSeriesDate):
...@@ -2318,7 +2319,7 @@ class TimeSeries(QAbstractItemModel): ...@@ -2318,7 +2319,7 @@ class TimeSeries(QAbstractItemModel):
if role == Qt.CheckStateRole and index.column() == 0: if role == Qt.CheckStateRole and index.column() == 0:
return node.checkState() return node.checkState()
if role == Qt.BackgroundColorRole and tsd in self.mVisibleDate: if role == Qt.BackgroundColorRole and tsd in self.mVisibleDates:
return QColor('yellow') return QColor('yellow')
return None return None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment