diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-04-09 21:49:55 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-04-09 21:49:55 (GMT) |
commit | 74a5fdbf2d4888441514bc19b103d4b8625d93bc (patch) | |
tree | 230ca77c6c1119063be28ffdbbe8715144c10f56 | |
parent | 7a577d726ae30a0f9cd2b24056323ea2f783002e (diff) | |
download | blt-74a5fdbf2d4888441514bc19b103d4b8625d93bc.zip blt-74a5fdbf2d4888441514bc19b103d4b8625d93bc.tar.gz blt-74a5fdbf2d4888441514bc19b103d4b8625d93bc.tar.bz2 |
add ds9 region parser
-rw-r--r-- | ds9/library/marker.tcl | 40 | ||||
-rw-r--r-- | ds9/parsers/regionparser.tac | 19 |
2 files changed, 34 insertions, 25 deletions
diff --git a/ds9/library/marker.tcl b/ds9/library/marker.tcl index f9b5618..a9df551 100644 --- a/ds9/library/marker.tcl +++ b/ds9/library/marker.tcl @@ -1418,7 +1418,7 @@ proc ProcessRegionsCmd {varname iname sock fn} { set marker(load,format) $marker(format) set marker(load,system) $marker(system) set marker(load,sky) $marker(sky) - set marker(group,tag) {} + set marker(tag) {} region::YY_FLUSH_BUFFER region::yy_scan_string [lrange $var $i end] @@ -1790,7 +1790,6 @@ proc ProcessRegionsCmd {varname iname sock fn} { undo {MarkerUndo} composite {CompositeCreate} - desolve - dissove {CompositeDelete} template { @@ -2001,12 +2000,9 @@ proc RegionCmdLoad {} { 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) - } + if {$current(frame) != {} && [$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) != {}} { @@ -2038,7 +2034,7 @@ proc RegionCmdSave {fn} { return } - $current(frame) marker save "\{$fn\}" $marker(format) \ + $current(frame) marker save $fn $marker(format) \ $marker(system) $marker(sky) $marker(skyformat) $marker(strip) FileLast markerfbox $fn } @@ -2056,7 +2052,7 @@ proc RegionCmdList {} { $marker(sky) $marker(skyformat) $marker(strip)] } -proc RegionCmdGroup {cmd value} { +proc RegionCmdGroup {cmd {val1 {}} {val2 {}}} { global current global marker @@ -2064,14 +2060,14 @@ proc RegionCmdGroup {cmd value} { return } - $current(frame) marker $marker(tag) $cmd $value + $current(frame) marker "\{$marker(tag)\}" $cmd $val1 $val2 UpdateGroupDialog } proc RegionCmdGroupTag {tag} { global marker - set marker(tag) $1 + set marker(tag) $tag } proc RegionCmdGroupNew {} { @@ -2083,10 +2079,10 @@ proc RegionCmdGroupNew {} { } set tag $marker(tag) - if {$marker(tag) == {}} { + if {$tag == {}} { set tag [$current(frame) get marker tag default name] } - $current(frame) marker tag $tag + $current(frame) marker tag "\{$tag\}" UpdateGroupDialog } @@ -2098,7 +2094,19 @@ proc RegionCmdGroupUpdate {} { return } - $current(frame) marker tag update $marker(tag) + $current(frame) marker tag update "\{$marker(tag)\}" + UpdateGroupDialog +} + +proc RegionCmdGroupFont {value} { + global current + global marker + + if {$current(frame) == {} || ![$current(frame) has fits]} { + return + } + + $current(frame) marker "\{$marker(tag)\}" font "\{$value\}" UpdateGroupDialog } @@ -2108,7 +2116,7 @@ proc RegionCmdTemplate {fn} { } proc RegionCmdTemplateAt {fn ra dec sys sky} { - LoadTemplateMarker $fn $ra $dec $sys $sky + LoadTemplateMarkerAt $fn $ra $dec $sys $sky FileLast templatefbox $fn } diff --git a/ds9/parsers/regionparser.tac b/ds9/parsers/regionparser.tac index 9df57d4..4ce32c5 100644 --- a/ds9/parsers/regionparser.tac +++ b/ds9/parsers/regionparser.tac @@ -173,6 +173,7 @@ region : {RegionCmdLoad} | GROUP_ group | COPY_ {MarkerCopy} | CUT_ {MarkerCut} + | PASTE_ {RegionCmdSet paste,system wcs MarkerPaste} | PASTE_ coordsys {RegionCmdSet paste,system $2 MarkerPaste} | PASTE_ wcssys {RegionCmdSet paste,system $2 MarkerPaste} # backward compatibility @@ -219,7 +220,7 @@ select : ALL_ {MarkerSelectAll} | NONE_ {MarkerUnselectAll} | INVERT_ {MarkerSelectInvert} # backward compatibility - | GROUP_ STRING_ {RegionCmdGroupTag $2; RegionCmdGroup select {}} + | GROUP_ STRING_ {RegionCmdGroupTag $2; RegionCmdGroup select} ; delete : ALL_ {MarkerDeleteAll} @@ -284,15 +285,15 @@ group : NEW_ {RegionCmdGroupNew} groupTag : NEW_ {RegionCmdGroupNew} | UPDATE_ {RegionCmdGroupUpdate} - | DELETE_ {RegionCmdGroup delete {} {}} - | SELECT_ {RegionCmdGroup select {} {}} - | COLOR_ STRING_ {RegionCmdGroup select $2 {}} - | COPY_ {RegionCmdGroup copy {} {}} - | CUT_ {RegionCmdGroup paste {} {}} - | FONT_ STRING_ {RegionCmdGroup font $2 {}} + | DELETE_ {RegionCmdGroup delete} + | SELECT_ {RegionCmdGroup select} + | COLOR_ STRING_ {RegionCmdGroup color $2} + | COPY_ {RegionCmdGroup copy} + | CUT_ {RegionCmdGroup cut} + | FONT_ STRING_ {RegionCmdGroupFont $2} | MOVE_ INT_ INT_ {RegionCmdGroup move $2 $3} - | MOVEFRONT_ {RegionCmdGroup {move front} {} {}} - | MOVEBACK_ {RegionCmdGroup {move back} {} {}} + | MOVEFRONT_ {RegionCmdGroup {move front}} + | MOVEBACK_ {RegionCmdGroup {move back}} | PROPERTY_ property yesno {RegionCmdGroup property $2 $3} ; |