summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ds9/library/coord.tcl2
-rw-r--r--ds9/library/info.tcl97
-rw-r--r--tksao/frame/basecommand.C2
-rw-r--r--tksao/frame/fitsimage.C90
-rw-r--r--tksao/frame/fitsimage.h5
-rw-r--r--tksao/frame/frame3dbase.C29
-rw-r--r--tksao/frame/framebase.C23
7 files changed, 144 insertions, 104 deletions
diff --git a/ds9/library/coord.tcl b/ds9/library/coord.tcl
index 2d40cc0..27a2374 100644
--- a/ds9/library/coord.tcl
+++ b/ds9/library/coord.tcl
@@ -153,7 +153,7 @@ proc DisplayCoordDialog {which x y} {
append rr " \n"
SimpleTextDialog coordtxt [msgcat::mc {Coordinates}] \
- 80 20 append bottom "$r"
+ 80 20 append bottom "$rr"
}
proc PrefsDialogCoord {} {
diff --git a/ds9/library/info.tcl b/ds9/library/info.tcl
index 405b13e..1ecdaf4 100644
--- a/ds9/library/info.tcl
+++ b/ds9/library/info.tcl
@@ -34,10 +34,10 @@ proc CreateInfoPanel {} {
ttk::label $ds9(info).minValue -relief groove \
-textvariable infobox(min) -anchor center
- ttk::label $ds9(info).minXLabel -text {X}
+ ttk::label $ds9(info).minXLabel -text {x}
ttk::label $ds9(info).minXValue -relief groove \
-textvariable infobox(min,x) -anchor center
- ttk::label $ds9(info).minYLabel -text {Y}
+ ttk::label $ds9(info).minYLabel -text {y}
ttk::label $ds9(info).minYValue -relief groove \
-textvariable infobox(min,y) -anchor center
@@ -45,10 +45,10 @@ proc CreateInfoPanel {} {
ttk::label $ds9(info).maxValue -relief groove \
-textvariable infobox(max) -anchor center
- ttk::label $ds9(info).maxXLabel -text {X}
+ ttk::label $ds9(info).maxXLabel -text {x}
ttk::label $ds9(info).maxXValue -relief groove \
-textvariable infobox(max,x) -anchor center
- ttk::label $ds9(info).maxYLabel -text {Y}
+ ttk::label $ds9(info).maxYLabel -text {y}
ttk::label $ds9(info).maxYValue -relief groove \
-textvariable infobox(max,y) -anchor center
@@ -93,46 +93,46 @@ proc CreateInfoPanel {} {
}
ttk::label $ds9(info).detectorTitle -text [msgcat::mc {Detector}]
- ttk::label $ds9(info).detectorXLabel -text {X}
+ ttk::label $ds9(info).detectorXLabel -text {x}
ttk::label $ds9(info).detectorXValue -relief groove \
-textvariable infobox(detector,x) -anchor center
- ttk::label $ds9(info).detectorYLabel -text {Y}
+ ttk::label $ds9(info).detectorYLabel -text {y}
ttk::label $ds9(info).detectorYValue -relief groove \
-textvariable infobox(detector,y) -anchor center
- ttk::label $ds9(info).detectorZLabel -text {Z}
+ ttk::label $ds9(info).detectorZLabel -text {z}
ttk::label $ds9(info).detectorZValue -relief groove \
-textvariable infobox(detector,z) -anchor center
ttk::label $ds9(info).amplifierTitle -text [msgcat::mc {Amplifier}]
- ttk::label $ds9(info).amplifierXLabel -text {X}
+ ttk::label $ds9(info).amplifierXLabel -text {x}
ttk::label $ds9(info).amplifierXValue -relief groove \
-textvariable infobox(amplifier,x) -anchor center
- ttk::label $ds9(info).amplifierYLabel -text {Y}
+ ttk::label $ds9(info).amplifierYLabel -text {y}
ttk::label $ds9(info).amplifierYValue -relief groove \
-textvariable infobox(amplifier,y) -anchor center
- ttk::label $ds9(info).amplifierZLabel -text {Z}
+ ttk::label $ds9(info).amplifierZLabel -text {z}
ttk::label $ds9(info).amplifierZValue -relief groove \
-textvariable infobox(amplifier,z) -anchor center
ttk::label $ds9(info).physicalTitle -text [msgcat::mc {Physical}]
- ttk::label $ds9(info).physicalXLabel -text {X}
+ ttk::label $ds9(info).physicalXLabel -text {x}
ttk::label $ds9(info).physicalXValue -relief groove \
-textvariable infobox(physical,x) -anchor center
- ttk::label $ds9(info).physicalYLabel -text {Y}
+ ttk::label $ds9(info).physicalYLabel -text {y}
ttk::label $ds9(info).physicalYValue -relief groove \
-textvariable infobox(physical,y) -anchor center
- ttk::label $ds9(info).physicalZLabel -text {Z}
+ ttk::label $ds9(info).physicalZLabel -text {z}
ttk::label $ds9(info).physicalZValue -relief groove \
-textvariable infobox(physical,z) -anchor center
ttk::label $ds9(info).imageTitle -text [msgcat::mc {Image}]
- ttk::label $ds9(info).imageXLabel -text {X}
+ ttk::label $ds9(info).imageXLabel -text {x}
ttk::label $ds9(info).imageXValue -relief groove \
-textvariable infobox(image,x) -anchor center
- ttk::label $ds9(info).imageYLabel -text {Y}
+ ttk::label $ds9(info).imageYLabel -text {y}
ttk::label $ds9(info).imageYValue -relief groove \
-textvariable infobox(image,y) -anchor center
- ttk::label $ds9(info).imageZLabel -text {Z}
+ ttk::label $ds9(info).imageZLabel -text {z}
ttk::label $ds9(info).imageZValue -relief groove \
-textvariable infobox(image,z) -anchor center
@@ -554,37 +554,44 @@ proc UpdateInfoBox {which x y sys} {
foreach ll {{} a b c d e f g h i j k l m n o p q r s t u v w x y z} {
if {$view(info,wcs$ll)} {
- foreach aa {x y z} {
- switch $infobox(wcs$ll,$aa,sys) {
- RA {
- $infobox(wcs$ll,$aa,nm) configure -text "\u03b1" \
- -font "$ds9(times) $fsz"
- }
- Dec {
- $infobox(wcs$ll,$aa,nm) configure -text "\u03b4" \
- -font "$ds9(times) $fsz"
- }
- l {
- $infobox(wcs$ll,$aa,nm) configure -text {l} -font \
- "{$ds9(times)} $pds9(font,size) normal italic"
- }
- b {
- $infobox(wcs$ll,$aa,nm) configure -text {b} -font \
- "{$ds9(times)} $pds9(font,size) normal italic"
- }
- Lambda {
- $infobox(wcs$ll,$aa,nm) configure -text "\u03bb" \
- -font "$ds9(times) $fsz"
- }
- Beta {
- $infobox(wcs$ll,$aa,nm) configure -text "\u03b2" \
- -font "$ds9(times) $fsz"
- }
- default {
- $infobox(wcs$ll,$aa,nm) configure \
- -text [string range $infobox(wcs$ll,$aa,sys) 0 0]
+ if {[$which has wcs wcs$ll]} {
+ foreach aa {x y z} {
+ switch $infobox(wcs$ll,$aa,sys) {
+ RA {
+ $infobox(wcs$ll,$aa,nm) configure -text "\u03b1" \
+ -font "$ds9(times) $fsz"
+ }
+ Dec {
+ $infobox(wcs$ll,$aa,nm) configure -text "\u03b4" \
+ -font "$ds9(times) $fsz"
+ }
+ l {
+ $infobox(wcs$ll,$aa,nm) configure -text {l} -font \
+ "{$ds9(times)} $pds9(font,size) normal italic"
+ }
+ b {
+ $infobox(wcs$ll,$aa,nm) configure -text {b} -font \
+ "{$ds9(times)} $pds9(font,size) normal italic"
+ }
+ Lambda {
+ $infobox(wcs$ll,$aa,nm) configure -text "\u03bb" \
+ -font "$ds9(times) $fsz"
+ }
+ Beta {
+ $infobox(wcs$ll,$aa,nm) configure -text "\u03b2" \
+ -font "$ds9(times) $fsz"
+ }
+ default {
+ $infobox(wcs$ll,$aa,nm) configure -text $aa \
+ -font "$ds9(times) $fsz"
+ }
}
}
+ } else {
+ set infobox(wcs$ll,sys) "WCS $ll"
+ $infobox(wcs$ll,x,nm) configure -text {}
+ $infobox(wcs$ll,y,nm) configure -text {}
+ $infobox(wcs$ll,z,nm) configure -text {}
}
}
}
diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C
index 4233057..b44b18e 100644
--- a/tksao/frame/basecommand.C
+++ b/tksao/frame/basecommand.C
@@ -2126,7 +2126,7 @@ void Base::getWCSAlignPointerCmd()
void Base::getWCSNameCmd(Coord::CoordSystem sys)
{
if (currentContext->cfits && currentContext->cfits->hasWCS(sys)) {
- char* name = (char*)currentContext->cfits->getWCSName(sys);
+ char* name = (char*)currentContext->cfits->getWCSDomain(sys);
if (name) {
Tcl_AppendResult(interp, name, NULL);
return;
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index b360a75..d86c33f 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -2689,21 +2689,47 @@ double FitsImage::getWCSDist(const Vector& vv1, const Vector& vv2,
wcsDistance(ast_,vv1,vv2);
}
-const char* FitsImage::getWCSName(Coord::CoordSystem sys)
+const char* FitsImage::getWCSDomain(Coord::CoordSystem sys)
{
- if (fits_->find("WCSNAME"))
- return fits_->getString("WCSNAME");
- else
+ if (!hasWCS(sys))
return NULL;
+
+ astClearStatus; // just to make sure
+ astBegin; // start memory management
+
+ wcsSystem(ast_,sys);
+
+ astEnd;
+
+ const char* domain = astGetC(ast_, "Domain");
+ return domain;
}
-const char* FitsImage::getWCSAxisName(Coord::CoordSystem sys, int axis)
+const char* FitsImage::getWCSSystem(Coord::CoordSystem sys)
{
if (!hasWCSCel(sys))
return NULL;
+ astClearStatus; // just to make sure
+ astBegin; // start memory management
+
+ AstFrameSet* fs =
+ (AstFrameSet*)astFindFrame(ast_, astSkyFrame(" MaxAxes=4")," ");
+ const char* str =NULL;
+ if (fs)
+ str = astGetC(fs, "System");
+
+ astEnd;
+ return str;
+}
+
+const char* FitsImage::getWCSAxisSymbol(Coord::CoordSystem sys, int axis)
+{
+ if (!hasWCS(sys))
+ return NULL;
+
int id = sys-Coord::WCS;
- if (wcsNaxes_[id] < axis)
+ if (wcsNaxes_[id] <= axis)
return NULL;
ostringstream str;
@@ -2729,8 +2755,8 @@ Vector FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys,
if (astOK && checkWCS(out))
return hasWCSCel(sys) ? zero360(radToDeg(out)) : out;
- else
- return Vector();
+
+ return Vector();
}
char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys,
@@ -2765,7 +2791,7 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys,
Vector3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys,
Coord::SkyFrame sky)
{
- if (!hasWCS(sys))
+ if (!(hasWCS(sys) && hasWCS3D(sys)))
return Vector();
astClearStatus; // just to make sure
@@ -2793,7 +2819,7 @@ char* FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys,
lbuf[0] = '\0';
- if (!hasWCS(sys))
+ if (!(hasWCS(sys) && hasWCS3D(sys)))
return lbuf;
wcsSystem(ast_,sys);
@@ -2820,19 +2846,22 @@ Vector FitsImage::wcs2pix(const Vector& vv, Coord::CoordSystem sys,
astClearStatus; // just to make sure
astBegin; // start memory management
- if (hasWCS(sys) && wcsInv_) {
- wcsSystem(ast_,sys);
- wcsSkyFrame(ast_,sky);
+ if (!(hasWCS(sys) && wcsInv_)) {
+ maperr =1;
+ return Vector();
+ }
- Vector in = hasWCSCel(sys) ? degToRad(vv) : vv;
- Vector out = wcsTran(ast_, in, 0);
- astEnd;
+ wcsSystem(ast_,sys);
+ wcsSkyFrame(ast_,sky);
+
+ Vector in = hasWCSCel(sys) ? degToRad(vv) : vv;
+ Vector out = wcsTran(ast_, in, 0);
+
+ astEnd;
- if (astOK && checkWCS(out))
- return out;
- }
+ if (astOK && checkWCS(out))
+ return out;
- astEnd;
maperr =1;
return Vector();
}
@@ -2840,22 +2869,23 @@ Vector FitsImage::wcs2pix(const Vector& vv, Coord::CoordSystem sys,
Vector3d FitsImage::wcs2pix(const Vector3d& vv, Coord::CoordSystem sys,
Coord::SkyFrame sky)
{
+ if (!(hasWCS(sys) && hasWCS3D(sys) && wcsInv_))
+ return Vector3d();
+
astClearStatus; // just to make sure
astBegin; // start memory management
- if (hasWCS(sys) && wcsInv_) {
- wcsSystem(ast_,sys);
- wcsSkyFrame(ast_,sky);
+ wcsSystem(ast_,sys);
+ wcsSkyFrame(ast_,sky);
- Vector3d in = hasWCSCel(sys) ? degToRad(vv) : vv;
- Vector3d out = wcsTran(ast_, in, 0);
- astEnd;
-
- if (astOK && checkWCS(out))
- return out;
- }
+ Vector3d in = hasWCSCel(sys) ? degToRad(vv) : vv;
+ Vector3d out = wcsTran(ast_, in, 0);
astEnd;
+
+ if (astOK && checkWCS(out))
+ return out;
+
return Vector3d();
}
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index f4b9941..ff28012 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -382,8 +382,9 @@ class FitsImage {
Coord::Orientation getWCSOrientation(Coord::CoordSystem, Coord::SkyFrame);
double getWCSRotation(Coord::CoordSystem, Coord::SkyFrame);
double getWCSDist(const Vector&, const Vector&, Coord::CoordSystem);
- const char* getWCSName(Coord::CoordSystem);
- const char* getWCSAxisName(Coord::CoordSystem, int);
+ const char* getWCSDomain(Coord::CoordSystem);
+ const char* getWCSSystem(Coord::CoordSystem);
+ const char* getWCSAxisSymbol(Coord::CoordSystem, int);
double getWCSSize(Coord::CoordSystem);
double calcWCSSize(Coord::CoordSystem);
diff --git a/tksao/frame/frame3dbase.C b/tksao/frame/frame3dbase.C
index cd411e9..d912e86 100644
--- a/tksao/frame/frame3dbase.C
+++ b/tksao/frame/frame3dbase.C
@@ -185,27 +185,28 @@ void Frame3dBase::getInfoWCS(char* var, Vector3d& rr, FitsImage* ptr,
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z"),"",0);
- char* xname = (char*)sptr->getWCSAxisName(www,0);
- if (xname)
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),xname,0);
+ char* xsym = (char*)sptr->getWCSAxisSymbol(www,0);
+ if (xsym)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),xsym,0);
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"x",0);
- char* yname = (char*)sptr->getWCSAxisName(www,1);
- if (yname)
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),yname,0);
+ char* ysym = (char*)sptr->getWCSAxisSymbol(www,1);
+ if (ysym)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),ysym,0);
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"y",0);
- char* zname = (char*)sptr->getWCSAxisName(www,2);
- if (zname)
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),zname,0);
+ char* zsym = (char*)sptr->getWCSAxisSymbol(www,2);
+ if (zsym)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),zsym,0);
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),"z",0);
- char* wcsname = (char*)sptr->getWCSName(www);
- if (sptr->hasWCSCel(www))
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),coord.skyFrameStr(wcsSkyFrame_),0);
- else if (wcsname)
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),wcsname,0);
+ char* system = (char*)sptr->getWCSSystem(www);
+ char* domain = (char*)sptr->getWCSDomain(www);
+ if (system)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),system,0);
+ else if (domain)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),domain,0);
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),coord.coordSystemStr(www),0);
diff --git a/tksao/frame/framebase.C b/tksao/frame/framebase.C
index 0b99786..0ebe878 100644
--- a/tksao/frame/framebase.C
+++ b/tksao/frame/framebase.C
@@ -162,22 +162,23 @@ void FrameBase::getInfoWCS(char* var, Vector& rr, FitsImage* ptr,
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0);
- char* xname = (char*)sptr->getWCSAxisName(www,0);
- if (xname)
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),xname,0);
+ char* xsym = (char*)sptr->getWCSAxisSymbol(www,0);
+ if (xsym)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),xsym,0);
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"x",0);
- char* yname = (char*)sptr->getWCSAxisName(www,1);
- if (yname)
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),yname,0);
+ char* ysym = (char*)sptr->getWCSAxisSymbol(www,1);
+ if (ysym)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),ysym,0);
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"y",0);
- char* wcsname = (char*)sptr->getWCSName(www);
- if (sptr->hasWCSCel(www))
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),coord.skyFrameStr(wcsSkyFrame_),0);
- else if (wcsname)
- Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),wcsname,0);
+ char* system = (char*)sptr->getWCSSystem(www);
+ char* domain = (char*)sptr->getWCSDomain(www);
+ if (system)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),system,0);
+ else if (domain)
+ Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),domain,0);
else
Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),coord.coordSystemStr(www),0);