summaryrefslogtreecommitdiffstats
path: root/tksao/frame/fitsimage.C
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-02-11 19:40:18 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-02-11 19:40:18 (GMT)
commitc0b3a0c82c8f3b288fb155f76a3c85a505b38314 (patch)
tree286038ad0279babd7258417d92246b7b39bc0eee /tksao/frame/fitsimage.C
parentea5859bc0fdb56db18f9c9afe3e0c2bbb56e0631 (diff)
downloadblt-c0b3a0c82c8f3b288fb155f76a3c85a505b38314.zip
blt-c0b3a0c82c8f3b288fb155f76a3c85a505b38314.tar.gz
blt-c0b3a0c82c8f3b288fb155f76a3c85a505b38314.tar.bz2
add support for 1D wcs
Diffstat (limited to 'tksao/frame/fitsimage.C')
-rw-r--r--tksao/frame/fitsimage.C38
1 files changed, 32 insertions, 6 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index 2668ef0..bfd0cbf 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -2884,7 +2884,21 @@ VectorStr FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys,
astNorm(ast_, out.v);
astEnd;
- return VectorStr(astFormat(ast_,1,out[0]), astFormat(ast_,2,out[1]));
+ int naxes = astGetI(ast_,"Naxes");
+ switch (naxes) {
+ case 1:
+ {
+ ostringstream str;
+ str << setprecision(context_->parent_->precLinear_) << in[1] << ends;
+ return VectorStr(astFormat(ast_,1,out[0]), str.str().c_str());
+ }
+ case 2:
+ case 3:
+ case 4:
+ return VectorStr(astFormat(ast_,1,out[0]), astFormat(ast_,2,out[1]));
+ }
+
+ return VectorStr();
}
Vector3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys,
@@ -2929,12 +2943,24 @@ VectorStr3d FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys,
int naxes = astGetI(ast_,"Naxes");
switch (naxes) {
case 1:
- // error
- break;
+ {
+ ostringstream str1;
+ str1 << setprecision(context_->parent_->precLinear_) << in[1] << ends;
+ ostringstream str2;
+ str2 << setprecision(context_->parent_->precLinear_) << in[2] << ends;
+ return VectorStr3d(astFormat(ast_,1,out[0]),
+ str1.str().c_str(),
+ str2.str().c_str());
+ }
case 2:
- return VectorStr3d(astFormat(ast_,1,out[0]),
- astFormat(ast_,2,out[1]),
- "1");
+ {
+ ostringstream str;
+ str << setprecision(context_->parent_->precLinear_) << in[1] << ends;
+ return VectorStr3d(astFormat(ast_,1,out[0]),
+ astFormat(ast_,2,out[1]),
+ str.str().c_str());
+
+ }
case 3:
case 4:
return VectorStr3d(astFormat(ast_,1,out[0]),