summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-11-07 22:09:29 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-11-07 22:09:29 (GMT)
commit31e0d69941f31e61e5c242cef79e0bd916fe4ace (patch)
tree1321c597d5f796d02b6226207ecc2d72ac5b4610 /ds9
parentd81a364b0f8e7e847dae9274ee89fe6cdcffaa0e (diff)
downloadblt-31e0d69941f31e61e5c242cef79e0bd916fe4ace.zip
blt-31e0d69941f31e61e5c242cef79e0bd916fe4ace.tar.gz
blt-31e0d69941f31e61e5c242cef79e0bd916fe4ace.tar.bz2
add mask range
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/mask.tcl45
-rw-r--r--ds9/parsers/masklex.fcl3
-rw-r--r--ds9/parsers/maskparser.tac9
-rw-r--r--ds9/parsers/masksendlex.fcl1
-rw-r--r--ds9/parsers/masksendparser.tac2
5 files changed, 50 insertions, 10 deletions
diff --git a/ds9/library/mask.tcl b/ds9/library/mask.tcl
index 937221d..60f3152 100644
--- a/ds9/library/mask.tcl
+++ b/ds9/library/mask.tcl
@@ -14,7 +14,9 @@ proc MaskDef {} {
set mask(system) physical
set mask(color) red
- set mask(mark) 1
+ set mask(mark) nonzero
+ set mask(low) 0
+ set mask(high) 0
set mask(transparency) 0
array set pmask [array get mask]
@@ -29,6 +31,15 @@ proc MaskMark {} {
}
}
+proc MaskRange {} {
+ global mask
+ global current
+
+ if {$current(frame) != {}} {
+ $current(frame) mask range $mask(low) $mask(high)
+ }
+}
+
proc MaskColor {} {
global mask
global current
@@ -176,6 +187,9 @@ proc UpdateMaskMenu {} {
set mask(color) [$current(frame) get mask color]
set mask(mark) [$current(frame) get mask mark]
+ set range [$current(frame) get mask range]
+ set mask(low) [lindex $range 0]
+ set mask(high) [lindex $range 1]
set mask(system) [$current(frame) get mask system]
set mask(transparency) [$current(frame) get mask transparency]
@@ -201,6 +215,7 @@ proc MaskLoad {} {
if {$rr} {
$current(frame) mask color $mask(color)
$current(frame) mask mark $mask(mark)
+ $current(frame) mask range $mask(low) $mask(high)
$current(frame) mask system $mask(system)
}
}
@@ -216,6 +231,8 @@ proc MaskParamsDialog {} {
set ed(ok) 0
set ed(color) $mask(color)
set ed(mark) $mask(mark)
+ set ed(low) $mask(low)
+ set ed(high) $mask(high)
DialogCreate $w [msgcat::mc {Mask Parameters}] ed(ok)
@@ -229,15 +246,20 @@ proc MaskParamsDialog {} {
ColorMenuButton $f.colorbutton ed color {}
ttk::label $f.marktitle -text [msgcat::mc {Block}]
- ttk::radiobutton $f.markz -text [msgcat::mc {Zero}] \
- -variable ed(mark) -value 0
- ttk::radiobutton $f.marknz -text [msgcat::mc {Non-zero}] \
- -variable ed(mark) -value 1
- ttk::label $f.marktitle2 -text [msgcat::mc {Value}]
-
- grid $f.coordtitle $f.coordbutton - -padx 2 -pady 2 -sticky w
- grid $f.colortitle $f.colorbutton - -padx 2 -pady 2 -sticky w
- grid $f.marktitle $f.markz $f.marknz $f.marktitle2 -padx 2 -pady 2 -sticky w
+ ttk::radiobutton $f.zero -text [msgcat::mc {Zero}] \
+ -variable ed(mark) -value zero
+ ttk::radiobutton $f.nonzero -text [msgcat::mc {Non-zero}] \
+ -variable ed(mark) -value nonzero
+ ttk::radiobutton $f.range -text [msgcat::mc {Range}] \
+ -variable ed(mark) -value range
+ ttk::label $f.rangetitle -text [msgcat::mc {Range}]
+ ttk::entry $f.low -textvariable ed(low) -width 13
+ ttk::entry $f.high -textvariable ed(high) -width 13
+
+ grid $f.coordtitle $f.coordbutton - - - -padx 2 -pady 2 -sticky w
+ grid $f.colortitle $f.colorbutton - - - -padx 2 -pady 2 -sticky w
+ grid $f.marktitle $f.zero $f.nonzero $f.range -padx 2 -pady 2 -sticky w
+ grid $f.rangetitle $f.low - $f.high -padx 2 -pady 2 -sticky w
# Buttons
set f [ttk::frame $w.buttons]
@@ -260,6 +282,8 @@ proc MaskParamsDialog {} {
if {$ed(ok)} {
set mask(color) [string tolower $ed(color)]
set mask(mark) $ed(mark)
+ set mask(low) $ed(low)
+ set mask(high) $ed(high)
}
set rr $ed(ok)
@@ -270,6 +294,7 @@ proc MaskParamsDialog {} {
proc MaskBackup {ch which} {
puts $ch "$which mask color [$which get mask color]"
puts $ch "$which mask mark [$which get mask mark]"
+ puts $ch "$which mask range [$which get mask range]"
puts $ch "$which mask transparency [$which get mask transparency]"
}
diff --git a/ds9/parsers/masklex.fcl b/ds9/parsers/masklex.fcl
index 45d633f..cafe4b6 100644
--- a/ds9/parsers/masklex.fcl
+++ b/ds9/parsers/masklex.fcl
@@ -11,9 +11,12 @@ close {return $CLOSE_}
clear {return $CLEAR_}
color {return $COLOR_}
mark {return $MARK_}
+nonzero {return $NONZERO_}
open {return $OPEN_}
+range {return $RANGE_}
system {return $SYSTEM_}
transparency {return $TRANSPARENCY_}
+zero {return $ZERO_}
#include coordsys.fin
#include wcssys.fin
diff --git a/ds9/parsers/maskparser.tac b/ds9/parsers/maskparser.tac
index 6462738..8831f46 100644
--- a/ds9/parsers/maskparser.tac
+++ b/ds9/parsers/maskparser.tac
@@ -13,9 +13,12 @@
%token CLOSE_
%token COLOR_
%token MARK_
+%token NONZERO_
%token OPEN_
+%token RANGE_
%token SYSTEM_
%token TRANSPARENCY_
+%token ZERO_
%%
@@ -33,10 +36,16 @@ mask : {global parse; set parse(result) mask}
| CLEAR_ {MaskClear}
| COLOR_ STRING_ {ProcessCmdSet mask color $2 MaskColor}
| MARK_ INT_ {ProcessCmdSet mask mark $2 MaskMark}
+ | MARK_ mark {ProcessCmdSet mask mark $2 MaskMark}
| SYSTEM_ system
| TRANSPARENCY_ numeric {ProcessCmdSet mask transparency $2 MaskTransparency}
;
+mark : ZERO_ {set _ zero}
+ | NONZERO_ {set _ nonzero}
+ | RANGE_ {set _ range}
+ ;
+
system : coordsys {ProcessCmdSet mask system $1 MaskSystem}
| wcssys {ProcessCmdSet mask system $1 MaskSystem}
;
diff --git a/ds9/parsers/masksendlex.fcl b/ds9/parsers/masksendlex.fcl
index 378af08..71d11c8 100644
--- a/ds9/parsers/masksendlex.fcl
+++ b/ds9/parsers/masksendlex.fcl
@@ -9,6 +9,7 @@
color {return $COLOR_}
mark {return $MARK_}
+range {return $RANGE_}
system {return $SYSTEM_}
transparency {return $TRANSPARENCY_}
diff --git a/ds9/parsers/masksendparser.tac b/ds9/parsers/masksendparser.tac
index 9fdb15d..94d9acd 100644
--- a/ds9/parsers/masksendparser.tac
+++ b/ds9/parsers/masksendparser.tac
@@ -6,6 +6,7 @@
%token COLOR_
%token MARK_
+%token RANGE_
%token SYSTEM_
%token TRANSPARENCY_
@@ -13,6 +14,7 @@
masksend : COLOR_ {ProcessSendCmdGet mask color}
| MARK_ {ProcessSendCmdGet mask mark}
+ | RANGE_ {ProcessSendCmdGet2 mask low high}
| SYSTEM_ {ProcessSendCmdGet mask system}
| TRANSPARENCY_ {ProcessSendCmdGet mask transparency}
;