diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-01-11 22:25:33 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-01-11 22:25:33 (GMT) |
commit | a38fd423435acb45ac17f753578632e41824dec3 (patch) | |
tree | 54cc1ef3e11baed58732a837d8663a2e2ba6080a /tksao/frame | |
parent | 6039bd516353b04936a9e22ea7f6cdb8bfbf1795 (diff) | |
download | blt-a38fd423435acb45ac17f753578632e41824dec3.zip blt-a38fd423435acb45ac17f753578632e41824dec3.tar.gz blt-a38fd423435acb45ac17f753578632e41824dec3.tar.bz2 |
update precision
Diffstat (limited to 'tksao/frame')
-rw-r--r-- | tksao/frame/annulus.C | 14 | ||||
-rw-r--r-- | tksao/frame/base.C | 9 | ||||
-rw-r--r-- | tksao/frame/base.h | 7 | ||||
-rw-r--r-- | tksao/frame/basecommand.C | 6 | ||||
-rw-r--r-- | tksao/frame/baseline.C | 3 | ||||
-rw-r--r-- | tksao/frame/basepolygon.C | 2 | ||||
-rw-r--r-- | tksao/frame/box.C | 36 | ||||
-rw-r--r-- | tksao/frame/boxannulus.C | 23 | ||||
-rw-r--r-- | tksao/frame/bpanda.C | 27 | ||||
-rw-r--r-- | tksao/frame/circle.C | 23 | ||||
-rw-r--r-- | tksao/frame/compass.C | 5 | ||||
-rw-r--r-- | tksao/frame/composite.C | 6 | ||||
-rw-r--r-- | tksao/frame/context.h | 2 | ||||
-rw-r--r-- | tksao/frame/cpanda.C | 26 | ||||
-rw-r--r-- | tksao/frame/ellipse.C | 34 | ||||
-rw-r--r-- | tksao/frame/ellipseannulus.C | 26 | ||||
-rw-r--r-- | tksao/frame/epanda.C | 29 | ||||
-rw-r--r-- | tksao/frame/fitsimage.C | 57 | ||||
-rw-r--r-- | tksao/frame/fitsmap.C | 39 | ||||
-rw-r--r-- | tksao/frame/line.C | 3 | ||||
-rw-r--r-- | tksao/frame/marker.C | 8 | ||||
-rw-r--r-- | tksao/frame/point.C | 10 | ||||
-rw-r--r-- | tksao/frame/polygon.C | 8 | ||||
-rw-r--r-- | tksao/frame/projection.C | 5 | ||||
-rw-r--r-- | tksao/frame/text.C | 5 | ||||
-rw-r--r-- | tksao/frame/vect.C | 6 |
26 files changed, 250 insertions, 169 deletions
diff --git a/tksao/frame/annulus.C b/tksao/frame/annulus.C index c72f744..9b7aad3 100644 --- a/tksao/frame/annulus.C +++ b/tksao/frame/annulus.C @@ -215,7 +215,7 @@ void Annulus::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, if (ptr->hasWCSCel(sys)) { listRADEC(ptr,center,sys,sky,format); str << type_ << '(' << ra << ',' << dec - << setprecision(3) << fixed; + << setprecision(parent->precArcsec) << fixed; for (int ii=0; ii<numAnnuli_; ii++) { double rr = ptr->mapLenFromRef(annuli_[ii][0],sys,Coord::ARCSEC); str << ',' << rr << '"'; @@ -233,7 +233,7 @@ void Annulus::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, void Annulus::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) { Vector vv = ptr->mapFromRef(center,sys); - str << type_ << '(' << setprecision(8) << vv; + str << type_ << '(' << setprecision(parent->precLinear) << vv; for (int ii=0; ii<numAnnuli_; ii++) { double rr = ptr->mapLenFromRef(annuli_[ii][0],sys); str << ',' << rr; @@ -269,7 +269,7 @@ void Annulus::listCiao(ostream& str, Coord::CoordSystem sys, int strip) Vector vv = ptr->mapFromRef(center,Coord::PHYSICAL); for (int ii=0; ii<numAnnuli_-1; ii++) { listCiaoPre(str); - str << type_ << '(' << setprecision(8) << vv << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' << ptr->mapLenFromRef(annuli_[ii][0],Coord::PHYSICAL) << ',' << ptr->mapLenFromRef(annuli_[ii+1][0],Coord::PHYSICAL) << ')'; listCiaoPost(str, strip); @@ -284,7 +284,7 @@ void Annulus::listCiao(ostream& str, Coord::CoordSystem sys, int strip) double r1 = ptr->mapLenFromRef(annuli_[ii][0],sys,Coord::ARCMIN); double r2 = ptr->mapLenFromRef(annuli_[ii+1][0],sys,Coord::ARCMIN); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(5) << fixed + << setprecision(parent->precArcmin) << fixed << r1 << '\'' << ',' << r2 << '\'' << ')'; str.unsetf(ios_base::floatfield); @@ -309,7 +309,7 @@ void Annulus::listPros(ostream& str, Coord::CoordSystem sys, { Vector vv = ptr->mapFromRef(center,sys); coord.listProsCoordSystem(str,sys,sky); - str << "; " << type_ << ' ' << setprecision(8) << vv; + str << "; " << type_ << ' ' << setprecision(parent->precLinear) << vv; for (int ii=0; ii<numAnnuli_; ii++) { double rr = ptr->mapLenFromRef(annuli_[ii][0],Coord::IMAGE); str << ' ' << rr; @@ -329,7 +329,7 @@ void Annulus::listPros(ostream& str, Coord::CoordSystem sys, str << ra << ' ' << dec; break; } - str << setprecision(3) << fixed; + str << setprecision(parent->precArcsec) << fixed; for (int ii=0; ii<numAnnuli_; ii++) { double rr = ptr->mapLenFromRef(annuli_[ii][0],sys,Coord::ARCSEC); str << ' ' << rr << '"'; @@ -347,7 +347,7 @@ void Annulus::listSAOimage(ostream& str, int strip) listSAOimagePre(str); Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv; + str << type_ << '(' << setprecision(parent->precLinear) << vv; for (int ii=0; ii<numAnnuli_; ii++) { double rr = ptr->mapLenFromRef(annuli_[ii][0],Coord::IMAGE); str << ',' << rr; diff --git a/tksao/frame/base.C b/tksao/frame/base.C index 2d15a85..e790ecf 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -133,6 +133,13 @@ Base::Base(Tcl_Interp* i, Tk_Canvas c, Tk_Item* item) useCrosshair = 0; + precArcsec = 3; + precArcmin = 5; + precDeg = 10; + precLinear = 8; + precHMS = 4; + precDMS = 3; + markerEpsilon = 3; showMarkers = 1; showMarkersText = 1; @@ -753,7 +760,7 @@ void Base::doubleToTclArray(double dd, const char* var, str << base << "," << mod << ends; ostringstream vstr; - vstr << setprecision(8) << dd << ends; + vstr << setprecision(precLinear) << dd << ends; Tcl_SetVar2(interp, (char*)var, str.str().c_str(), vstr.str().c_str(), 0); } diff --git a/tksao/frame/base.h b/tksao/frame/base.h index 79184b8..4ee4024 100644 --- a/tksao/frame/base.h +++ b/tksao/frame/base.h @@ -249,6 +249,13 @@ public: int useCrosshair; + int precArcsec; + int precArcmin; + int precDeg; + int precLinear; + int precHMS; + int precDMS; + int markerEpsilon; // mouse tolerance for select/edit int showMarkers; int showMarkersText; diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C index 50e2eea..a745d14 100644 --- a/tksao/frame/basecommand.C +++ b/tksao/frame/basecommand.C @@ -1762,14 +1762,14 @@ void Base::getFitsSizeCmd(Coord::CoordSystem sys, Coord::SkyFrame sky, ostringstream str; switch (dist) { case Coord::DEGREE: - str << setprecision(10); + str << setprecision(precDeg); break; case Coord::ARCMIN: - str << setprecision(5) << fixed; + str << setprecision(precArcmin) << fixed; ss *= 60; break; case Coord::ARCSEC: - str << setprecision(3) << fixed; + str << setprecision(precArcsec) << fixed; ss *= 60*60; break; } diff --git a/tksao/frame/baseline.C b/tksao/frame/baseline.C index a7348f0..05609dc 100644 --- a/tksao/frame/baseline.C +++ b/tksao/frame/baseline.C @@ -110,7 +110,8 @@ void BaseLine::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) { Vector v1 = ptr->mapFromRef(p1,sys); Vector v2 = ptr->mapFromRef(p2,sys); - str << type_ << '(' << setprecision(8) << v1 << ',' << v2 << ')'; + str << type_ << '(' << setprecision(parent->precLinear) + << v1 << ',' << v2 << ')'; } // special composite funtionallity diff --git a/tksao/frame/basepolygon.C b/tksao/frame/basepolygon.C index e712b36..569f48b 100644 --- a/tksao/frame/basepolygon.C +++ b/tksao/frame/basepolygon.C @@ -260,7 +260,7 @@ void BasePolygon::listBaseNonCel(FitsImage* ptr, ostream& str, Matrix& mm, first=0; Vector vv = ptr->mapFromRef(vertex.current()->vector*mm,sys); - str << setprecision(8) << vv; + str << setprecision(parent->precLinear) << vv; } while (vertex.next()); str << ')'; diff --git a/tksao/frame/box.C b/tksao/frame/box.C index 3cb081b..59a19f7 100644 --- a/tksao/frame/box.C +++ b/tksao/frame/box.C @@ -272,9 +272,10 @@ void Box::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, Vector rr = ptr->mapLenFromRef(annuli_[0],sys,Coord::ARCSEC); double aa = parent->mapAngleFromRef(angle,sys,sky); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(3) << fixed << setunit('"') << rr << ','; + << setprecision(parent->precArcsec) << fixed << setunit('"') + << rr << ','; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(aa) << ')'; + str << setprecision(parent->precLinear) << radToDeg(aa) << ')'; } else listNonCel(ptr, str, sys); @@ -308,7 +309,8 @@ void Box::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) Vector vv = ptr->mapFromRef(center,sys); Vector rr = ptr->mapLenFromRef(annuli_[0],sys); double aa = parent->mapAngleFromRef(angle,sys); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ',' << radToDeg(aa) << ')'; } @@ -344,7 +346,8 @@ void Box::listCiao(ostream& str, Coord::CoordSystem sys, int strip) { Vector vv = ptr->mapFromRef(center,Coord::PHYSICAL); Vector rr = ptr->mapLenFromRef(annuli_[0],Coord::PHYSICAL); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ',' << radToDeg(angle) << ')'; } break; @@ -353,9 +356,10 @@ void Box::listCiao(ostream& str, Coord::CoordSystem sys, int strip) listRADEC(ptr,center,sys,Coord::FK5,Coord::SEXAGESIMAL); Vector rr = ptr->mapLenFromRef(annuli_[0],sys,Coord::ARCMIN); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(5) << fixed << setunit('\'') << rr << ','; + << setprecision(parent->precArcmin) << fixed << setunit('\'') + << rr << ','; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(angle) << ')'; + str << setprecision(parent->precLinear) << radToDeg(angle) << ')'; } } @@ -377,7 +381,8 @@ void Box::listSAOtng(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, { Vector vv = ptr->mapFromRef(center,Coord::IMAGE); Vector rr = ptr->mapLenFromRef(annuli_[0],Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ',' << radToDeg(angle) << ')'; } break; @@ -386,8 +391,8 @@ void Box::listSAOtng(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, listRADEC(ptr,center,sys,sky,format); Vector rr = ptr->mapLenFromRef(annuli_[0],Coord::IMAGE); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(8) << rr << ',' - << setprecision(8) << radToDeg(angle) << ')'; + << setprecision(parent->precLinear) << rr << ',' + << setprecision(parent->precLinear) << radToDeg(angle) << ')'; } } @@ -409,8 +414,9 @@ void Box::listPros(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, Vector vv = ptr->mapFromRef(center,sys); Vector rr = ptr->mapLenFromRef(annuli_[0],Coord::IMAGE); coord.listProsCoordSystem(str,sys,sky); - str << "; "<< type_ << ' ' << setprecision(8) << vv << ' ' << rr << ' ' - << radToDeg(angle); + str << "; "<< type_ << ' ' << setprecision(parent->precLinear) + << vv << ' ' << rr << ' ' + << radToDeg(angle); } break; default: @@ -427,9 +433,10 @@ void Box::listPros(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, str << ra << ' ' << dec << ' '; break; } - str << setprecision(3) << fixed << setunit('"') << rr << ' '; + str << setprecision(parent->precArcsec) << fixed << setunit('"') + << rr << ' '; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(angle); + str << setprecision(parent->precLinear) << radToDeg(angle); } } @@ -442,7 +449,8 @@ void Box::listSAOimage(ostream& str, int strip) listSAOimagePre(str); Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ',' << annuli_[0] << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << annuli_[0] << ',' << radToDeg(angle) << ')'; listSAOimagePost(str, strip); diff --git a/tksao/frame/boxannulus.C b/tksao/frame/boxannulus.C index 2534369..45bfe4b 100644 --- a/tksao/frame/boxannulus.C +++ b/tksao/frame/boxannulus.C @@ -289,13 +289,13 @@ void BoxAnnulus::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, listRADEC(ptr,center,sys,sky,format); double aa = parent->mapAngleFromRef(angle,sys,sky); str << "box(" << ra << ',' << dec - << setprecision(3) << fixed; + << setprecision(parent->precArcsec) << fixed; for (int ii=0; ii<numAnnuli_; ii++) { Vector rr = ptr->mapLenFromRef(annuli_[ii],sys,Coord::ARCSEC); str << ',' << setunit('"') << rr; } str.unsetf(ios_base::floatfield); - str << setprecision(8) << ',' << radToDeg(aa) << ')'; + str << setprecision(parent->precLinear) << ',' << radToDeg(aa) << ')'; } else listNonCel(ptr, str, sys); @@ -309,7 +309,7 @@ void BoxAnnulus::listNonCel(FitsImage* ptr, ostream& str, { Vector vv = ptr->mapFromRef(center,sys); double aa = parent->mapAngleFromRef(angle,sys); - str << "box(" << setprecision(8) << vv; + str << "box(" << setprecision(parent->precLinear) << vv; for (int ii=0; ii<numAnnuli_; ii++) { Vector rr = ptr->mapLenFromRef(annuli_[ii],sys); str << ',' << rr; @@ -352,7 +352,8 @@ void BoxAnnulus::listPros(ostream& str, Coord::CoordSystem sys, str << "; "; Vector rr = ptr->mapLenFromRef(annuli_[ii],Coord::IMAGE); - str << "box " << setprecision(8) << vv << ' ' << rr << ' ' + str << "box " << setprecision(parent->precLinear) << vv << ' ' + << rr << ' ' << radToDeg(angle); if (ii!=0) { @@ -382,9 +383,10 @@ void BoxAnnulus::listPros(ostream& str, Coord::CoordSystem sys, str << ra << ' ' << dec << ' '; break; } - str << setprecision(3) << setunit('"') << fixed << rr << ' '; + str << setprecision(parent->precArcsec) << setunit('"') << fixed + << rr << ' '; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(angle); + str << setprecision(parent->precLinear) << radToDeg(angle); if (ii!=0) { Vector r1 = ptr->mapLenFromRef(annuli_[ii-1],sys,Coord::ARCSEC); @@ -397,9 +399,10 @@ void BoxAnnulus::listPros(ostream& str, Coord::CoordSystem sys, str << ra << ' ' << dec << ' '; break; } - str << setprecision(3) << setunit('"') << fixed << r1 << ' '; + str << setprecision(parent->precArcsec) << setunit('"') << fixed + << r1 << ' '; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(angle); + str << setprecision(parent->precLinear) << radToDeg(angle); } listProsPost(str, strip); } @@ -414,11 +417,11 @@ void BoxAnnulus::listSAOimage(ostream& str, int strip) for (int ii=0; ii<numAnnuli_; ii++) { Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << "box(" << setprecision(8) << vv << ',' + str << "box(" << setprecision(parent->precLinear) << vv << ',' << annuli_[ii] << ',' << radToDeg(angle) << ')'; if (ii!=0) - str << " & !box(" << setprecision(8) << vv << ',' + str << " & !box(" << setprecision(parent->precLinear) << vv << ',' << annuli_[ii-1] << ',' << radToDeg(angle) << ')'; listSAOimagePost(str, strip); diff --git a/tksao/frame/bpanda.C b/tksao/frame/bpanda.C index 58af7f1..c526cb0 100644 --- a/tksao/frame/bpanda.C +++ b/tksao/frame/bpanda.C @@ -543,13 +543,13 @@ void Bpanda::listA(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, listRADEC(ptr,center,sys,sky,format); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(8) << ang1 << ',' << ang2 << ',' - << setprecision(8) << numAngles_-1 << ',' - << setprecision(3) << fixed + << setprecision(parent->precLinear) << ang1 << ',' << ang2 << ',' + << setprecision(parent->precLinear) << numAngles_-1 << ',' + << setprecision(parent->precArcsec) << fixed << setunit('"') << r1 << ',' << setunit('"') << r2 << ','; str.unsetf(ios_base::floatfield); - str << setprecision(8) << numAnnuli_-1 << ',' - << setprecision(8) + str << setprecision(parent->precLinear) << numAnnuli_-1 << ',' + << setprecision(parent->precLinear) << radToDeg(parent->mapAngleFromRef(angle,sys,sky)) << ')'; } else @@ -570,7 +570,7 @@ void Bpanda::listANonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) Vector r1 = ptr->mapLenFromRef(annuli_[0],sys); Vector r2 = ptr->mapLenFromRef(annuli_[numAnnuli_-1],sys); double aa = parent->mapAngleFromRef(angle,sys); - str << type_ << '(' << setprecision(8) << vv << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' << a1 << ',' << a2 << ',' << numAngles_-1 << ',' << r1 << ',' << r2 << ',' << numAnnuli_-1 << ',' << radToDeg(aa) << ')'; @@ -622,7 +622,7 @@ void Bpanda::listBNonCel(FitsImage* ptr, ostream& str, Vector r1 = ptr->mapLenFromRef(annuli_[ii-1],sys); Vector r2 = ptr->mapLenFromRef(annuli_[ii],sys); str << type_ << '(' - << setprecision(8) << vv << ',' + << setprecision(parent->precLinear) << vv << ',' << a1 << ',' << a2 << ",1," << r1 << ',' << r2 << ",1," << radToDeg(aa) << ')'; @@ -677,10 +677,11 @@ void Bpanda::listBCel(FitsImage* ptr, int ii, int jj, ostream& str, Vector r2 = ptr->mapLenFromRef(annuli_[ii],sys,Coord::ARCSEC); double aa = parent->mapAngleFromRef(angle,sys,sky); - str << setprecision(8) << a1 << ',' << a2 << ",1," - << setprecision(3) << fixed << setunit('"') << r1 << ',' << setunit('"') << r2 << ",1,"; + str << setprecision(parent->precLinear) << a1 << ',' << a2 << ",1," + << setprecision(parent->precArcsec) << fixed << setunit('"') + << r1 << ',' << setunit('"') << r2 << ",1,"; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(aa) << ')'; + str << setprecision(parent->precLinear) << radToDeg(aa) << ')'; if (!strip) { if (conj) @@ -688,21 +689,21 @@ void Bpanda::listBCel(FitsImage* ptr, int ii, int jj, ostream& str, str << " # bpanda="; if (ii==1 && jj==1 && !strip) { - str << '(' << setprecision(8); + str << '(' << setprecision(parent->precLinear); for (int kk=0; kk<numAngles_; kk++) { double ar = parent->mapAngleFromRef(angles_[kk],sys,sky); str << radToDeg(ar) << ((kk<numAngles_-1) ? ' ' : ')'); } str << '('; - str << setseparator(' ') << setprecision(3) << fixed; + str << setseparator(' ') << setprecision(parent->precArcsec) << fixed; for (int kk=0; kk<numAnnuli_; kk++) { Vector rr = ptr->mapLenFromRef(annuli_[kk],sys,Coord::ARCSEC); str << setunit('"') << rr << ((kk<numAnnuli_-1) ? ' ' : ')'); } str.unsetf(ios_base::floatfield); str << setseparator(','); - str << '(' << setprecision(8) << radToDeg(aa) << ')'; + str << '(' << setprecision(parent->precLinear) << radToDeg(aa) << ')'; listProps(str); } else diff --git a/tksao/frame/circle.C b/tksao/frame/circle.C index 72cf71b..28e9e51 100644 --- a/tksao/frame/circle.C +++ b/tksao/frame/circle.C @@ -224,7 +224,7 @@ void Circle::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, listRADEC(ptr,center,sys,sky,format); double rr = ptr->mapLenFromRef(annuli_[0][0],sys,Coord::ARCSEC); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(3) << fixed << rr << '"' << ')'; + << setprecision(parent->precArcsec) << fixed << rr << '"' << ')'; str.unsetf(ios_base::floatfield); } else @@ -258,7 +258,8 @@ void Circle::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) { Vector vv = ptr->mapFromRef(center,sys); double rr = ptr->mapLenFromRef(annuli_[0][0],sys); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ')'; } void Circle::listXML(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, @@ -291,7 +292,8 @@ void Circle::listCiao(ostream& str, Coord::CoordSystem sys, int strip) { Vector vv = ptr->mapFromRef(center,Coord::PHYSICAL); double rr = ptr->mapLenFromRef(annuli_[0][0],Coord::PHYSICAL); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ')'; } break; default: @@ -299,7 +301,7 @@ void Circle::listCiao(ostream& str, Coord::CoordSystem sys, int strip) listRADEC(ptr,center,sys,Coord::FK5,Coord::SEXAGESIMAL); double rr = ptr->mapLenFromRef(annuli_[0][0],sys,Coord::ARCMIN); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(5) << fixed << rr << '\'' << ')'; + << setprecision(parent->precArcmin) << fixed << rr << '\'' << ')'; str.unsetf(ios_base::floatfield); } } @@ -322,7 +324,8 @@ void Circle::listSAOtng(ostream& str, { Vector vv = ptr->mapFromRef(center,Coord::IMAGE); double rr = ptr->mapLenFromRef(annuli_[0][0],Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ')'; } break; default: @@ -331,7 +334,7 @@ void Circle::listSAOtng(ostream& str, double rr = ptr->mapLenFromRef(annuli_[0][0],Coord::IMAGE); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(8) << rr << ')'; + << setprecision(parent->precLinear) << rr << ')'; } } @@ -353,7 +356,8 @@ void Circle::listPros(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, Vector vv = ptr->mapFromRef(center,sys); double rr = ptr->mapLenFromRef(annuli_[0][0],Coord::IMAGE); coord.listProsCoordSystem(str,sys,sky); - str << "; " << type_ << ' ' << setprecision(8) << vv << ' ' << rr; + str << "; " << type_ << ' ' << setprecision(parent->precLinear) + << vv << ' ' << rr; } break; default: @@ -370,7 +374,7 @@ void Circle::listPros(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, str << ra << ' ' << dec << ' '; break; } - str << setprecision(3) << fixed << rr << '"'; + str << setprecision(parent->precArcsec) << fixed << rr << '"'; str.unsetf(ios_base::floatfield); } } @@ -384,7 +388,8 @@ void Circle::listSAOimage(ostream& str, int strip) listSAOimagePre(str); Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ',' << annuli_[0][0] << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << annuli_[0][0] << ')'; listSAOimagePost(str, strip); } diff --git a/tksao/frame/compass.C b/tksao/frame/compass.C index c5611a1..78686d9 100644 --- a/tksao/frame/compass.C +++ b/tksao/frame/compass.C @@ -566,7 +566,7 @@ void Compass::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, listRADEC(ptr,center,sys,sky,format); double rr = ptr->mapLenFromRef(radius,sys,Coord::ARCSEC); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(3) << fixed << rr << '"' << ')'; + << setprecision(parent->precArcsec) << fixed << rr << '"' << ')'; str.unsetf(ios_base::floatfield); } else @@ -588,7 +588,8 @@ void Compass::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) { Vector vv = ptr->mapFromRef(center,sys); double rr = ptr->mapLenFromRef(radius,sys); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ')'; } void Compass::listXML(ostream& str, Coord::CoordSystem sys, diff --git a/tksao/frame/composite.C b/tksao/frame/composite.C index 0c77eb0..a6e6193 100644 --- a/tksao/frame/composite.C +++ b/tksao/frame/composite.C @@ -201,7 +201,7 @@ void Composite::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, case Coord::AMPLIFIER: { Vector vv = ptr->mapFromRef(center,sys); - str << '(' << setprecision(8) << vv << ',' + str << '(' << setprecision(parent->precLinear) << vv << ',' << radToDeg(parent->mapAngleFromRef(angle,sys)) << ')'; } break; @@ -209,12 +209,12 @@ void Composite::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, if (ptr->hasWCSCel(sys)) { listRADEC(ptr,center,sys,sky,format); str << '(' << ra << ',' << dec << ',' - << setprecision(8) + << setprecision(parent->precLinear) << radToDeg(parent->mapAngleFromRef(angle,sys,sky)) << ')'; } else { Vector vv = ptr->mapFromRef(center,sys); - str << '(' << setprecision(8) << vv << ',' + str << '(' << setprecision(parent->precLinear) << vv << ',' << radToDeg(parent->mapAngleFromRef(angle,sys)) << ')'; } } diff --git a/tksao/frame/context.h b/tksao/frame/context.h index 03b56f5..b3c9be4 100644 --- a/tksao/frame/context.h +++ b/tksao/frame/context.h @@ -32,6 +32,8 @@ class FitsZBound { ostream& operator<<(ostream&, const FitsZBound&); class Context { + friend class FitsImage; + public: enum SmoothFunction {BOXCAR, TOPHAT, GAUSSIAN, ELLIPTIC}; diff --git a/tksao/frame/cpanda.C b/tksao/frame/cpanda.C index 7bddfd9..03d2226 100644 --- a/tksao/frame/cpanda.C +++ b/tksao/frame/cpanda.C @@ -513,10 +513,12 @@ void Cpanda::listA(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, listRADEC(ptr,center,sys,sky,format); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(8) << a1 << ',' << a2 <<',' << numAngles_-1 << ',' - << setprecision(3) << fixed << r1 << '"' << ',' << r2 << '"' << ','; + << setprecision(parent->precLinear) << a1 << ',' << a2 << ',' + << numAngles_-1 << ',' + << setprecision(parent->precArcsec) << fixed << r1 << '"' << ',' + << r2 << '"' << ','; str.unsetf(ios_base::floatfield); - str << setprecision(8) << numAnnuli_-1 << ')'; + str << setprecision(parent->precLinear) << numAnnuli_-1 << ')'; } else listANonCel(ptr, str, sys); @@ -535,7 +537,7 @@ void Cpanda::listANonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) Vector vv = ptr->mapFromRef(center,sys); double r1 = ptr->mapLenFromRef(annuli_[0][0],sys); double r2 = ptr->mapLenFromRef(annuli_[numAnnuli_-1][0],sys); - str << type_ << '(' << setprecision(8) << vv << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' << a1 << ',' << a2 << ',' << numAngles_-1 << ',' << r1 << ',' << r2 << ',' << numAnnuli_-1 << ')'; } @@ -584,7 +586,7 @@ void Cpanda::listBNonCel(FitsImage* ptr, ostream& str, double r1 = ptr->mapLenFromRef(annuli_[ii-1][0],sys); double r2 = ptr->mapLenFromRef(annuli_[ii][0],sys); - str << type_ << '(' << setprecision(8) << vv << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' << a1 << ',' << a2 << ",1," << r1 << ',' << r2 << ",1)"; @@ -633,8 +635,9 @@ void Cpanda::listBCel(FitsImage* ptr, int ii, int jj, ostream& str, double r1 = ptr->mapLenFromRef(annuli_[ii-1][0],sys,Coord::ARCSEC); double r2 = ptr->mapLenFromRef(annuli_[ii][0],sys,Coord::ARCSEC); - str << setprecision(8) << a1 << ',' << a2 << ",1," - << setprecision(3) << fixed << r1 << '"' << ',' << r2 << '"' << ",1)"; + str << setprecision(parent->precLinear) << a1 << ',' << a2 << ",1," + << setprecision(parent->precArcsec) << fixed << r1 << '"' << ',' + << r2 << '"' << ",1)"; str.unsetf(ios_base::floatfield); if (!strip) { @@ -643,13 +646,13 @@ void Cpanda::listBCel(FitsImage* ptr, int ii, int jj, ostream& str, str << " # panda="; if (ii==1 && jj==1 && !strip) { - str << '(' << setprecision(8); + str << '(' << setprecision(parent->precLinear); for (int kk=0; kk<numAngles_; kk++) { double aa = parent->mapAngleFromRef(angles_[kk],sys,sky); str << radToDeg(aa) << ((kk<numAngles_-1) ? ' ' : ')'); } - str << '(' << setprecision(3) << fixed; + str << '(' << setprecision(parent->precArcsec) << fixed; for (int kk=0; kk<numAnnuli_; kk++) { double rr = ptr->mapLenFromRef(annuli_[kk][0],sys,Coord::ARCSEC); str << rr << '"' << ((kk<numAnnuli_-1) ? ' ' : ')'); @@ -707,7 +710,7 @@ void Cpanda::listCiao(ostream& str, Coord::CoordSystem sys, int strip) a2 += 360; listCiaoPre(str); - str << "pie(" << setprecision(8) << vv << ',' + str << "pie(" << setprecision(parent->precLinear) << vv << ',' << r1 << ',' << r2 << ',' << a1 << ',' << a2 << ')'; listCiaoPost(str, strip); @@ -728,7 +731,8 @@ void Cpanda::listCiao(ostream& str, Coord::CoordSystem sys, int strip) a2 += 360; listCiaoPre(str); - str << "pie(" << setprecision(8) << ra << ',' << dec << ',' + str << "pie(" << setprecision(parent->precLinear) + << ra << ',' << dec << ',' << r1 << '\'' << ',' << r2 << '\'' << ',' << a1 << ',' << a2 << ')'; listCiaoPost(str, strip); diff --git a/tksao/frame/ellipse.C b/tksao/frame/ellipse.C index b99d375..6aace3b 100644 --- a/tksao/frame/ellipse.C +++ b/tksao/frame/ellipse.C @@ -246,9 +246,10 @@ void Ellipse::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, Vector rr = ptr->mapLenFromRef(annuli_[0],sys,Coord::ARCSEC); double aa = parent->mapAngleFromRef(angle,sys,sky); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(3) << fixed << setunit('"') << rr << ','; + << setprecision(parent->precArcsec) << fixed << setunit('"') + << rr << ','; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(aa) << ')'; + str << setprecision(parent->precLinear) << radToDeg(aa) << ')'; } else listNonCel(ptr, str, sys); @@ -282,7 +283,8 @@ void Ellipse::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) Vector vv = ptr->mapFromRef(center,sys); Vector rr = ptr->mapLenFromRef(annuli_[0],sys); double aa = parent->mapAngleFromRef(angle,sys); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ',' << radToDeg(aa) << ')'; } @@ -317,7 +319,8 @@ void Ellipse::listCiao(ostream& str, Coord::CoordSystem sys, int strip) { Vector vv = ptr->mapFromRef(center,Coord::PHYSICAL); Vector rr = ptr->mapLenFromRef(annuli_[0],Coord::PHYSICAL); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ',' << radToDeg(angle) << ')'; } break; @@ -326,9 +329,10 @@ void Ellipse::listCiao(ostream& str, Coord::CoordSystem sys, int strip) listRADEC(ptr,center,sys,Coord::FK5,Coord::SEXAGESIMAL); Vector rr = ptr->mapLenFromRef(annuli_[0],sys,Coord::ARCMIN); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(5) << fixed << setunit('\'') << rr << ','; + << setprecision(parent->precArcmin) << fixed << setunit('\'') + << rr << ','; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(angle) << ')'; + str << setprecision(parent->precLinear) << radToDeg(angle) << ')'; } break; } @@ -353,7 +357,8 @@ void Ellipse::listSAOtng(ostream& str, Coord::CoordSystem sys, { Vector vv = ptr->mapFromRef(center,Coord::IMAGE); Vector rr = ptr->mapLenFromRef(annuli_[0],Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ',' << rr << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << rr << ',' << radToDeg(angle) << ')'; } break; @@ -362,8 +367,8 @@ void Ellipse::listSAOtng(ostream& str, Coord::CoordSystem sys, listRADEC(ptr,center,sys,sky,format); Vector rr = ptr->mapLenFromRef(annuli_[0],Coord::IMAGE); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(8) << rr << ',' - << setprecision(8) << radToDeg(angle) << ')'; + << setprecision(parent->precLinear) << rr << ',' + << setprecision(parent->precLinear) << radToDeg(angle) << ')'; } } @@ -386,7 +391,8 @@ void Ellipse::listPros(ostream& str, Coord::CoordSystem sys, Vector vv = ptr->mapFromRef(center,sys); Vector rr = ptr->mapLenFromRef(annuli_[0],Coord::IMAGE); coord.listProsCoordSystem(str,sys,sky); - str << "; " << type_ << ' ' << setprecision(8) << vv << ' ' << rr << ' ' + str << "; " << type_ << ' ' << setprecision(parent->precLinear) + << vv << ' ' << rr << ' ' << radToDeg(angle); } break; @@ -404,9 +410,10 @@ void Ellipse::listPros(ostream& str, Coord::CoordSystem sys, str << ra << ' ' << dec << ' '; break; } - str << setprecision(3) << fixed << setunit('"') << rr << ' '; + str << setprecision(parent->precArcsec) << fixed << setunit('"') + << rr << ' '; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(angle); + str << setprecision(parent->precLinear) << radToDeg(angle); } } @@ -419,7 +426,8 @@ void Ellipse::listSAOimage(ostream& str, int strip) listSAOimagePre(str); Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ',' << annuli_[0] << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' + << annuli_[0] << ',' << radToDeg(angle) << ')'; listSAOimagePost(str, strip); diff --git a/tksao/frame/ellipseannulus.C b/tksao/frame/ellipseannulus.C index 593e102..7c820c6 100644 --- a/tksao/frame/ellipseannulus.C +++ b/tksao/frame/ellipseannulus.C @@ -257,13 +257,13 @@ void EllipseAnnulus::list(ostream& str, Coord::CoordSystem sys, listRADEC(ptr,center,sys,sky,format); double aa = parent->mapAngleFromRef(angle,sys,sky); str << "ellipse(" << ra << ',' << dec - << setprecision(3) << fixed; + << setprecision(parent->precArcsec) << fixed; for (int ii=0; ii<numAnnuli_; ii++) { Vector rr = ptr->mapLenFromRef(annuli_[ii],sys,Coord::ARCSEC); str << ',' << setunit('"') << rr; } str.unsetf(ios_base::floatfield); - str << setprecision(8) << ',' << radToDeg(aa) << ')'; + str << setprecision(parent->precLinear) << ',' << radToDeg(aa) << ')'; } else listNonCel(ptr, str, sys); @@ -277,7 +277,7 @@ void EllipseAnnulus::listNonCel(FitsImage* ptr, ostream& str, { Vector vv = ptr->mapFromRef(center,sys); double aa = parent->mapAngleFromRef(angle,sys); - str << "ellipse(" << setprecision(8) << vv; + str << "ellipse(" << setprecision(parent->precLinear) << vv; for (int ii=0; ii<numAnnuli_; ii++) { Vector rr = ptr->mapLenFromRef(annuli_[ii],sys); str << ',' << rr; @@ -320,12 +320,14 @@ void EllipseAnnulus::listPros(ostream& str, Coord::CoordSystem sys, str << "; "; Vector rr = ptr->mapLenFromRef(annuli_[ii],Coord::IMAGE); - str << "ellipse " << setprecision(8) << vv << ' ' << rr << ' ' + str << "ellipse " << setprecision(parent->precLinear) << vv << ' ' + << rr << ' ' << radToDeg(angle); if (ii!=0) { Vector r1 = ptr->mapLenFromRef(annuli_[ii-1],Coord::IMAGE); - str << " & !ellipse " << setprecision(8) << vv << ' ' << r1 << ' ' + str << " & !ellipse " << setprecision(parent->precLinear) + << vv << ' ' << r1 << ' ' << radToDeg(angle); } @@ -350,9 +352,10 @@ void EllipseAnnulus::listPros(ostream& str, Coord::CoordSystem sys, str << ra << ' ' << dec << ' '; break; } - str << setprecision(3) << setunit('"') << fixed << rr << ' '; + str << setprecision(parent->precArcsec) << setunit('"') << fixed + << rr << ' '; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(angle); + str << setprecision(parent->precLinear) << radToDeg(angle); if (ii!=0) { Vector r1 = ptr->mapLenFromRef(annuli_[ii-1],sys,Coord::ARCSEC); @@ -365,9 +368,10 @@ void EllipseAnnulus::listPros(ostream& str, Coord::CoordSystem sys, str << ra << ' ' << dec << ' '; break; } - str << setprecision(3) << setunit('"') << fixed << r1 << ' '; + str << setprecision(parent->precArcsec) << setunit('"') << fixed + << r1 << ' '; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(angle); + str << setprecision(parent->precLinear) << radToDeg(angle); } listProsPost(str, strip); @@ -383,11 +387,11 @@ void EllipseAnnulus::listSAOimage(ostream& str, int strip) for (int ii=0; ii<numAnnuli_; ii++) { Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << "ellipse(" << setprecision(8) << vv << ',' + str << "ellipse(" << setprecision(parent->precLinear) << vv << ',' << annuli_[ii] << ',' << radToDeg(angle) << ')'; if (ii!=0) - str << " & !ellipse(" << setprecision(8) << vv << ',' + str << " & !ellipse(" << setprecision(parent->precLinear) << vv << ',' << annuli_[ii-1] << ',' << radToDeg(angle) << ')'; listSAOimagePost(str, strip); diff --git a/tksao/frame/epanda.C b/tksao/frame/epanda.C index 399aaf1..5c34c28 100644 --- a/tksao/frame/epanda.C +++ b/tksao/frame/epanda.C @@ -509,12 +509,13 @@ void Epanda::listA(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, listRADEC(ptr,center,sys,sky,format); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(8) << a1 << ',' << a2 <<',' << numAngles_-1 << ',' - << setprecision(3) << fixed << setunit('"') << r1 << ',' - << setunit('"') << r2 << ','; + << setprecision(parent->precLinear) << a1 << ',' << a2 <<',' + << numAngles_-1 << ',' + << setprecision(parent->precArcsec) << fixed << setunit('"') + << r1 << ',' << setunit('"') << r2 << ','; str.unsetf(ios_base::floatfield); - str << setprecision(8) << numAnnuli_-1 << ',' - << setprecision(8) << radToDeg(aa) << ')'; + str << setprecision(parent->precLinear) << numAnnuli_-1 << ',' + << setprecision(parent->precLinear) << radToDeg(aa) << ')'; } else listANonCel(ptr, str, sys); @@ -534,7 +535,7 @@ void Epanda::listANonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) Vector r1 = ptr->mapLenFromRef(annuli_[0],sys); Vector r2 = ptr->mapLenFromRef(annuli_[numAnnuli_-1],sys); double aa = parent->mapAngleFromRef(angle,sys); - str << type_ << '(' << setprecision(8) << vv << ',' + str << type_ << '(' << setprecision(parent->precLinear) << vv << ',' << a1 << ',' << a2 << ',' << numAngles_-1 << ',' << r1 << ',' << r2 << ',' << numAnnuli_-1 << ',' << radToDeg(aa) << ')'; @@ -586,7 +587,7 @@ void Epanda::listBNonCel(FitsImage* ptr, ostream& str, Vector r1 = ptr->mapLenFromRef(annuli_[ii-1],sys); Vector r2 = ptr->mapLenFromRef(annuli_[ii],sys); str << type_ << '(' - << setprecision(8) << vv << ',' + << setprecision(parent->precLinear) << vv << ',' << a1 << ',' << a2 << ",1," << r1 << ',' << r2 << ",1," << radToDeg(aa) << ')'; @@ -641,10 +642,11 @@ void Epanda::listBCel(FitsImage* ptr, int ii, int jj, ostream& str, Vector r2 = ptr->mapLenFromRef(annuli_[ii],sys,Coord::ARCSEC); double aa = parent->mapAngleFromRef(angle,sys,sky); - str << setprecision(8) << a1 << ',' << a2 << ",1," - << setprecision(3) << fixed << setunit('"') << r1 << ',' << setunit('"') << r2 << ",1,"; + str << setprecision(parent->precLinear) << a1 << ',' << a2 << ",1," + << setprecision(parent->precArcsec) << fixed << setunit('"') + << r1 << ',' << setunit('"') << r2 << ",1,"; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(aa) << ')'; + str << setprecision(parent->precLinear) << radToDeg(aa) << ')'; if (!strip) { if (conj) @@ -652,20 +654,21 @@ void Epanda::listBCel(FitsImage* ptr, int ii, int jj, ostream& str, str << " # epanda="; if (ii==1 && jj==1 && !strip) { - str << '(' << setprecision(8); + str << '(' << setprecision(parent->precLinear); for (int kk=0; kk<numAngles_; kk++) { double ar = parent->mapAngleFromRef(angles_[kk],sys,sky); str << radToDeg(ar) << ((kk<numAngles_-1) ? ' ' : ')'); } str << '('; - str << setseparator(' ') << setprecision(3) << fixed; + str << setseparator(' ') << setprecision(parent->precArcsec) << fixed; for (int kk=0; kk<numAnnuli_; kk++) { Vector rr = ptr->mapLenFromRef(annuli_[kk],sys,Coord::ARCSEC); str << setunit('"') << rr << ((kk<numAnnuli_-1) ? ' ' : ')'); } str.unsetf(ios_base::floatfield); - str << setseparator(',') << '(' << setprecision(8) << radToDeg(aa) << ')'; + str << setseparator(',') << '(' << setprecision(parent->precLinear) + << radToDeg(aa) << ')'; listProps(str); } else diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C index 839128b..31f4998 100644 --- a/tksao/frame/fitsimage.C +++ b/tksao/frame/fitsimage.C @@ -3187,10 +3187,16 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, Vector out = wcsTran(ast_[ss], in, 1); if (astOK && checkWCS(out)) { if (wcsIsASkyFrame(ast_[ss])) { + ostringstream hms; + hms << "hms." << context_->parent_->precHMS; + ostringstream dms; + dms << "+dms." << context_->parent_->precDMS; + switch (format) { case Coord::DEGREES: out = radToDeg(out); - str << setprecision(10) << out[0] << ' ' << out[1] << ' ' + str << setprecision(context_->parent_->precDeg) + << out[0] << ' ' << out[1] << ' ' << (hasWCSEqu(sys) ? coord.skyFrameStr(sky) : "") << ends; break; @@ -3201,15 +3207,15 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, case Coord::FK4_NO_E: case Coord::FK5: case Coord::ICRS: - setWCSFormat(ast_[ss],1,"hms.4"); - setWCSFormat(ast_[ss],2,"+dms.3"); + setWCSFormat(ast_[ss],1,hms.str().c_str()); + setWCSFormat(ast_[ss],2,dms.str().c_str()); break; case Coord::GALACTIC: case Coord::SUPERGALACTIC: case Coord::ECLIPTIC: case Coord::HELIOECLIPTIC: - setWCSFormat(ast_[ss],1,"+dms.3"); - setWCSFormat(ast_[ss],2,"+dms.3"); + setWCSFormat(ast_[ss],1,dms.str().c_str()); + setWCSFormat(ast_[ss],2,dms.str().c_str()); break; } str << astFormat(ast_[ss],1,out[0]) << ' ' @@ -3219,7 +3225,8 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, } } else - str << setprecision(8) << out[0] << ' ' << out[1] << ends; + str << setprecision(context_->parent_->precLinear) + << out[0] << ' ' << out[1] << ends; strncpy(lbuf, str.str().c_str(), str.str().length()); } @@ -3243,10 +3250,16 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, Vector out = wcsTran(in, 1); if (astOK && checkWCS(out)) { if (hasWCSCel(sys)) { + ostringstream hms; + hms << "hms." << context_->parent_->precHMS; + ostringstream dms; + dms << "+dms." << context_->parent_->precDMS; + switch (format) { case Coord::DEGREES: out = radToDeg(out); - str << setprecision(10) << out[0] << ' ' << out[1] << ' ' + str << setprecision(context_->parent_->precDeg) + << out[0] << ' ' << out[1] << ' ' << (hasWCSEqu(sys) ? coord.skyFrameStr(sky) : "") << ends; break; @@ -3258,15 +3271,15 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, case Coord::FK4_NO_E: case Coord::FK5: case Coord::ICRS: - setWCSFormat(1,"hms.4"); - setWCSFormat(2,"+dms.3"); + setWCSFormat(1,hms.str().c_str()); + setWCSFormat(2,dms.str().c_str()); break; case Coord::GALACTIC: case Coord::SUPERGALACTIC: case Coord::ECLIPTIC: case Coord::HELIOECLIPTIC: - setWCSFormat(1,"+dms.3"); - setWCSFormat(2,"+dms.3"); + setWCSFormat(1,dms.str().c_str()); + setWCSFormat(2,dms.str().c_str()); break; } str << astFormat(ast_,1,out[0]) << ' ' @@ -3276,7 +3289,8 @@ char* FitsImage::pix2wcs(const Vector& in, Coord::CoordSystem sys, } } else - str << setprecision(8) << out[0] << ' ' << out[1] << ends; + str << setprecision(context_->parent_->precLinear) + << out[0] << ' ' << out[1] << ends; strncpy(lbuf, str.str().c_str(), str.str().length()); } @@ -3319,10 +3333,16 @@ char* FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, Vector3d out = wcsTran(in, 1); if (astOK && checkWCS(out)) { if (hasWCSCel(sys)) { + ostringstream hms; + hms << "hms." << context_->parent_->precHMS; + ostringstream dms; + dms << "+dms." << context_->parent_->precDMS; + switch (format) { case Coord::DEGREES: out = radToDeg(out); - str << setprecision(10) << out[0] << ' ' << out[1] << ' ' << out[2] + str << setprecision(context_->parent_->precDeg) + << out[0] << ' ' << out[1] << ' ' << out[2] << ' ' << (hasWCSEqu(sys) ? coord.skyFrameStr(sky) : "") << ends; break; @@ -3333,15 +3353,15 @@ char* FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, case Coord::FK4_NO_E: case Coord::FK5: case Coord::ICRS: - setWCSFormat(1,"hms.4"); - setWCSFormat(2,"+dms.3"); + setWCSFormat(1,hms.str().c_str()); + setWCSFormat(2,dms.str().c_str()); break; case Coord::GALACTIC: case Coord::SUPERGALACTIC: case Coord::ECLIPTIC: case Coord::HELIOECLIPTIC: - setWCSFormat(1,"+dms.3"); - setWCSFormat(2,"+dms.3"); + setWCSFormat(1,dms.str().c_str()); + setWCSFormat(2,dms.str().c_str()); break; } str << astFormat(ast_,1,out[0]) << ' ' @@ -3351,7 +3371,8 @@ char* FitsImage::pix2wcs(const Vector3d& in, Coord::CoordSystem sys, } } else - str << setprecision(8) << out[0] << ' ' << out[1] << ' ' << out[2] <<ends; + str << setprecision(context_->parent_->precLinear) + << out[0] << ' ' << out[1] << ' ' << out[2] <<ends; strncpy(lbuf, str.str().c_str(), str.str().length()); } diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C index 50f5d7b..34ea48d 100644 --- a/tksao/frame/fitsmap.C +++ b/tksao/frame/fitsmap.C @@ -3,6 +3,7 @@ // For conditions of distribution and use, see copyright notice in "copyright" #include "fitsimage.h" +#include "context.h" // Map Point @@ -105,14 +106,15 @@ void FitsImage::listFromRef(ostream& str, const Vector& vv, case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - str << setprecision(8) << mapFromRef(vv, sys); + str << setprecision(context_->parent_->precLinear) << mapFromRef(vv, sys); break; default: if (hasWCS(sys)) { if (hasWCSCel(sys)) { switch (format) { case Coord::DEGREES: - str << setprecision(10) << mapFromRef(vv, sys, sky); + str << setprecision(context_->parent_->precDeg) + << mapFromRef(vv, sys, sky); break; case Coord::SEXAGESIMAL: { @@ -133,7 +135,8 @@ void FitsImage::listFromRef(ostream& str, const Vector& vv, } } else - str << setprecision(8) << mapFromRef(vv, sys); + str << setprecision(context_->parent_->precLinear) + << mapFromRef(vv, sys); } else str << "0 0"; @@ -360,26 +363,26 @@ void FitsImage::listLenFromRef(ostream& str, double dd, case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - str << setprecision(8) << out; + str << setprecision(context_->parent_->precLinear) << out; break; default: if (hasWCS(sys)) { if (hasWCSCel(sys)) { switch (dist) { case Coord::DEGREE: - str << setprecision(10); + str << setprecision(context_->parent_->precDeg); break; case Coord::ARCMIN: - str << setprecision(5) << fixed; + str << setprecision(context_->parent_->precArcmin) << fixed; break; case Coord::ARCSEC: - str << setprecision(3) << fixed; + str << setprecision(context_->parent_->precArcsec) << fixed; break; } str << out; } else - str << setprecision(8) << out; + str << setprecision(context_->parent_->precLinear) << out; } else str << "0"; @@ -396,26 +399,26 @@ void FitsImage::listLenFromRef(ostream& str, const Vector& vv, case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - str << setprecision(8) << out; + str << setprecision(context_->parent_->precLinear) << out; break; default: if (hasWCS(sys)) { if (hasWCSCel(sys)) { switch (dist) { case Coord::DEGREE: - str << setprecision(10); + str << setprecision(context_->parent_->precDeg); break; case Coord::ARCMIN: - str << setprecision(5) << fixed; + str << setprecision(context_->parent_->precArcmin) << fixed; break; case Coord::ARCSEC: - str << setprecision(3) << fixed; + str << setprecision(context_->parent_->precArcsec) << fixed; break; } str << out; } else - str << setprecision(8) << out; + str << setprecision(context_->parent_->precLinear) << out; } else str << "0 0"; @@ -486,26 +489,26 @@ void FitsImage::listDistFromRef(ostream& str, case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - str << setprecision(8) << out; + str << setprecision(context_->parent_->precLinear) << out; break; default: if (hasWCS(sys)) { if (hasWCSCel(sys)) { switch (dist) { case Coord::DEGREE: - str << setprecision(10); + str << setprecision(context_->parent_->precDeg); break; case Coord::ARCMIN: - str << setprecision(5) << fixed; + str << setprecision(context_->parent_->precArcmin) << fixed; break; case Coord::ARCSEC: - str << setprecision(3) << fixed; + str << setprecision(context_->parent_->precArcsec) << fixed; break; } str << out; } else - str << setprecision(8) << out; + str << setprecision(context_->parent_->precLinear) << out; } else str << "0 0"; diff --git a/tksao/frame/line.C b/tksao/frame/line.C index daf2817..9f394ce 100644 --- a/tksao/frame/line.C +++ b/tksao/frame/line.C @@ -279,7 +279,8 @@ void Line::listSAOtng(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, { Vector v1 = ptr->mapFromRef(p1,Coord::IMAGE); Vector v2 = ptr->mapFromRef(p2,Coord::IMAGE); - str << type_ << '(' << setprecision(8) << v1 << ',' << v2 << ')'; + str << type_ << '(' << setprecision(parent->precLinear) + << v1 << ',' << v2 << ')'; } break; default: diff --git a/tksao/frame/marker.C b/tksao/frame/marker.C index 5f0dd4a..e0c8a19 100644 --- a/tksao/frame/marker.C +++ b/tksao/frame/marker.C @@ -1623,7 +1623,7 @@ void Marker::listXY(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - str << setprecision(8) << ptr->mapFromRef(center,sys); + str << setprecision(parent->precLinear) << ptr->mapFromRef(center,sys); break; default: if (ptr->hasWCS(sys)) { @@ -1632,7 +1632,7 @@ void Marker::listXY(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, str << ra << ' ' << dec; } else - str << setprecision(8) << ptr->mapFromRef(center,sys); + str << setprecision(parent->precLinear) << ptr->mapFromRef(center,sys); } break; } @@ -1688,7 +1688,7 @@ void Marker::XMLRow(XMLColName col, double val, int prec) void Marker::XMLRowARCSEC(XMLColName col, double val) { ostringstream str; - str << setprecision(3) << fixed << val << ends; + str << setprecision(parent->precArcsec) << fixed << val << ends; if (XMLCol[col]) delete [] XMLCol[col]; @@ -1715,7 +1715,7 @@ void Marker::XMLRow(XMLColName col, double* val, int cnt, int prec) void Marker::XMLRowARCSEC(XMLColName col, double* val, int cnt) { ostringstream str; - str << setprecision(3) << fixed; + str << setprecision(parent->precArcsec) << fixed; for (int ii=0; ii<cnt; ii++) { str << val[ii]; if (ii!=cnt-1) diff --git a/tksao/frame/point.C b/tksao/frame/point.C index f9501be..f3205b6 100644 --- a/tksao/frame/point.C +++ b/tksao/frame/point.C @@ -773,7 +773,7 @@ void Point::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, void Point::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) { Vector vv = ptr->mapFromRef(center,sys); - str << type_ << '(' << setprecision(8) << vv << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ')'; } void Point::listPost(ostream& str, int conj, int strip) @@ -826,7 +826,7 @@ void Point::listCiao(ostream& str, Coord::CoordSystem sys, int strip) case Coord::AMPLIFIER: { Vector vv = ptr->mapFromRef(center,Coord::PHYSICAL); - str << type_ << '(' << setprecision(8) << vv << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ')'; } break; default: @@ -855,7 +855,7 @@ void Point::listPros(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, coord.listProsCoordSystem(str,sys,sky); str << "; "; Vector vv = ptr->mapFromRef(center,sys); - str << type_ << ' ' << setprecision(8) << vv; + str << type_ << ' ' << setprecision(parent->precLinear) << vv; } break; default: @@ -891,7 +891,7 @@ void Point::listSAOtng(ostream& str, Coord::CoordSystem sys, case Coord::AMPLIFIER: { Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ')'; } break; default: @@ -912,7 +912,7 @@ void Point::listSAOimage(ostream& str, int strip) // all coords are in image coords Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ')'; listSAOimagePost(str, strip); } diff --git a/tksao/frame/polygon.C b/tksao/frame/polygon.C index 650bd83..42e1ab0 100644 --- a/tksao/frame/polygon.C +++ b/tksao/frame/polygon.C @@ -440,7 +440,7 @@ void Polygon::listCiao(ostream& str, Coord::CoordSystem sys, int strip) Vector vv = ptr->mapFromRef(vertex.current()->vector*mm,Coord::PHYSICAL); - str << setprecision(8) << vv; + str << setprecision(parent->precLinear) << vv; } while (vertex.next()); str << ')'; @@ -487,7 +487,7 @@ void Polygon::listPros(ostream& str, Coord::CoordSystem sys, vertex.head(); do { Vector vv = ptr->mapFromRef(vertex.current()->vector*mm,sys); - str << ' ' << setprecision(8) << vv; + str << ' ' << setprecision(parent->precLinear) << vv; } while (vertex.next()); } @@ -538,7 +538,7 @@ void Polygon::listSAOtng(ostream& str, Coord::CoordSystem sys, first=0; Vector vv = ptr->mapFromRef(vertex.current()->vector*mm,sys); - str << setprecision(8) << vv; + str << setprecision(parent->precLinear) << vv; } while (vertex.next()); str << ')'; @@ -580,7 +580,7 @@ void Polygon::listSAOimage(ostream& str, int strip) first=0; Vector vv = ptr->mapFromRef(vertex.current()->vector*mm,Coord::IMAGE); - str << setprecision(8) << vv; + str << setprecision(parent->precLinear) << vv; } while (vertex.next()); diff --git a/tksao/frame/projection.C b/tksao/frame/projection.C index 8a3c629..76ca516 100644 --- a/tksao/frame/projection.C +++ b/tksao/frame/projection.C @@ -357,7 +357,7 @@ void Projection::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, str << ra << ',' << dec << ','; listRADEC(ptr,p2,sys,sky,format); str << ra << ',' << dec << ','; - str << setprecision(3) << fixed << ww << '"' << ')'; + str << setprecision(parent->precArcsec) << fixed << ww << '"' << ')'; str.unsetf(ios_base::floatfield); } else @@ -377,7 +377,8 @@ void Projection::listNonCel(FitsImage* ptr, ostream& str, Vector v1 = ptr->mapFromRef(p1,sys); Vector v2 = ptr->mapFromRef(p2,sys); double ww = ptr->mapLenFromRef(width,sys); - str << type_ << '(' << setprecision(8) << v1 << ',' << v2 << ',' + str << type_ << '(' << setprecision(parent->precLinear) + << v1 << ',' << v2 << ',' << ww << ')'; } diff --git a/tksao/frame/text.C b/tksao/frame/text.C index d66eb7a..60d45c0 100644 --- a/tksao/frame/text.C +++ b/tksao/frame/text.C @@ -247,7 +247,7 @@ void Text::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, void Text::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) { Vector vv = ptr->mapFromRef(center,sys); - str << type_ << '(' << setprecision(8) << vv << ')'; + str << type_ << '(' << setprecision(parent->precLinear) << vv << ')'; } void Text::listXML(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, @@ -285,7 +285,8 @@ void Text::listSAOtng(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, case Coord::AMPLIFIER: { Vector vv = ptr->mapFromRef(center,Coord::IMAGE); - str << type_ << '(' << setprecision(8) << vv << ", \"" << text << "\")"; + str << type_ << '(' << setprecision(parent->precLinear) + << vv << ", \"" << text << "\")"; } break; default: diff --git a/tksao/frame/vect.C b/tksao/frame/vect.C index 008249c..bce8c03 100644 --- a/tksao/frame/vect.C +++ b/tksao/frame/vect.C @@ -72,9 +72,9 @@ void Vect::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, double rr = ptr->mapLenFromRef((p2-p1).length(),sys,Coord::ARCSEC); double aa = parent->mapAngleFromRef((p2-p1).angle(),sys,sky); str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(3) << fixed << rr << '"' << ','; + << setprecision(parent->precArcsec) << fixed << rr << '"' << ','; str.unsetf(ios_base::floatfield); - str << setprecision(8) << radToDeg(aa) << ')'; + str << setprecision(parent->precLinear) << radToDeg(aa) << ')'; } else listNonCel(ptr, str, sys); @@ -93,7 +93,7 @@ void Vect::listNonCel(FitsImage* ptr, ostream& str, Coord::CoordSystem sys) Vector v1 = ptr->mapFromRef(p1,sys); double rr = ptr->mapLenFromRef((p2-p1).length(),sys); double aa = parent->mapAngleFromRef((p2-p1).angle(),sys); - str << type_ << '(' << setprecision(8) << v1 << ',' + str << type_ << '(' << setprecision(parent->precLinear) << v1 << ',' << rr << ',' << radToDeg(aa) << ')'; } |