summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tksao/frame/fitsimage.h1
-rw-r--r--tksao/frame/fitsmap.C42
-rw-r--r--tksao/frame/marker.C94
3 files changed, 60 insertions, 77 deletions
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index b234c1c..bd81793 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -427,6 +427,7 @@ class FitsImage {
double mapDistFromRef(const Vector&, const Vector&, Coord::CoordSystem,
Coord::DistFormat =Coord::DEGREE);
void listFromRef(ostream&, const Vector&, Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat);
+ void listFromRef(ostream&, 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);
diff --git a/tksao/frame/fitsmap.C b/tksao/frame/fitsmap.C
index 3bb2ec8..450665e 100644
--- a/tksao/frame/fitsmap.C
+++ b/tksao/frame/fitsmap.C
@@ -102,7 +102,7 @@ void FitsImage::listFromRef(ostream& str, const Vector& vv,
case Coord::PHYSICAL:
case Coord::DETECTOR:
case Coord::AMPLIFIER:
- str << mapFromRef(vv, sys);
+ str << setprecision(context_->parent_->precLinear_) << mapFromRef(vv, sys);
break;
default:
{
@@ -113,6 +113,46 @@ void FitsImage::listFromRef(ostream& str, const Vector& vv,
}
}
+void FitsImage::listFromRef(ostream& str1, ostream& str2, const Vector& vv,
+ Coord::CoordSystem sys, Coord::SkyFrame sky,
+ Coord::SkyFormat format)
+{
+ switch (sys) {
+ case Coord::IMAGE:
+ case Coord::PHYSICAL:
+ case Coord::DETECTOR:
+ case Coord::AMPLIFIER:
+ {
+ Vector rr = mapFromRef(vv, sys);
+ str1 << setprecision(context_->parent_->precLinear_) << rr[0];
+ str2 << setprecision(context_->parent_->precLinear_) << rr[1];
+ }
+ break;
+ default:
+ {
+ char buf[128];
+ char* bptr = buf;
+ mapFromRef(vv,sys,sky,format,buf);
+
+ // lon
+ char* lonptr = buf;
+ while (*bptr && *bptr != ' ')
+ bptr++;
+ *bptr = '\0';
+
+ // lat
+ bptr++;
+ char* latptr = bptr;
+ while (*bptr && *bptr != ' ')
+ bptr++;
+ *bptr = '\0';
+
+ str1 << lonptr;
+ str2 << latptr;
+ }
+ }
+}
+
// Map Length
Vector FitsImage::mapLen(const Vector& vv, const Matrix& mx)
diff --git a/tksao/frame/marker.C b/tksao/frame/marker.C
index 7bdeafa..350fc7b 100644
--- a/tksao/frame/marker.C
+++ b/tksao/frame/marker.C
@@ -1914,91 +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:
- case Coord::DETECTOR:
- case Coord::AMPLIFIER:
- {
- Vector v = ptr->mapFromRef(vv,sys);
- XMLRow(XMLX,v[0],parent->precLinear_);
- XMLRow(XMLY,v[1],parent->precLinear_);
- }
- break;
- default:
- listWCS(ptr,vv,sys,sky,format);
- XMLRow(XMLX,ra);
- XMLRow(XMLY,dec);
- }
- }
+ ostringstream str1;
+ ostringstream str2;
+ ptr->listFromRef(str1,str2,vv,sys,sky,format);
+ XMLRow(XMLX,(char*)str1.str().c_str());
+ XMLRow(XMLY,(char*)str2.str().c_str());
}
void Marker::XMLRowPoint(FitsImage* ptr, Coord::CoordSystem sys,
Coord::SkyFrame sky, Coord::SkyFormat format,
Vector* vv, int cnt)
{
- switch (sys) {
- case Coord::IMAGE:
- case Coord::PHYSICAL:
- case Coord::DETECTOR:
- case Coord::AMPLIFIER:
- {
- double xx[cnt];
- double yy[cnt];
- for (int ii=0; ii<cnt; ii++) {
- Vector v = ptr->mapFromRef(vv[ii],sys);
- xx[ii] = v[0];
- yy[ii] = v[1];
- }
- XMLRow(XMLXV,xx,cnt,parent->precLinear_);
- XMLRow(XMLYV,yy,cnt,parent->precLinear_);
- }
- break;
- default:
- {
- char* xx[cnt];
- char* yy[cnt];
- for (int ii=0; ii<cnt; ii++) {
- listWCS(ptr,vv[ii],sys,sky,format);
- xx[ii] = dupstr(ra);
- yy[ii] = dupstr(dec);
- }
- XMLRow(XMLXV,xx,cnt);
- XMLRow(XMLYV,yy,cnt);
+ ostringstream str1;
+ ostringstream str2;
+ for (int ii=0; ii<cnt; ii++) {
+ ptr->listFromRef(str1,str2,vv[ii],sys,sky,format);
- for (int ii=0; ii<cnt; ii++) {
- delete [] xx[ii];
- delete [] yy[ii];
- }
+ if (ii!=cnt-1) {
+ str1 << ' ';
+ str2 << ' ';
+ }
+ else {
+ str1 << ends;
+ str2 << ends;
}
}
+ XMLRow(XMLXV,(char*)str1.str().c_str());
+ XMLRow(XMLYV,(char*)str2.str().c_str());
}
void Marker::XMLRowRadiusX(FitsImage* ptr, Coord::CoordSystem sys, Vector vv)