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
f14cd6de
Commit
f14cd6de
authored
9 years ago
by
Benjamin Jakimow
Browse files
Options
Downloads
Patches
Plain Diff
merged getBands and getRanges to getRGBSettings
added setRGBSettings(bands_and_ranges)
parent
4fd8405b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tsv_widgets.py
+49
-15
49 additions, 15 deletions
tsv_widgets.py
with
49 additions
and
15 deletions
tsv_widgets.py
+
49
−
15
View file @
f14cd6de
...
...
@@ -24,7 +24,7 @@ from PyQt4 import uic
from
PyQt4.QtCore
import
*
from
PyQt4.QtGui
import
*
import
sys
import
sys
,
re
,
os
sys
.
path
.
append
(
os
.
path
.
dirname
(
__file__
))
...
...
@@ -37,6 +37,7 @@ def loadFormClass(name_ui):
FORM_CLASS_BANDVIEWSETTINGS
=
loadFormClass
(
'
bandviewsettings_widget_base.ui
'
)
FORM_CLASS_IMAGECHIPVIEWSETTINGS
=
loadFormClass
(
'
imagechipviewsettings_widget_base.ui
'
)
class
ImageChipViewSettings
(
QGroupBox
,
FORM_CLASS_IMAGECHIPVIEWSETTINGS
):
#define signals
...
...
@@ -119,21 +120,59 @@ class ImageChipViewSettings(QGroupBox, FORM_CLASS_IMAGECHIPVIEWSETTINGS):
s
=
""
pass
def
getBands
(
self
):
def
setRGBSettings
(
self
,
bands_and_ranges
):
bands
,
ranges
=
bands_and_ranges
assert
len
(
bands
)
==
3
assert
len
(
ranges
)
==
3
for
range
in
ranges
:
assert
len
(
range
)
==
2
and
range
[
0
]
<=
range
[
1
]
#copy values only if all bands fit to this sensor
for
b
in
bands
:
if
b
>
self
.
SensorConfiguration
.
nb
:
return
self
.
cb_r
.
setCurrentIndex
(
bands
[
0
]
-
1
)
self
.
cb_g
.
setCurrentIndex
(
bands
[
1
]
-
1
)
self
.
cb_b
.
setCurrentIndex
(
bands
[
2
]
-
1
)
self
.
tb_range_r_min
.
setText
(
str
(
ranges
[
0
][
0
]))
self
.
tb_range_g_min
.
setText
(
str
(
ranges
[
1
][
0
]))
self
.
tb_range_b_min
.
setText
(
str
(
ranges
[
2
][
0
]))
self
.
tb_range_r_max
.
setText
(
str
(
ranges
[
0
][
1
]))
self
.
tb_range_g_max
.
setText
(
str
(
ranges
[
1
][
1
]))
self
.
tb_range_b_max
.
setText
(
str
(
ranges
[
2
][
1
]))
def
getRGBSettings
(
self
):
bands
=
[
self
.
cb_r
.
currentIndex
()
+
1
,
\
self
.
cb_g
.
currentIndex
()
+
1
,
\
self
.
cb_b
.
currentIndex
()
+
1
]
return
bands
def
getRanges
(
self
):
range_r
=
[
float
(
self
.
tb_range_r_min
.
text
()),
float
(
self
.
tb_range_r_max
.
text
())]
range_g
=
[
float
(
self
.
tb_range_g_min
.
text
()),
float
(
self
.
tb_range_g_max
.
text
())]
range_b
=
[
float
(
self
.
tb_range_b_min
.
text
()),
float
(
self
.
tb_range_b_max
.
text
())]
r
eturn
(
range_r
,
range_g
,
range_b
)
r
anges
=
(
range_r
,
range_g
,
range_b
)
def
getSettings
(
self
):
return
bands
,
ranges
def
contextMenuEvent
(
self
,
event
):
menu
=
QMenu
()
#add general options
#add QGIS specific options
txt
=
QApplication
.
clipboard
().
text
()
if
re
.
search
(
'
<!DOCTYPE(.|
\n
)*rasterrenderer.*type=
"
multibandcolor
"'
,
txt
)
is
not
None
:
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
.
setRGBSettings
(
qgis_add_ins
.
paste_band_settings
(
txt
)))
menu
.
exec_
(
event
.
globalPos
())
s
=
""
class
BandViewSettings
(
QGroupBox
,
FORM_CLASS_BANDVIEWSETTINGS
):
...
...
@@ -216,20 +255,15 @@ class BandViewSettings(QGroupBox, FORM_CLASS_BANDVIEWSETTINGS):
s
=
""
pass
def
get
Band
s
(
self
):
def
get
RGBSetting
s
(
self
):
bands
=
[
self
.
cb_r
.
currentIndex
()
+
1
,
\
self
.
cb_g
.
currentIndex
()
+
1
,
\
self
.
cb_b
.
currentIndex
()
+
1
]
return
bands
def
getRanges
(
self
):
range
=
[
float
(
self
.
tb_range_min
.
text
()),
float
(
self
.
tb_range_max
.
text
())]
#provide a range for each channel
return
(
range
,
range
,
range
)
ranges
=
(
range
,
range
,
range
)
def
getSettings
(
self
):
s
=
""
return
bands
,
ranges
if
__name__
==
'
__main__
'
:
...
...
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