Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
2c73a538
Commit
2c73a538
authored
Jul 23, 2020
by
Benjamin Jakimow
Browse files
added postDataLoadingArgs
Signed-off-by:
Benjamin Jakimow
<
benjamin.jakimow@geo.hu-berlin.de
>
parent
db3eee40
Pipeline
#12488
failed
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
eotimeseriesviewer/main.py
View file @
2c73a538
...
...
@@ -480,6 +480,8 @@ class EOTimeSeriesViewer(QgisInterface, QObject):
self
.
mapLayerStore
().
addMapLayer
(
self
.
ui
.
dockSpectralLibrary
.
speclib
())
self
.
mPostDataLoadingArgs
:
dict
=
dict
()
self
.
mVectorLayerTools
:
VectorLayerTools
=
VectorLayerTools
()
self
.
mVectorLayerTools
.
sigMessage
.
connect
(
lambda
msg
,
level
:
self
.
logMessage
(
msg
,
LOG_MESSAGE_TAG
,
level
))
self
.
mVectorLayerTools
.
sigPanRequest
.
connect
(
self
.
setSpatialCenter
)
...
...
@@ -713,11 +715,30 @@ class EOTimeSeriesViewer(QgisInterface, QObject):
mapviews
=
self
.
mapViews
()
for
mv
in
mapviews
:
self
.
mapWidget
().
removeMapView
(
mv
)
self
.
timeSeries
().
readXml
(
node
)
self
.
mapWidget
().
readXml
(
node
)
mwNode
=
node
.
firstChildElement
(
'MapWidget'
)
if
mwNode
.
nodeName
()
==
'MapWidget'
and
mwNode
.
hasAttribute
(
'mapDate'
):
dt64
=
datetime64
(
mwNode
.
attribute
(
'mapDate'
))
if
isinstance
(
dt64
,
np
.
datetime64
):
self
.
mPostDataLoadingArgs
[
'mapDate'
]
=
dt64
self
.
timeSeries
().
sigLoadingTaskFinished
.
connect
(
self
.
onPostDataLoading
)
self
.
timeSeries
().
readXml
(
node
)
return
True
def
onPostDataLoading
(
self
):
"""
Handles actions that can be applied on a filled time series only, i.e. after sigLoadingTaskFinished was called.
"""
if
'mapDate'
in
self
.
mPostDataLoadingArgs
.
keys
():
mapDate
=
self
.
mPostDataLoadingArgs
.
pop
(
'mapDate'
)
tsd
=
self
.
timeSeries
().
tsd
(
mapDate
,
None
)
if
isinstance
(
tsd
,
TimeSeriesDate
):
self
.
setCurrentDate
(
tsd
)
self
.
timeSeries
().
sigLoadingTaskFinished
.
disconnect
(
self
.
onPostDataLoading
)
def
lockCentralWidgetSize
(
self
,
b
:
bool
):
"""
Locks or release the current central widget size
...
...
eotimeseriesviewer/mapvisualization.py
View file @
2c73a538
...
...
@@ -1017,7 +1017,6 @@ class MapWidget(QFrame):
self
.
mSyncQGISMapCanvasCenter
:
bool
=
False
self
.
mLastQGISMapCanvasCenter
:
SpatialPoint
=
None
self
.
mLastEOTSVMapCanvasCenter
:
SpatialPoint
=
None
self
.
mMaxNumberOfCachedLayers
=
0
self
.
mMapLayerStore
=
QgsMapLayerStore
()
...
...
@@ -1270,11 +1269,12 @@ class MapWidget(QFrame):
:return:
"""
context
=
QgsReadWriteContext
()
mwNode
=
doc
.
createElement
(
'
EOTSV_MAPWIDGET
'
)
mwNode
=
doc
.
createElement
(
'
MapWidget
'
)
mapSize
=
self
.
mapSize
()
mwNode
.
setAttribute
(
'mapsPerMapView'
,
f
'
{
self
.
mapsPerMapView
()
}
'
)
mwNode
.
setAttribute
(
'mapWidth'
,
f
'
{
mapSize
.
width
()
}
'
)
mwNode
.
setAttribute
(
'mapHeight'
,
f
'
{
mapSize
.
height
()
}
'
)
mwNode
.
setAttribute
(
'mapDate'
,
f
'
{
self
.
currentDate
().
date
()
}
'
)
crsNode
=
doc
.
createElement
(
'MapExtent'
)
self
.
spatialExtent
().
writeXml
(
crsNode
,
doc
)
...
...
@@ -1287,8 +1287,8 @@ class MapWidget(QFrame):
def
readXml
(
self
,
node
:
QDomNode
):
from
.settings
import
setValue
,
Keys
if
not
node
.
nodeName
()
==
'
EOTSV_MAPWIDGET
'
:
node
=
node
.
firstChildElement
(
'
EOTSV_MAPWIDGET
'
)
if
not
node
.
nodeName
()
==
'
MapWidget
'
:
node
=
node
.
firstChildElement
(
'
MapWidget
'
)
if
node
.
isNull
():
return
None
...
...
@@ -1303,6 +1303,13 @@ class MapWidget(QFrame):
self
.
setMapSize
(
mapSize
)
setValue
(
Keys
.
MapSize
,
mapSize
)
if
node
.
hasAttribute
(
'mapDate'
):
dt64
=
datetime64
(
node
.
attribute
(
'mapDate'
))
if
isinstance
(
dt64
,
np
.
datetime64
):
tsd
=
self
.
timeSeries
().
tsd
(
dt64
,
None
)
if
isinstance
(
tsd
,
TimeSeriesDate
):
self
.
setCurrentDate
(
tsd
)
nodeExtent
=
node
.
firstChildElement
(
'MapExtent'
)
if
nodeExtent
.
nodeName
()
==
'MapExtent'
:
extent
=
SpatialExtent
.
readXml
(
nodeExtent
)
...
...
@@ -1336,6 +1343,14 @@ class MapWidget(QFrame):
def
setTimeSeries
(
self
,
ts
:
TimeSeries
)
->
TimeSeries
:
assert
ts
is
None
or
isinstance
(
ts
,
TimeSeries
)
if
isinstance
(
self
.
mTimeSeries
,
TimeSeries
):
self
.
mTimeSeries
.
sigVisibilityChanged
.
disconnect
(
self
.
_updateCanvasDates
)
self
.
mTimeSeries
.
sigTimeSeriesDatesRemoved
.
disconnect
(
self
.
__updateCanvasDates
)
self
.
mTimeSeries
.
sigTimeSeriesDatesAdded
.
disconnect
(
self
.
_updateSliderRange
)
self
.
mTimeSeries
.
sigTimeSeriesDatesRemoved
.
disconnect
(
self
.
_updateSliderRange
)
self
.
mTimeSeries
=
ts
if
isinstance
(
self
.
mTimeSeries
,
TimeSeries
):
self
.
mTimeSeries
.
sigVisibilityChanged
.
connect
(
self
.
_updateCanvasDates
)
...
...
eotimeseriesviewer/timeseries.py
View file @
2c73a538
...
...
@@ -1333,6 +1333,8 @@ class TimeSeries(QAbstractItemModel):
sigTimeSeriesDatesAdded
=
pyqtSignal
(
list
)
sigTimeSeriesDatesRemoved
=
pyqtSignal
(
list
)
sigLoadingTaskFinished
=
pyqtSignal
()
sigSensorAdded
=
pyqtSignal
(
SensorInstrument
)
sigSensorRemoved
=
pyqtSignal
(
SensorInstrument
)
...
...
@@ -1831,7 +1833,6 @@ class TimeSeries(QAbstractItemModel):
"""
Adds source images to the TimeSeries
:param sources: list of source images, e.g. a list of file paths
:param nWorkers: not used yet
:param runAsync: bool
"""
from
eotimeseriesviewer.settings
import
value
,
Keys
...
...
@@ -1883,6 +1884,9 @@ class TimeSeries(QAbstractItemModel):
info
.
append
(
'Path="{}" Error="{}"'
.
format
(
str
(
s
),
str
(
ex
).
replace
(
'
\n
'
,
' '
)))
info
=
'
\n
'
.
join
(
info
)
messageLog
(
info
,
Qgis
.
Critical
)
self
.
sigLoadingTaskFinished
.
emit
()
elif
isinstance
(
task
,
TimeSeriesFindOverlapTask
):
if
success
and
len
(
task
.
mIntersections
)
>
0
:
self
.
onFoundOverlap
(
task
.
mIntersections
)
...
...
tests/test_main.py
View file @
2c73a538
...
...
@@ -78,7 +78,6 @@ class TestMain(EOTSVTestCase):
self
.
assertIn
(
expectation
,
dict
(
metadata
),
message
)
def
test_TimeSeriesViewer
(
self
):
from
eotimeseriesviewer.main
import
EOTimeSeriesViewer
TSV
=
EOTimeSeriesViewer
()
...
...
@@ -101,7 +100,6 @@ class TestMain(EOTSVTestCase):
self
.
showGui
([
TSV
.
ui
])
def
test_TimeSeriesViewerNoSource
(
self
):
from
eotimeseriesviewer.main
import
EOTimeSeriesViewer
...
...
@@ -111,7 +109,6 @@ class TestMain(EOTSVTestCase):
self
.
assertIsInstance
(
TSV
,
EOTimeSeriesViewer
)
self
.
showGui
(
TSV
.
ui
)
def
test_TimeSeriesViewerInvalidSource
(
self
):
from
eotimeseriesviewer.main
import
EOTimeSeriesViewer
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment