diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-15 19:53:44 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-15 19:53:44 (GMT) |
commit | aa7dc58f280cb4df951c8d767afaaff4ee1fecf3 (patch) | |
tree | 47f9419afb7a139e0639d4500ba3c5e9b4c45035 | |
parent | d51d3f66c47101fcaaf39f90d77950156fc05648 (diff) | |
download | blt-aa7dc58f280cb4df951c8d767afaaff4ee1fecf3.zip blt-aa7dc58f280cb4df951c8d767afaaff4ee1fecf3.tar.gz blt-aa7dc58f280cb4df951c8d767afaaff4ee1fecf3.tar.bz2 |
simplify getInfo code
-rw-r--r-- | tksao/frame/fitsimage.C | 61 | ||||
-rw-r--r-- | tksao/frame/fitsimage.h | 6 | ||||
-rw-r--r-- | tksao/frame/fitsmap.C | 33 |
3 files changed, 3 insertions, 97 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index 2b2d09f..615e07c 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -2812,36 +2812,6 @@ VectorStr FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, return VectorStr(astFormat(ast_,1,out[0]), astFormat(ast_,2,out[1])); } -// waj -char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, - Coord::SkyFrame sky, Coord::SkyFormat format, - char* lbuf) -{ - astClearStatus; // just to make sure - astBegin; // start memory management - - lbuf[0] = '\0'; - - if (!hasWCS(sys)) - return lbuf; - - setWCSSystem(sys); - setWCSSkyFrame(sky); - - Vector out = wcsTran(ast_, in, 1); - if (astOK && checkWCS(out)) { - setWCSFormat(sys,sky,format); - astNorm(ast_, out.v); - - ostringstream str; - str << astFormat(ast_,1,out[0]) << ' ' << astFormat(ast_,2,out[1]) << ends; - strncpy(lbuf, str.str().c_str(), str.str().length()); - } - - astEnd; - return lbuf; -} - Vector3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, Coord::SkyFrame sky) { @@ -2889,37 +2859,6 @@ VectorStr3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, astFormat(ast_,3,out[2])); } -// waj -char* FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, - Coord::SkyFrame sky, Coord::SkyFormat format, - char* lbuf) -{ - astClearStatus; // just to make sure - astBegin; // start memory management - - lbuf[0] = '\0'; - - if (!(hasWCS(sys) && hasWCS3D(sys))) - return lbuf; - - setWCSSystem(sys); - setWCSSkyFrame(sky); - - Vector3d out = wcsTran(ast_, in, 1); - if (astOK && checkWCS(out)) { - setWCSFormat(sys,sky,format); - astNorm(ast_, out.v); - - ostringstream str; - str << astFormat(ast_,1,out[0]) << ' ' << astFormat(ast_,2,out[1]) - << ' ' << astFormat(ast_,3,out[2]) << ends; - strncpy(lbuf, str.str().c_str(), str.str().length()); - } - - astEnd; - return lbuf; -} - Vector FitsImage::wcs2pix(const Vector& vv, Coord::CoordSystem sys, Coord::SkyFrame sky) { diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h index 2d493be..27606e9 100644 --- a/tksao/frame/fitsimage.h +++ b/tksao/frame/fitsimage.h @@ -382,10 +382,6 @@ class FitsImage { Vector3d pix2wcs(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame); VectorStr3d pix2wcs(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat); - //waj - char* pix2wcs(const Vector&, Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat, char*); - char* pix2wcs(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat, char*); - Vector wcs2pix(const Vector&, Coord::CoordSystem, Coord::SkyFrame); Vector3d wcs2pix(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame); int wcsInv() {return wcsInv_;} @@ -435,8 +431,6 @@ class FitsImage { Vector mapFromRef(const Vector&, Coord::CoordSystem, Coord::SkyFrame =Coord::FK5); VectorStr mapFromRef(const Vector&, Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat); - // waj - void mapFromRef(const Vector&, Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat, char*); Vector3d mapFromRef(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame =Coord::FK5); VectorStr3d mapFromRef(const Vector3d&, Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat); diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C index 5aa1c19..53903ec 100644 --- a/tksao/frame/fitsmap.C +++ b/tksao/frame/fitsmap.C @@ -36,17 +36,6 @@ VectorStr FitsImage::mapFromRef(const Vector& vv, Coord::CoordSystem out, return VectorStr(); } -// waj -void FitsImage::mapFromRef(const Vector& vv, Coord::CoordSystem out, - Coord::SkyFrame sky, Coord::SkyFormat format, - char* buf) -{ - if (hasWCS(out)) - pix2wcs(vv * refToImage, out, sky, format, buf); - else - strcpy(buf,""); -} - Vector3d FitsImage::mapFromRef(const Vector3d& vv, Coord::CoordSystem out, Coord::SkyFrame sky) { @@ -146,25 +135,9 @@ void FitsImage::listFromRef(ostream& str1, ostream& str2, const Vector& vv, break; default: { - char buf[128]; - char* bptr = buf; - mapFromRef(vv,sys,sky,format,buf); - - // lon - char* lonptr = buf; - while (*bptr && *bptr != ' ') - bptr++; - *bptr = '\0'; - - // lat - bptr++; - char* latptr = bptr; - while (*bptr && *bptr != ' ') - bptr++; - *bptr = '\0'; - - str1 << lonptr; - str2 << latptr; + VectorStr rr = mapFromRef(vv,sys,sky,format); + str1 << rr[0]; + str2 << rr[1]; } } } |