diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-07-26 16:22:08 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-07-26 16:22:08 (GMT) |
commit | fb51570ed742e395a67beabb7d64d878dff2181a (patch) | |
tree | 50edea3b75cd8d4d9525c84a175dd6abe5d0e775 /tksao | |
parent | 5faf281c8a66caab8ddd82199e14af53bb09ea08 (diff) | |
download | blt-fb51570ed742e395a67beabb7d64d878dff2181a.zip blt-fb51570ed742e395a67beabb7d64d878dff2181a.tar.gz blt-fb51570ed742e395a67beabb7d64d878dff2181a.tar.bz2 |
clean up code
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/fitsimage.C | 42 | ||||
-rw-r--r-- | tksao/frame/fitsimage.h | 11 |
2 files changed, 28 insertions, 25 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index 0d35f5f..8603347 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -936,7 +936,7 @@ void FitsImage::wfpc2WCS(istream& str) delete wfpc2Header_; wfpc2Header_ = hh; - initWCS(wfpc2Header_, NULL); + initWCS(wfpc2Header_); } void FitsImage::appendWCS(istream& str) @@ -976,7 +976,7 @@ void FitsImage::appendWCS(istream& str) delete wcsAltHeader_; wcsAltHeader_ = new FitsHead(cards,ll,FitsHead::ALLOC); - initWCS(wcsAltHeader_, NULL); + initWCS(wcsAltHeader_); } char* FitsImage::display(FitsHead* hd) @@ -1266,13 +1266,12 @@ void FitsImage::initWCS(FitsHead* hd, FitsHead* prim) #else -void FitsImage::initWCS(FitsHead* hd, FitsHead* prim) +void FitsImage::initWCS(FitsHead* hd) { if (manageWCS_) { if (ast_) astAnnul(ast_); ast_ =NULL; - astSav_ =NULL; if (wcs_) delete [] wcs_; wcs_ =NULL; @@ -1316,10 +1315,12 @@ void FitsImage::initWCS(FitsHead* hd, FitsHead* prim) } } - astInit(hd, prim); - wcsInit(hd); - wcsCelInit(hd); - wcs3DInit(hd); + int hasWCSAST = hd->find("BEGAST_A") ? 1 : 0; + + astInit(hd); + wcsInit(hasWCSAST); + wcsCelInit(hasWCSAST); + wcs3DInit(hasWCSAST); wcsHPXInit(); initWCSPhysical(); @@ -1341,8 +1342,12 @@ void FitsImage::resetWCS() delete wcsAltHeader_; wcsAltHeader_ = NULL; +#ifdef OLDWCS initWCS(image_->head(), image_->primary() && image_->inherit() ? image_->primary() : NULL); +#else + initWCS(image_->head()); +#endif } #ifdef OLDWCS @@ -2494,7 +2499,7 @@ void FitsImage::replaceWCS(istream& str) delete wcsAltHeader_; wcsAltHeader_ = hh; - initWCS(wcsAltHeader_, NULL); + initWCS(wcsAltHeader_); } void FitsImage::reset() @@ -3806,7 +3811,7 @@ void FitsImage::astinit(int ss, FitsHead* hd, FitsHead* prim) setWCSSkyFrame(ast_[ss],Coord::FK5); } #else -void FitsImage::astInit(FitsHead* hd, FitsHead* prim) +void FitsImage::astInit(FitsHead* hd) { if (ast_) astAnnul(ast_); @@ -3832,16 +3837,13 @@ void FitsImage::astInit(FitsHead* hd, FitsHead* prim) } break; case 3: - if (0) { - int orr[] = {2,3,1}; - astPermAxes(ast_,orr); - } + break; case 4: break; } } -void FitsImage::wcsInit(FitsHead* hd) +void FitsImage::wcsInit(int hasWCSAST) { // init wcs_ array if (wcs_) @@ -3859,7 +3861,7 @@ void FitsImage::wcsInit(FitsHead* hd) wcs_[0] =1; // do we have a AST wcs? - if (hd->find("BEGAST_A")) + if (hasWCSAST) return; // fill out wcs_ array @@ -3878,7 +3880,7 @@ void FitsImage::wcsInit(FitsHead* hd) astEnd; } -void FitsImage::wcsCelInit(FitsHead* hd) +void FitsImage::wcsCelInit(int hasWCSAST) { // init wcsCel_ array if (wcsCel_) @@ -3897,7 +3899,7 @@ void FitsImage::wcsCelInit(FitsHead* hd) int nn = astGetI(ast_, "Nframe"); // do we have a AST wcs? - if (hd->find("BEGAST_A")) { + if (hasWCSAST) { for (int ii=0; ii<nn; ii++) { AstFrame* ff = (AstFrame*)astGetFrame(ast_,ii+1); AstFrameSet* fs = @@ -3931,7 +3933,7 @@ void FitsImage::wcsCelInit(FitsHead* hd) astEnd; } -void FitsImage::wcs3DInit(FitsHead* hd) +void FitsImage::wcs3DInit(int hasWCSAST) { // init wcs3D_ array if (wcs3D_) @@ -3950,7 +3952,7 @@ void FitsImage::wcs3DInit(FitsHead* hd) int nn = astGetI(ast_,"nframe"); // do we have a AST wcs? - if (hd->find("BEGAST_A")) { + if (hasWCSAST) { for (int ii=0; ii<nn; ii++) { AstFrame* ff = (AstFrame*)astGetFrame(ast_,ii+1); wcs3D_[0] = wcs3D_[0] || (astGetI(ff, "Naxes")>2) ? 1 : 0; diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h index 6db675d..2f544fe 100644 --- a/tksao/frame/fitsimage.h +++ b/tksao/frame/fitsimage.h @@ -156,9 +156,9 @@ class FitsImage { void initBin(); void initHPX(); - void initWCS(FitsHead*, FitsHead*); void initWCSPhysical(); #ifdef OLDWCS + void initWCS(FitsHead*, FitsHead* =NULL); void wcsShow(WorldCoor*); void astinit(int, FitsHead*, FitsHead*); AstFrameSet* buildast(int, FitsHead*, FitsHead*); @@ -168,10 +168,11 @@ class FitsImage { void header2ast(int,FitsHead*, void*); void astinit0(int, FitsHead*, FitsHead*); #else - void astInit(FitsHead*, FitsHead*); - void wcsInit(FitsHead*); - void wcsCelInit(FitsHead*); - void wcs3DInit(FitsHead*); + void initWCS(FitsHead*); + void astInit(FitsHead*); + void wcsInit(int); + void wcsCelInit(int); + void wcs3DInit(int); void wcsHPXInit(); #endif void putFitsCard(void* chan, const char* key, const char* value); |