diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-04-06 21:20:41 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-04-06 21:20:41 (GMT) |
commit | cf03e9e3151dd8897adb5183b7f236e87a2107c8 (patch) | |
tree | 407eb4edb93d0d16ef5c611f6fdf3158e2931b74 /ds9/library/marker.tcl | |
parent | 11376f9238353b2c2fc2df9d1c42a622ed93278b (diff) | |
download | blt-cf03e9e3151dd8897adb5183b7f236e87a2107c8.zip blt-cf03e9e3151dd8897adb5183b7f236e87a2107c8.tar.gz blt-cf03e9e3151dd8897adb5183b7f236e87a2107c8.tar.bz2 |
add ds9 region parser
Diffstat (limited to 'ds9/library/marker.tcl')
-rw-r--r-- | ds9/library/marker.tcl | 115 |
1 files changed, 111 insertions, 4 deletions
diff --git a/ds9/library/marker.tcl b/ds9/library/marker.tcl index 28d14ca..453a9bc 100644 --- a/ds9/library/marker.tcl +++ b/ds9/library/marker.tcl @@ -61,6 +61,13 @@ proc MarkerDef {} { set marker(skyformat) degrees set marker(strip) 0 + # temp + set marker(load,format) $marker(format) + set marker(load,system) $marker(system) + set marker(load,sky) $marker(sky) + set marker(load,sock) {} + set marker(load,fn) {} + array set pmarker [array get marker] unset pmarker(copy) unset pmarker(copy,system) @@ -71,6 +78,12 @@ proc MarkerDef {} { unset pmarker(skyformat) unset pmarker(strip) + unset pmarker(load,format) + unset pmarker(load,system) + unset pmarker(load,sky) + unset pmarker(load,sock) + unset pmarker(load,fn) + set pmarker(epsilon) 3 set pmarker(dformat) degrees set pmarker(circle,radius) 20 @@ -1391,15 +1404,29 @@ proc MarkerBackup {ch which fdir rdir} { proc ProcessRegionsCmd {varname iname sock fn} { upvar $varname var upvar $iname i - - global ds9 - global current global marker - global pmarker # we need to be realized ProcessRealizeDS9 + global debug + if {$debug(tcl,parser)} { + set marker(load,sock) $sock + set marker(load,fn) $fn + set marker(load,format) $marker(format) + set marker(load,system) $marker(system) + set marker(load,sky) $marker(sky) + + region::YY_FLUSH_BUFFER + region::yy_scan_string [lrange $var $i end] + region::yyparse + incr i [expr $region::yycnt-1] + } else { + + global ds9 + global current + global pmarker + switch -- [string tolower [lindex $var $i]] { epsilon { incr i @@ -1944,6 +1971,86 @@ proc ProcessRegionsCmd {varname iname sock fn} { } } } +} + +proc RegionCmdSet {which value {cmd {}}} { + global bin + + set marker($which) $value + if {$cmd != {}} { + eval $cmd + } +} + +proc PRegionCmdSet {which value {cmd {}}} { + global bin + + set pmarker($which) $value + if {$cmd != {}} { + eval $cmd + } +} + +proc RegionCmdLoad {} { + global marker + global current + + if {$marker(load,sock) != {}} { + # xpa path + # fits regions files not supported + if {$current(frame) != {}} { + if {[$current(frame) has fits]} { + $current(frame) marker load \ + $marker(load,format) $marker(load,sock) \ + $marker(load,system) $marker(load,sky) + } + } + UpdateGroupDialog + } elseif {$marker(load,fn) != {}} { + # samp path + MarkerLoadFrames $fn $current(frame) \ + $marker(load,format) $marker(load,system) $marker(load,sky) + } +} + +proc RegionCmdLoadFn {fn all} { + global marker + global ds9 + + if {$all} { + set frames $ds9(frames) + } else { + set frames $current(frame) + } + MarkerLoadFrames $fn $frames \ + $marker(load,format) $marker(load,system) $marker(load,sky) +} + +proc RegionCmdSaveFn {fn} { + global marker + global current + + if {$current(frame) == {} || ![$current(frame) has fits]} { + return + } + + $current(frame) marker save "\{$fn\}" $marker(format) \ + $marker(system) $marker(sky) $marker(skyformat) $marker(strip) + FileLast markerfbox $fn +} + +proc RegionCmdList {} { + global marker + global current + + if {$current(frame) == {} || ![$current(frame) has fits]} { + return + } + + SimpleTextDialog markertxt [msgcat::mc {Region}] 80 20 insert top \ + [$current(frame) marker list $marker(format) $marker(system) \ + $marker(sky) $marker(skyformat) $marker(strip)] +} proc ProcessSendRegionsCmd {proc id param sock fn} { global current |