diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-06-25 20:32:45 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-06-25 20:32:45 (GMT) |
commit | 945cefd1c2cea28c63615cd19a197c465b32c48c (patch) | |
tree | 9399df61a03a5d215e17ebaef1b81779256f87d0 /ds9 | |
parent | 0e20becb38cf971f8382a6d45b56d2eb9f6d3a12 (diff) | |
download | blt-945cefd1c2cea28c63615cd19a197c465b32c48c.zip blt-945cefd1c2cea28c63615cd19a197c465b32c48c.tar.gz blt-945cefd1c2cea28c63615cd19a197c465b32c48c.tar.bz2 |
add support for compressed regions files
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/doc/release/r8.0.html | 1 | ||||
-rw-r--r-- | ds9/library/hvsup.tcl | 4 | ||||
-rw-r--r-- | ds9/library/load.tcl | 18 | ||||
-rw-r--r-- | ds9/library/marker.tcl | 29 |
4 files changed, 28 insertions, 24 deletions
diff --git a/ds9/doc/release/r8.0.html b/ds9/doc/release/r8.0.html index c229c14..5e1022c 100644 --- a/ds9/doc/release/r8.0.html +++ b/ds9/doc/release/r8.0.html @@ -24,6 +24,7 @@ <li><tt>06.15.2018 IIS: fixed a problem the values displayed on the colorbar.</tt></li> <li><tt>06.22.2018 API: All new parser/lexer for each command, backward compatible API. Parser will detect syntax errors, and suggest legal options.</tt></li> <li><tt>06.22.2018 CAT: updated catalog menu items for GAIA, UCAC, and SDSS.</tt></li> + <li><tt>06.25.2018 REGIONS: added support for compressed regions files.</tt></li> <li><tt><b>xx.xx.2018 RELEASE version 8.0b1</b></tt></li> </ol> </ol> diff --git a/ds9/library/hvsup.tcl b/ds9/library/hvsup.tcl index 7e2a8da..b97282d 100644 --- a/ds9/library/hvsup.tcl +++ b/ds9/library/hvsup.tcl @@ -703,10 +703,6 @@ proc HVLoadFile {varname path} { set path [file rootname $path] set var(encoding) compress } - .z { - set path [file rootname $path] - set var(encoding) pack - } } switch -- [string tolower [file extension $path]] { diff --git a/ds9/library/load.tcl b/ds9/library/load.tcl index 714f962..ef9a085 100644 --- a/ds9/library/load.tcl +++ b/ds9/library/load.tcl @@ -285,7 +285,7 @@ proc IsLocalFile {fn} { } proc ConvertFitsFile {} { - foreach t {Stdin ExternalFits GzipFile BZip2File CompressFile PackFile} { + foreach t {Stdin ExternalFits GzipFile BZip2File CompressFile} { if {[$t]} { return } @@ -293,7 +293,7 @@ proc ConvertFitsFile {} { } proc ConvertArrayFile {} { - foreach t {Stdin GzipFile BZip2File CompressFile PackFile} { + foreach t {Stdin GzipFile BZip2File CompressFile} { if {[$t]} { return } @@ -349,20 +349,6 @@ proc CompressFile {} { return 0 } -proc PackFile {} { - global loadParam - - if {[regexp {(.*)\.z($|\[)} $loadParam(file,name) matched root]} { - if {[catch {set ch [open "| pcat $root.z " r]}]} { - return 0 - } - set loadParam(load,type) channel - set loadParam(channel,name) $ch - return 1 - } - return 0 -} - proc GzipFile {} { global loadParam diff --git a/ds9/library/marker.tcl b/ds9/library/marker.tcl index 4c2ebf6..317a1a7 100644 --- a/ds9/library/marker.tcl +++ b/ds9/library/marker.tcl @@ -1124,7 +1124,25 @@ proc MarkerLoadFile {filename which format sys sky} { return } + # is it compressed? + set app {} + switch [file extension $filename] { + .gz {set app gunzip} + .bz - + .bz2 {set app bunzip2} + .Z {set app uncompress} + } + if {$app != {}} { + set srcfilename $filename + set filename [tmpnam [file ext [file rootname $filename]]] + if {[catch {exec $app < $srcfilename > $filename} rr]} { + Error "[msgcat::mc {Unable to load compressed region file}]\n$rr" + return -code error + } + } + # determine if its a fits file + # look for hdu ext in the filename # first, strip the filename if {![regexp -nocase {(.*)(\[.*\])} $filename foo base ext]} { set base $filename @@ -1143,15 +1161,15 @@ proc MarkerLoadFile {filename which format sys sky} { if {$ll == "SIMPLE ="} { # see if we need to add an extension if {$ext == {}} { - set filename "$base\[REGION\]" + set regfilename "$base\[REGION\]" } # open it - if {[catch {$which marker load fits "\{$filename\}" $marker(color) $marker(dashlist) $marker(width) "\{$marker(font) $marker(font,size) $marker(font,weight) $marker(font,slant)\}"}]} { + if {[catch {$which marker load fits "\{$regfilename\}" $marker(color) $marker(dashlist) $marker(width) "\{$marker(font) $marker(font,size) $marker(font,weight) $marker(font,slant)\}"}]} { if {$ext == {}} { # ok now try the first extension - set filename "$base\[1\]" - if {[catch {$which marker load fits "\{$filename\}" $marker(color) $marker(dashlist) $marker(width) "\{$marker(font) $marker(font,size) $marker(font,weight) $marker(font,slant)\}"}]} { + set regfilename "$base\[1\]" + if {[catch {$which marker load fits "\{$regfilename\}" $marker(color) $marker(dashlist) $marker(width) "\{$marker(font) $marker(font,size) $marker(font,weight) $marker(font,slant)\}"}]} { Error [msgcat::mc {Unable to load region file}] return -code error } @@ -1171,6 +1189,9 @@ proc MarkerLoadFile {filename which format sys sky} { } } + if {$app != {}} { + file delete -force $filename + } FileLast markerfbox $filename UpdateGroupDialog } |