Commit 07af5d1a authored by Benjamin Jakimow's avatar Benjamin Jakimow
Browse files

time series panel: fixed resizing issue


refactoring
Signed-off-by: Benjamin Jakimow's avatarbenjamin.jakimow <benjamin.jakimow@geo.hu-berlin.de>
parent 4e55dc72
......@@ -276,8 +276,8 @@ def doLoaderTask(taskWrapper:QgsTask, dump):
PROFILE_DATA = []
if bandIndices == range(ds.RasterCount):
#we have to extract all bands
#in this case we use gdal.Dataset.ReadAsArray()
# we have to extract all bands
# in this case we use gdal.Dataset.ReadAsArray()
noData = ds.GetRasterBand(1).GetNoDataValue()
for px in PX_SUBSETS:
if px == INFO_OUT_OF_IMAGE:
......@@ -290,7 +290,7 @@ def doLoaderTask(taskWrapper:QgsTask, dump):
if noData:
isValid = np.ones(bandData.shape[1], dtype=np.bool)
for b in range(bandData.shape[0]):
isValid *= bandData[b,:] != ds.GetRasterBand(b+1).GetNoDataValue()
isValid *= bandData[b, :] != ds.GetRasterBand(b+1).GetNoDataValue()
bandData = bandData[:, np.where(isValid)[0]]
PROFILE_DATA.append(bandData)
else:
......@@ -298,8 +298,8 @@ def doLoaderTask(taskWrapper:QgsTask, dump):
# in this case we use gdal.Band.ReadAsArray()
# and need to iterate over the requested band indices
#save the returned band values for each geometry in a separate list
#empty list == invalid geometry
# save the returned band values for each geometry in a separate list
# empty list == invalid geometry
for i in range(len(PX_SUBSETS)):
if PX_SUBSETS[i] == INFO_OUT_OF_IMAGE:
PROFILE_DATA.append(INFO_OUT_OF_IMAGE)
......
......@@ -1096,9 +1096,9 @@ class TimeSeries(QAbstractItemModel):
if n_max:
n_max = min([len(images), n_max])
self.addSources(images[0:n_max], progressDialog=progressDialog)
self.addSourcesAsync(images[0:n_max], progressDialog=progressDialog)
else:
self.addSources(images, progressDialog=progressDialog)
self.addSourcesAsync(images, progressDialog=progressDialog)
#self.addMasks(masks)
......@@ -1314,7 +1314,7 @@ class TimeSeries(QAbstractItemModel):
return sensor
return None
def addSourcesAsync(self, sources:list, nWorkers:int = 1):
def addSourcesAsync(self, sources:list, nWorkers:int = 1, progressDialog:QProgressDialog=None):
tm = QgsApplication.taskManager()
assert isinstance(tm, QgsTaskManager)
......@@ -1328,12 +1328,12 @@ class TimeSeries(QAbstractItemModel):
yield l[i:i + n]
n = int(len(sources) / nWorkers)
#for subset in chunks(sources, n):
for source in sources:
subset = [source]
for subset in chunks(sources, 10):
#for source in sources:
#subset = [source]
dump = pickle.dumps(subset)
#taskDescription = 'Load EOTSV {} sources {}'.format(len(subset), uuid.uuid4())
taskDescription = 'Load {}'.format(source)
taskDescription = 'Load {} images'.format(len(subset))
qgsTask = QgsTask.fromFunction(taskDescription, doLoadTimeSeriesSourcesTask, dump, on_finished=self.onAddSourcesAsyncFinished)
self.mTasks.append(qgsTask)
......
......@@ -6,14 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>288</width>
<height>267</height>
<width>287</width>
<height>244</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<width>80</width>
<height>151</height>
</size>
</property>
<property name="windowTitle">
......@@ -133,8 +133,8 @@ QToolBox::tab:selected { /* italicize selected tabs */
<rect>
<x>0</x>
<y>0</y>
<width>284</width>
<height>185</height>
<width>283</width>
<height>162</height>
</rect>
</property>
<attribute name="icon">
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>640</width>
<height>239</height>
<height>224</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -50,7 +50,7 @@
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -166,6 +166,12 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="frameFilters">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
......@@ -204,9 +210,9 @@
<item>
<widget class="TimeSeriesTreeView" name="timeSeriesTreeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
......
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