diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-01-22 18:32:39 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-01-22 18:32:39 (GMT) |
commit | b90a5be4f4280b44ad6fda3f0a228fe838fed3df (patch) | |
tree | cbe3652dfffbf4c30e1b85338c80432c8232a24f /tksao | |
parent | 15ea810dc7216bc052ea52c5f4302ad134a8b947 (diff) | |
download | blt-b90a5be4f4280b44ad6fda3f0a228fe838fed3df.zip blt-b90a5be4f4280b44ad6fda3f0a228fe838fed3df.tar.gz blt-b90a5be4f4280b44ad6fda3f0a228fe838fed3df.tar.bz2 |
support WCS-TAB
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/fitsimage.C | 53 | ||||
-rw-r--r-- | tksao/frame/grid25d.C | 2 | ||||
-rw-r--r-- | tksao/frame/grid2d.C | 4 | ||||
-rw-r--r-- | tksao/frame/grid3d.C | 2 |
4 files changed, 60 insertions, 1 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index 681d8e9..dc2f346 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -4483,6 +4483,58 @@ double FitsImage::wcsAxAngle(const Vector& vv1, const Vector& vv2) } #endif +#ifndef NEWWCS +AstFrameSet* FitsImage::fits2ast(FitsHead* hd) +{ + // we may have an error, just reset + astClearStatus; + + // new fitschan + AstFitsChan* chan = astFitsChan(NULL, NULL, ""); + if (!astOK || chan == AST__NULL) + return NULL; + + // no warning messages + astClear(chan,"Warnings"); + + // fill up chan + char* cards =NULL; + int ncards =0; + + if (hd) { + cards = hd->cards(); + ncards = hd->ncard(); + } + + if (cards == NULL || ncards == 0) + return NULL; + + for (int i=0; i<ncards; i++) { + char buf[81]; + strncpy(buf,cards+(i*80),80); + buf[80] = '\0'; + + astPutFits(chan, buf, 0); + // sometimes, we get a bad parse, just ignore + if (!astOK) + astClearStatus; + } + + // we may have an error, just reset + astClearStatus; + astClear(chan, "Card"); + + // parse header + AstFrameSet* frameSet = (AstFrameSet*)astRead(chan); + + // do we have anything? + if (!astOK || frameSet == AST__NULL || + strncmp(astGetC(frameSet,"Class"), "FrameSet", 8)) + return NULL; + + return frameSet; +} +#else static void fits2TAB(AstFitsChan* chan, const char* extname, int extver, int extlevel, int* status) { @@ -4658,6 +4710,7 @@ AstFrameSet* FitsImage::fits2ast(FitsHead* hd) return frameSet; } +#endif #ifndef NEWWCS AstFrameSet* FitsImage::buildast(int ss, FitsHead* hd, FitsHead* prim) diff --git a/tksao/frame/grid25d.C b/tksao/frame/grid25d.C index 505e976..65de38a 100644 --- a/tksao/frame/grid25d.C +++ b/tksao/frame/grid25d.C @@ -36,8 +36,10 @@ int Grid25d::doit(RenderMode rm) if (!fits) return 1; +#ifdef NEWWCS if (!fits->astInv()) return 1; +#endif astClearStatus; // just to make sure astBegin; // start memory management diff --git a/tksao/frame/grid2d.C b/tksao/frame/grid2d.C index b671832..564941a 100644 --- a/tksao/frame/grid2d.C +++ b/tksao/frame/grid2d.C @@ -36,9 +36,11 @@ int Grid2d::doit(RenderMode rm) if (!fits) return 1; +#ifdef NEWWCS if (!fits->astInv()) return 1; - +#endif + astClearStatus; // just to make sure astBegin; // start memory management diff --git a/tksao/frame/grid3d.C b/tksao/frame/grid3d.C index b5d24d1..981d47e 100644 --- a/tksao/frame/grid3d.C +++ b/tksao/frame/grid3d.C @@ -66,8 +66,10 @@ int Grid3d::doit(RenderMode rm) if (!fits) return 1; +#ifdef NEWWCS if (!fits->astInv()) return 1; +#endif astClearStatus; // just to make sure astBegin; // start memory management |