summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-03-08 21:34:45 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-03-08 21:34:45 (GMT)
commitc5efbe84df9bce345432da96604bab6d84b96124 (patch)
treeffd44e52d38e8251f56b464dd72fc1d4f4a49a91
parent4b47b2c46931679d9fbc0181436584a15df0640e (diff)
downloadblt-c5efbe84df9bce345432da96604bab6d84b96124.zip
blt-c5efbe84df9bce345432da96604bab6d84b96124.tar.gz
blt-c5efbe84df9bce345432da96604bab6d84b96124.tar.bz2
fix contours
-rw-r--r--ds9/library/contour.tcl40
1 files changed, 33 insertions, 7 deletions
diff --git a/ds9/library/contour.tcl b/ds9/library/contour.tcl
index ee57aef..638a354 100644
--- a/ds9/library/contour.tcl
+++ b/ds9/library/contour.tcl
@@ -26,6 +26,7 @@ proc ContourDef {} {
set contour(scale) linear
set contour(mode) minmax
set contour(log) 1000
+ set contour(scope) local
set contour(min) {}
set contour(max) {}
@@ -34,6 +35,7 @@ proc ContourDef {} {
# .. contour scale is log, not zscale
set contour(init,scale) 0
set contour(init,mode) 0
+ set contour(init,scope) 0
set contour(init,limits) 0
set pcontour(view) $contour(view)
@@ -88,7 +90,7 @@ proc UpdateContour {} {
$current(frame) contour create \
$contour(color) $contour(width) $contour(dash) \
$contour(method) $contour(numlevel) $contour(smooth) \
- $contour(scale) $contour(log) $contour(mode) \
+ $contour(scale) $contour(log) $contour(mode) $contour(scope) \
$contour(min) $contour(max) \
"\"$levels\""
}
@@ -96,7 +98,8 @@ proc UpdateContour {} {
set contour(scale) [$current(frame) get colorscale]
set contour(log) [$current(frame) get colorscale log]
set contour(mode) [$current(frame) get clip mode]
- set limits [$current(frame) get clip $contour(mode)]
+ set contour(scope) [$current(frame) get clip scope]
+ set limits [$current(frame) get clip $contour(mode) $contour(scope)]
set contour(min) [lindex $limits 0]
set contour(max) [lindex $limits 1]
@@ -104,7 +107,7 @@ proc UpdateContour {} {
$current(frame) contour create \
$contour(color) $contour(width) $contour(dash) \
$contour(method) $contour(numlevel) $contour(smooth) \
- $contour(scale) $contour(log) $contour(mode) \
+ $contour(scale) $contour(log) $contour(mode) $contour(scope) \
$contour(min) $contour(max) \
"{}"
}
@@ -164,6 +167,7 @@ proc ContourDialog {} {
$mb add cascade -label [msgcat::mc {Width}] -menu $mb.width
$mb add cascade -label [msgcat::mc {Scale}] -menu $mb.scale
$mb add cascade -label [msgcat::mc {Limits}] -menu $mb.limit
+ $mb add cascade -label [msgcat::mc {Scope}] -menu $mb.scope
$mb add cascade -label [msgcat::mc {Method}] -menu $mb.method
menu $mb.file
@@ -250,6 +254,12 @@ proc ContourDialog {} {
$mb.limit add radiobutton -label [msgcat::mc {User}] \
-variable contour(mode) -value user -command ContourModeDialog
+ menu $mb.scope
+ $mb.scope add radiobutton -label [msgcat::mc {Global}] \
+ -variable contour(scope) -value global -command ContourModeDialog
+ $mb.scope add radiobutton -label [msgcat::mc {Local}] \
+ -variable contour(scope) -value local -command ContourModeDialog
+
menu $mb.method
$mb.method add radiobutton -label [msgcat::mc {Block}] \
-variable contour(method) -value block
@@ -510,7 +520,7 @@ proc ContourModeDialog {} {
global contour
if {$current(frame) != {}} {
- set limits [$current(frame) get clip $contour(mode)]
+ set limits [$current(frame) get clip $contour(mode) $contour(scope)]
set contour(min) [lindex $limits 0]
set contour(max) [lindex $limits 1]
}
@@ -884,8 +894,9 @@ proc UpdateContourScale {} {
if {[$current(frame) has contour]} {
set contour(scale) [$current(frame) get contour colorscale]
set contour(mode) [$current(frame) get contour clip mode]
+ set contour(scope) [$current(frame) get contour clip scope]
set contour(log) [$current(frame) get contour colorscale log]
- set limits [$current(frame) get clip $contour(mode)]
+ set limits [$current(frame) get clip $contour(mode) $contour(scope)]
set contour(min) [lindex $limits 0]
set contour(max) [lindex $limits 1]
} else {
@@ -896,8 +907,11 @@ proc UpdateContourScale {} {
if {!($ds9(init) && $contour(init,mode))} {
set contour(mode) [$current(frame) get clip mode]
}
+ if {!($ds9(init) && $contour(init,scope))} {
+ set contour(scope) [$current(frame) get clip scope]
+ }
if {!($ds9(init) && $contour(init,limits))} {
- set limits [$current(frame) get clip $contour(mode)]
+ set limits [$current(frame) get clip $contour(mode) $contour(scope)]
set contour(min) [lindex $limits 0]
set contour(max) [lindex $limits 1]
}
@@ -967,10 +981,11 @@ proc ContourBackupBase {ch which fdir rdir} {
set scale [$which get contour colorscale]
set log [$which get contour colorscale log]
set mode [$which get contour clip mode]
+ set scope [$which get contour clip scope]
set limits [$which get contour clip]
set levels [$which get contour level]
- puts $ch "$which contour create $color $width $dash $method $numlevel $smooth $scale $log $mode $limits \{\"$levels\"\}"
+ puts $ch "$which contour create $color $width $dash $method $numlevel $smooth $scale $log $mode $scope $limits \{\"$levels\"\}"
}
# delete old contours
@@ -1214,6 +1229,16 @@ proc ProcessContourCmd {varname iname} {
ContourGenerateDialog
UpdateContour
}
+ scope {
+ set contour(init,scope) 1
+ ContourDialog
+
+ incr i
+ set contour(scope) [lindex $var $i]
+ ContourModeDialog
+ ContourGenerateDialog
+ UpdateContour
+ }
limits {
set contour(init,limits) 1
ContourDialog
@@ -1406,6 +1431,7 @@ proc ProcessSendContourCmd {proc id param sock fn} {
log -
{log exp} {$proc $id "$contour(log)\n"}
mode {$proc $id "$contour(mode)\n"}
+ scope {$proc $id "$contour(scope)\n"}
limits {$proc $id "$contour(min) $contour(max)\n"}
levels {
global dcontour