summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-08-13 17:30:09 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-08-13 17:30:09 (GMT)
commit52ce2ce163b1cbc5c74bb427e697e1e9d69cff69 (patch)
tree3b324075f669432acb948e2f742294ab7fd85f22 /tksao
parentfda27baead222e82f50af9d5d6f9676a5286a65a (diff)
downloadblt-52ce2ce163b1cbc5c74bb427e697e1e9d69cff69.zip
blt-52ce2ce163b1cbc5c74bb427e697e1e9d69cff69.tar.gz
blt-52ce2ce163b1cbc5c74bb427e697e1e9d69cff69.tar.bz2
update marker precision
Diffstat (limited to 'tksao')
-rw-r--r--tksao/frame/fitsimage.h1
-rw-r--r--tksao/frame/fitsmap.C48
-rw-r--r--tksao/frame/marker.C141
3 files changed, 106 insertions, 84 deletions
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index ff28012..b234c1c 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -429,6 +429,7 @@ class FitsImage {
void listFromRef(ostream&, const Vector&, Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat);
void listLenFromRef(ostream&, double, Coord::CoordSystem, Coord::DistFormat);
void listLenFromRef(ostream&, const Vector&, Coord::CoordSystem, Coord::DistFormat);
+ void listLenFromRef(ostream&, ostream&, const Vector&, Coord::CoordSystem, Coord::DistFormat);
void listDistFromRef(ostream&, const Vector&, const Vector&, Coord::CoordSystem, Coord::DistFormat);
const char* getValue(const Vector& v);
diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C
index e0e4ede..3bb2ec8 100644
--- a/tksao/frame/fitsmap.C
+++ b/tksao/frame/fitsmap.C
@@ -289,6 +289,54 @@ void FitsImage::listLenFromRef(ostream& str, const Vector& vv,
}
}
+void FitsImage::listLenFromRef(ostream& str1, ostream& str2,
+ const Vector& vv,
+ Coord::CoordSystem sys, Coord::DistFormat dist)
+{
+ Vector out = mapLenFromRef(vv, sys, dist);
+
+ switch (sys) {
+ case Coord::IMAGE:
+ case Coord::PHYSICAL:
+ case Coord::DETECTOR:
+ case Coord::AMPLIFIER:
+ str1 << setprecision(context_->parent_->precLenLinear_) << out[0];
+ str2 << setprecision(context_->parent_->precLenLinear_) << out[1];
+ break;
+ default:
+ if (hasWCS(sys)) {
+ if (hasWCSCel(sys)) {
+ switch (dist) {
+ case Coord::DEGREE:
+ str1 << setprecision(context_->parent_->precLenDeg_);
+ str2 << setprecision(context_->parent_->precLenDeg_);
+ break;
+ case Coord::ARCMIN:
+ str1 << setprecision(context_->parent_->precArcmin_);
+ str2 << setprecision(context_->parent_->precArcmin_);
+ break;
+ case Coord::ARCSEC:
+ str1 << setprecision(context_->parent_->precArcsec_);
+ str2 << setprecision(context_->parent_->precArcsec_);
+ break;
+ }
+ str1 << fixed << out[0];
+ str2 << fixed << out[1];
+ str1.unsetf(ios_base::floatfield);
+ str2.unsetf(ios_base::floatfield);
+ }
+ else {
+ str1 << setprecision(context_->parent_->precLenLinear_) << out[0];
+ str2 << setprecision(context_->parent_->precLenLinear_) << out[1];
+ }
+ }
+ else {
+ str1 << "0";
+ str2 << "0";
+ }
+ }
+}
+
// Map Distance
double FitsImage::mapDistFromRef(const Vector& vv1, const Vector& vv2,
diff --git a/tksao/frame/marker.C b/tksao/frame/marker.C
index 63ebb99..7bdeafa 100644
--- a/tksao/frame/marker.C
+++ b/tksao/frame/marker.C
@@ -1914,6 +1914,33 @@ void Marker::XMLRowPoint(FitsImage* ptr, Coord::CoordSystem sys,
Coord::SkyFrame sky, Coord::SkyFormat format,
Vector vv)
{
+ if (0) {
+ ostringstream str;
+ ptr->listFromRef(str,vv,sys,sky,format);
+
+ char* buf = dupstr(str.str().c_str());
+ char* bptr = buf;
+
+ // lon
+ char* lonptr = buf;
+ while (*bptr && *bptr != ' ')
+ bptr++;
+ *bptr = '\0';
+
+ // lat
+ bptr++;
+ char* latptr = bptr;
+ while (*bptr && *bptr != ' ')
+ bptr++;
+ *bptr = '\0';
+
+ XMLRow(XMLX,lonptr);
+ XMLRow(XMLY,latptr);
+ delete [] buf;
+ return;
+ }
+ else {
+
switch (sys) {
case Coord::IMAGE:
case Coord::PHYSICAL:
@@ -1930,6 +1957,7 @@ void Marker::XMLRowPoint(FitsImage* ptr, Coord::CoordSystem sys,
XMLRow(XMLX,ra);
XMLRow(XMLY,dec);
}
+ }
}
void Marker::XMLRowPoint(FitsImage* ptr, Coord::CoordSystem sys,
@@ -1975,110 +2003,55 @@ void Marker::XMLRowPoint(FitsImage* ptr, Coord::CoordSystem sys,
void Marker::XMLRowRadiusX(FitsImage* ptr, Coord::CoordSystem sys, Vector vv)
{
- double rr = ptr->mapLenFromRef(vv[0],sys,Coord::ARCSEC);
-
- switch (sys) {
- case Coord::IMAGE:
- case Coord::PHYSICAL:
- case Coord::DETECTOR:
- case Coord::AMPLIFIER:
- XMLRow(XMLR,rr,8);
- break;
- default:
- if (ptr->hasWCS(sys)) {
- if (ptr->hasWCSCel(sys))
- XMLRowARCSEC(XMLR,rr);
- else
- XMLRow(XMLR,rr,8);
- }
- break;
- }
+ ostringstream str;
+ ptr->listLenFromRef(str,vv[0],sys,Coord::ARCSEC);
+ XMLRow(XMLR,(char*)str.str().c_str());
}
void Marker::XMLRowRadiusX(FitsImage* ptr, Coord::CoordSystem sys,
Vector* vv, int cnt)
{
- double rr[cnt];
- for (int ii=0; ii<cnt; ii++)
- rr[ii] = ptr->mapLenFromRef(vv[ii][0],sys,Coord::ARCSEC);
+ ostringstream str;
+ for (int ii=0; ii<cnt; ii++) {
+ ptr->listLenFromRef(str,vv[ii][0],sys,Coord::ARCSEC);
- switch (sys) {
- case Coord::IMAGE:
- case Coord::PHYSICAL:
- case Coord::DETECTOR:
- case Coord::AMPLIFIER:
- XMLRow(XMLRV,rr,cnt,8);
- break;
- default:
- if (ptr->hasWCS(sys)) {
- if (ptr->hasWCSCel(sys))
- XMLRowARCSEC(XMLRV,rr,cnt);
- else
- XMLRow(XMLRV,rr,cnt,8);
- }
- break;
+ if (ii!=cnt-1)
+ str << ' ';
+ else
+ str << ends;
}
+ XMLRow(XMLRV,(char*)str.str().c_str());
}
void Marker::XMLRowRadius(FitsImage* ptr, Coord::CoordSystem sys, Vector vv)
{
- Vector v = ptr->mapLenFromRef(vv,sys,Coord::ARCSEC);
-
- switch (sys) {
- case Coord::IMAGE:
- case Coord::PHYSICAL:
- case Coord::DETECTOR:
- case Coord::AMPLIFIER:
- XMLRow(XMLR,v[0],8);
- XMLRow(XMLR2,v[1],8);
- break;
- default:
- if (ptr->hasWCS(sys)) {
- if (ptr->hasWCSCel(sys)) {
- XMLRowARCSEC(XMLR,v[0]);
- XMLRowARCSEC(XMLR2,v[1]);
- }
- else {
- XMLRow(XMLR,v[0],8);
- XMLRow(XMLR2,v[1],8);
- }
- }
- break;
- }
+ ostringstream str1;
+ ostringstream str2;
+ ptr->listLenFromRef(str1,vv[0],sys,Coord::ARCSEC);
+ ptr->listLenFromRef(str2,vv[1],sys,Coord::ARCSEC);
+ XMLRow(XMLR, (char*)str1.str().c_str());
+ XMLRow(XMLR2,(char*)str2.str().c_str());
}
void Marker::XMLRowRadius(FitsImage* ptr, Coord::CoordSystem sys,
Vector* vv, int cnt)
{
- double rr[cnt];
- double rr2[cnt];
+ ostringstream str1;
+ ostringstream str2;
for (int ii=0; ii<cnt; ii++) {
- Vector v = ptr->mapLenFromRef(vv[ii],sys,Coord::ARCSEC);
- rr[ii] = v[0];
- rr2[ii] = v[1];
- }
+ ptr->listLenFromRef(str1,str2,vv[ii],sys,Coord::ARCSEC);
- switch (sys) {
- case Coord::IMAGE:
- case Coord::PHYSICAL:
- case Coord::DETECTOR:
- case Coord::AMPLIFIER:
- XMLRow(XMLRV,rr,cnt,8);
- XMLRow(XMLRV2,rr2,cnt,8);
- break;
- default:
- if (ptr->hasWCS(sys)) {
- if (ptr->hasWCSCel(sys)) {
- XMLRowARCSEC(XMLRV,rr,cnt);
- XMLRowARCSEC(XMLRV2,rr2,cnt);
- }
- else {
- XMLRow(XMLRV,rr,cnt,8);
- XMLRow(XMLRV2,rr2,cnt,8);
- }
+ if (ii!=cnt-1) {
+ str1 << ' ';
+ str2 << ' ';
+ }
+ else {
+ str1 << ends;
+ str2 << ends;
}
- break;
}
+ XMLRow(XMLRV, (char*)str1.str().c_str());
+ XMLRow(XMLRV2,(char*)str2.str().c_str());
}
void Marker::XMLRowAng(Coord::CoordSystem sys, Coord::SkyFrame sky)