summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-12-04 18:07:54 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-12-04 18:07:54 (GMT)
commit8fb015efefdc98fee3d3bc28c79486423d649307 (patch)
treed0fdc799a7dc7f9ab834297938cf4fcb925485aa
parent526141b885e57d365dd59e388188ec19def3fe3f (diff)
downloadblt-8fb015efefdc98fee3d3bc28c79486423d649307.zip
blt-8fb015efefdc98fee3d3bc28c79486423d649307.tar.gz
blt-8fb015efefdc98fee3d3bc28c79486423d649307.tar.bz2
update AST WCS
-rw-r--r--tksao/frame/basecommand.C16
-rw-r--r--tksao/frame/fitsimage.h6
-rw-r--r--tksao/frame/fitsmap.C37
-rw-r--r--tksao/frame/frame3dbase.C2
-rw-r--r--tksao/frame/frblt.C2
-rw-r--r--tksao/frame/grid3d.C22
6 files changed, 55 insertions, 30 deletions
diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C
index ace162e..cf9ccad 100644
--- a/tksao/frame/basecommand.C
+++ b/tksao/frame/basecommand.C
@@ -568,8 +568,8 @@ void Base::crop3dCmd(double z0, double z1, Coord::CoordSystem sys)
return;
// ff/tt in data coords
- double ff = ptr->mapToImage3axis(z0,sys)-.5;
- double tt = ptr->mapToImage3axis(z1,sys)-.5;
+ double ff = ptr->mapToImage3d(z0,sys)-.5;
+ double tt = ptr->mapToImage3d(z1,sys)-.5;
// params is a BBOX in DATA coords 0-n
currentContext->setCrop3dParams(ff-.5,tt+.5);
@@ -1385,9 +1385,9 @@ void Base::getCoord3axisCmd(double vv, Coord::CoordSystem in,
else {
// use first slice
if (out == Coord::IMAGE)
- printDouble(currentContext->fits->mapToImage3axis(vv,in));
+ printDouble(currentContext->fits->mapToImage3d(vv,in));
else
- printDouble(currentContext->fits->mapFromImage3axis(vv,out));
+ printDouble(currentContext->fits->mapFromImage3d(vv,out));
}
}
else
@@ -1441,8 +1441,8 @@ void Base::getCrop3dCmd(Coord::CoordSystem sys)
FitsZBound* zparams =
currentContext->getDataParams(currentContext->secMode());
- double ff = ptr->mapFromImage3axis(zparams->zmin+.5+.5,sys);
- double tt = ptr->mapFromImage3axis(zparams->zmax-.5+.5,sys);
+ double ff = ptr->mapFromImage3d(zparams->zmin+.5+.5,sys);
+ double tt = ptr->mapFromImage3d(zparams->zmax-.5+.5,sys);
ostringstream str;
str << ff << ' ' << tt << ends;
@@ -1794,7 +1794,7 @@ void Base::getFitsSliceCmd(int id, Coord::CoordSystem sys)
{
if (currentContext->fits) {
int ss = currentContext->slice(id);
- printDouble(currentContext->fits->mapFromImage3axis(ss,sys));
+ printDouble(currentContext->fits->mapFromImage3d(ss,sys));
}
else
Tcl_AppendResult(interp, "1", NULL);
@@ -2826,7 +2826,7 @@ void Base::sliceCmd(int id, int ss)
void Base::sliceCmd(int id, double vv, Coord::CoordSystem sys)
{
- int ss = currentContext->fits->mapToImage3axis(vv,sys);
+ int ss = currentContext->fits->mapToImage3d(vv,sys);
// IMAGE (ranges 1-n)
setSlice(id,ss);
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index fd5e5a4..4cb721f 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -456,9 +456,9 @@ class FitsImage {
Vector3d mapFromRef(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame =Coord::FK5);
Vector3d mapToRef(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame =Coord::FK5);
#endif
- double mapFromRef3axis(double, Coord::CoordSystem);
- double mapFromImage3axis(double, Coord::CoordSystem);
- double mapToImage3axis(double, Coord::CoordSystem);
+ double mapFromImage3d(double, Coord::CoordSystem);
+ double mapToImage3d(double, Coord::CoordSystem);
+
double mapLenFromRef(double, Coord::CoordSystem, Coord::DistFormat =Coord::DEGREE);
Vector mapLenFromRef(const Vector&, Coord::CoordSystem, Coord::DistFormat =Coord::DEGREE);
double mapLenToRef(double, Coord::CoordSystem, Coord::DistFormat =Coord::DEGREE);
diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C
index e25943c..59924f4 100644
--- a/tksao/frame/fitsmap.C
+++ b/tksao/frame/fitsmap.C
@@ -518,18 +518,43 @@ void FitsImage::listDistFromRef(ostream& str,
// 3D
-double FitsImage::mapFromImage3axis(double vv, Coord::CoordSystem sys)
+#ifndef NEWWCS
+double FitsImage::mapFromImage3d(double dd, Coord::CoordSystem sys)
{
if (sys >= Coord::WCS)
- return pix2wcsx(vv,sys);
+ return pix2wcsx(dd,sys);
else
- return vv;
+ return dd;
}
-double FitsImage::mapToImage3axis(double vv, Coord::CoordSystem sys)
+double FitsImage::mapToImage3d(double dd, Coord::CoordSystem sys)
{
if (sys >= Coord::WCS)
- return wcs2pixx(vv,sys);
+ return wcs2pixx(dd,sys);
+ else
+ return dd;
+}
+#else
+double FitsImage::mapFromImage3d(double dd, Coord::CoordSystem sys)
+{
+ if (hasWCS(sys)) {
+ Vector3d cc(center(),dd);
+ Vector3d rr = pix2wcs(cc,sys,Coord::FK5);
+ return rr[2];
+ }
else
- return vv;
+ return dd;
}
+
+double FitsImage::mapToImage3d(double dd, Coord::CoordSystem sys)
+{
+ if (hasWCS(sys)) {
+ Vector3d cc(center(),1);
+ Vector3d wcc = pix2wcs(cc,sys,Coord::FK5);
+ Vector3d rr = wcs2pix(Vector3d(wcc[0],wcc[1],dd),sys,Coord::FK5);
+ return rr[2];
+ }
+ else
+ return dd;
+}
+#endif
diff --git a/tksao/frame/frame3dbase.C b/tksao/frame/frame3dbase.C
index 0708441..3317ea8 100644
--- a/tksao/frame/frame3dbase.C
+++ b/tksao/frame/frame3dbase.C
@@ -210,7 +210,7 @@ void Frame3dBase::coordToTclArray(FitsImage* ptr, const Vector3d& vv,
doubleToTclArray(rr[0], var, base, "x");
doubleToTclArray(rr[1], var, base, "y");
- double ss = ptr->mapFromImage3axis(((Vector3d&)vv)[2]+.5,out);
+ double ss = ptr->mapFromImage3d(((Vector3d&)vv)[2]+.5,out);
doubleToTclArray(ss, var, base, "z");
}
#else
diff --git a/tksao/frame/frblt.C b/tksao/frame/frblt.C
index ba3d6b9..233177f 100644
--- a/tksao/frame/frblt.C
+++ b/tksao/frame/frblt.C
@@ -283,7 +283,7 @@ int Base::markerAnalysisPlot3d(Marker* pp, double** x, double** y,
// main loop
SETSIGBUS
for (int kk=0; kk<srcd; kk++) {
- (*x)[kk] = ptr->mapFromImage3axis(kk+.5+.5+zparams->zmin, sys);
+ (*x)[kk] = ptr->mapFromImage3d(kk+.5+.5+zparams->zmin, sys);
bool* mptr=msk;
long* iptr=idx;
diff --git a/tksao/frame/grid3d.C b/tksao/frame/grid3d.C
index 6850c2f..ef155c9 100644
--- a/tksao/frame/grid3d.C
+++ b/tksao/frame/grid3d.C
@@ -11,6 +11,17 @@ extern "C" {
#include "ast.h"
}
+extern Grid3dBase* astGrid3dPtr;
+
+Grid3d::Grid3d(Widget* p, Coord::CoordSystem sys, Coord::SkyFrame sky,
+ Coord::SkyFormat format, GridType t,
+ const char* o, const char* v)
+ : Grid(sys, sky, format, t, v), Grid3dBase(p,o)
+{}
+
+Grid3d::~Grid3d()
+{}
+
static FitsImage* foobar;
void bar(AstMapping* that, int npoint, int ncoord_in, const double* ptr_in[],
@@ -30,17 +41,6 @@ void bar(AstMapping* that, int npoint, int ncoord_in, const double* ptr_in[],
}
}
-extern Grid3dBase* astGrid3dPtr;
-
-Grid3d::Grid3d(Widget* p, Coord::CoordSystem sys, Coord::SkyFrame sky,
- Coord::SkyFormat format, GridType t,
- const char* o, const char* v)
- : Grid(sys, sky, format, t, v), Grid3dBase(p,o)
-{}
-
-Grid3d::~Grid3d()
-{}
-
int Grid3d::doit(RenderMode rm)
{
Frame3dBase* pp = (Frame3dBase*)parent_;