Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EO Time Series Viewer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin Jakimow
EO Time Series Viewer
Commits
657bc162
Commit
657bc162
authored
8 years ago
by
Benjamin Jakimow
Browse files
Options
Downloads
Patches
Plain Diff
refactoring
sliders to select RGB bands
parent
69a70b81
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
timeseriesviewer/ui/widgets.py
+22
-29
22 additions, 29 deletions
timeseriesviewer/ui/widgets.py
with
22 additions
and
29 deletions
timeseriesviewer/ui/widgets.py
+
22
−
29
View file @
657bc162
...
...
@@ -53,7 +53,7 @@ class ImageChipViewSettings(QGroupBox,
removeView
=
pyqtSignal
()
def
__init__
(
self
,
S
ensor
Configuration
,
parent
=
None
):
def
__init__
(
self
,
s
ensor
,
parent
=
None
):
"""
Constructor.
"""
super
(
ImageChipViewSettings
,
self
).
__init__
(
parent
)
# Set up the user interface from Designer.
...
...
@@ -63,18 +63,20 @@ class ImageChipViewSettings(QGroupBox,
# #widgets-and-dialogs-with-auto-connect
self
.
setupUi
(
self
)
from
timeseriesviewer.timeseries
import
SensorInstrument
assert
isinstance
(
sensor
,
SensorInstrument
)
self
.
sensor
=
sensor
self
.
SensorConfiguration
=
SensorConfiguration
self
.
setTitle
(
SensorConfiguration
.
sensor_name
)
self
.
tb_range_r_min
.
setValidator
(
QDoubleValidator
())
self
.
tb_range_g_min
.
setValidator
(
QDoubleValidator
())
self
.
tb_range_b_min
.
setValidator
(
QDoubleValidator
())
self
.
tb_range_r_max
.
setValidator
(
QDoubleValidator
())
self
.
tb_range_g_max
.
setValidator
(
QDoubleValidator
())
self
.
tb_range_b_max
.
setValidator
(
QDoubleValidator
())
self
.
setTitle
(
sensor
.
sensorName
)
self
.
_initBands
(
self
.
SensorConfiguration
.
band_names
)
self
.
minValues
=
[
self
.
tbRedMin
,
self
.
tbGreenMin
,
self
.
tbBlueMin
]
self
.
maxValues
=
[
self
.
tbRedMax
,
self
.
tbGreenMax
,
self
.
tbBlueMax
]
self
.
sliders
=
[
self
.
sliderRed
,
self
.
sliderGreen
,
self
.
sliderBlue
]
for
tb
in
self
.
minValues
+
self
.
maxValues
:
tb
.
setValidator
(
QDoubleValidator
())
for
sl
in
self
.
sliders
:
sl
.
setMinimum
(
1
)
sl
.
setMaximum
(
self
.
sensor
.
nb
)
def
ua_setMask
(
self
,
state
):
...
...
@@ -101,27 +103,13 @@ class ImageChipViewSettings(QGroupBox,
def
useMaskValues
(
self
):
return
self
.
cb_useMask
.
isChecked
()
def
_initBands
(
self
,
band_names
):
cb_R
=
self
.
cb_r
cb_G
=
self
.
cb_g
cb_B
=
self
.
cb_b
for
i
,
bandname
in
enumerate
(
band_names
):
cb_R
.
addItem
(
bandname
,
i
+
1
)
cb_G
.
addItem
(
bandname
,
i
+
1
)
cb_B
.
addItem
(
bandname
,
i
+
1
)
if
len
(
self
.
SensorConfiguration
.
band_names
)
>=
3
:
cb_R
.
setCurrentIndex
(
2
)
cb_G
.
setCurrentIndex
(
1
)
cb_B
.
setCurrentIndex
(
0
)
def
setBands
(
self
,
bands
):
assert
len
(
bands
)
==
3
for
b
in
bands
:
assert
type
(
b
)
is
int
and
b
>
0
assert
b
<=
len
(
self
.
S
ensor
Configuration
.
band_names
),
'
TimeSeries is not initializes/has no bands to show
'
assert
b
<=
len
(
self
.
s
ensor
.
band_names
),
'
TimeSeries is not initializes/has no bands to show
'
self
.
cb_r
.
setCurrentIndex
(
bands
[
0
]
-
1
)
self
.
cb_g
.
setCurrentIndex
(
bands
[
1
]
-
1
)
self
.
cb_b
.
setCurrentIndex
(
bands
[
2
]
-
1
)
...
...
@@ -129,7 +117,12 @@ class ImageChipViewSettings(QGroupBox,
s
=
""
pass
def
setRGBSettings
(
self
,
bands_and_ranges
):
def
setLayerRenderer
(
self
,
renderer
):
assert
isinstance
(
renderer
,
QgsRasterRenderer
)
if
isinstance
(
renderer
,
QgsMultiBandColorRenderer
):
s
=
""
bands
,
ranges
=
bands_and_ranges
assert
len
(
bands
)
==
3
assert
len
(
ranges
)
==
3
...
...
@@ -138,7 +131,7 @@ class ImageChipViewSettings(QGroupBox,
#copy values only if all bands fit to this sensor
for
b
in
bands
:
if
b
>
self
.
S
ensor
Configuration
.
nb
:
if
b
>
self
.
s
ensor
.
nb
:
return
self
.
cb_r
.
setCurrentIndex
(
bands
[
0
]
-
1
)
...
...
@@ -179,7 +172,7 @@ class ImageChipViewSettings(QGroupBox,
import
qgis_add_ins
action
=
menu
.
addAction
(
'
Paste style
'
)
action
.
setToolTip
(
'
Uses the QGIS raster layer style to specify band selection and band value ranges.
'
)
action
.
triggered
.
connect
(
lambda
:
self
.
set
RGBSettings
(
qgis_add_ins
.
paste_band_settings
(
txt
)))
action
.
triggered
.
connect
(
lambda
:
self
.
set
LayerRenderer
(
qgis_add_ins
.
paste_band_settings
(
txt
)))
menu
.
exec_
(
event
.
globalPos
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment