diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-15 19:16:44 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-15 19:16:44 (GMT) |
commit | 9c929fe95cf992440ce00ab90a6abb210d2dab88 (patch) | |
tree | d9b5282efa75366eb88ecbfb3381e6327ad2331f | |
parent | 51fbb2793a327cbb4fb02d74a32eaa112ec00196 (diff) | |
download | blt-9c929fe95cf992440ce00ab90a6abb210d2dab88.zip blt-9c929fe95cf992440ce00ab90a6abb210d2dab88.tar.gz blt-9c929fe95cf992440ce00ab90a6abb210d2dab88.tar.bz2 |
simplify marker code
-rw-r--r-- | tksao/frame/cpanda.C | 76 | ||||
-rw-r--r-- | tksao/frame/ellipse.C | 2 | ||||
-rw-r--r-- | tksao/frame/marker.C | 60 | ||||
-rw-r--r-- | tksao/frame/marker.h | 5 |
4 files changed, 39 insertions, 104 deletions
diff --git a/tksao/frame/cpanda.C b/tksao/frame/cpanda.C index 4135658..fe83438 100644 --- a/tksao/frame/cpanda.C +++ b/tksao/frame/cpanda.C @@ -606,48 +606,48 @@ void Cpanda::listCiao(ostream& str, Coord::CoordSystem sys, int strip) case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - { - Vector vv = ptr->mapFromRef(center,Coord::PHYSICAL); - for (int ii=0; ii<numAnnuli_-1; ii++) { - double r1 = ptr->mapLenFromRef(annuli_[ii][0],Coord::PHYSICAL); - double r2 = ptr->mapLenFromRef(annuli_[ii+1][0],Coord::PHYSICAL); - for (int jj=0; jj<numAngles_-1; jj++) { - double a1 = radToDeg(angles_[jj]); - double a2 = radToDeg(angles_[jj+1]); - if (a2<=a1+FLT_EPSILON) - a2 += 360; - - listCiaoPre(str); - str << "pie(" - << setprecision(parent->precLinear_) << vv << ',' - << setprecision(parent->precLenLinear_) << r1 << ',' << r2 << ',' - << setprecision(parent->precAngle_) << a1 << ',' << a2 << ')'; - listCiaoPost(str, strip); - } + for (int ii=0; ii<numAnnuli_-1; ii++) { + for (int jj=0; jj<numAngles_-1; jj++) { + double a1 = angles_[jj]; + double a2 = angles_[jj+1]; + + listCiaoPre(str); + str << "pie("; + ptr->listFromRef(str,center,Coord::PHYSICAL); + str << ','; + ptr->listLenFromRef(str,annuli_[ii][0],Coord::PHYSICAL); + str << ','; + ptr->listLenFromRef(str,annuli_[ii+1][0],Coord::PHYSICAL); + str << ','; + parent->listAngleFromRef(str,a1,Coord::PHYSICAL); + str << ','; + parent->listAngleFromRef(str,a2,a1,Coord::PHYSICAL); + str << ')'; + listCiaoPost(str, strip); } } break; default: - if (ptr->hasWCSCel(sys)) { - listWCS(ptr,center,sys,Coord::FK5,Coord::SEXAGESIMAL); - for (int ii=0; ii<numAnnuli_-1; ii++) { - double r1 = ptr->mapLenFromRef(annuli_[ii][0],sys,Coord::ARCMIN); - double r2 = ptr->mapLenFromRef(annuli_[ii+1][0],sys,Coord::ARCMIN); - for (int jj=0; jj<numAngles_-1; jj++) { - double a1 = radToDeg(angles_[jj]); - double a2 = radToDeg(angles_[jj+1]); - if (a2<=a1+FLT_EPSILON) - a2 += 360; - - listCiaoPre(str); - str << "pie(" << setprecision(parent->precLinear_) - << ra << ',' << dec << ',' - << setprecision(parent->precLenLinear_) - << r1 << '\'' << ',' << r2 << '\'' << ',' - << setprecision(parent->precAngle_) - << a1 << ',' << a2 << ')'; - listCiaoPost(str, strip); - } + for (int ii=0; ii<numAnnuli_-1; ii++) { + for (int jj=0; jj<numAngles_-1; jj++) { + double a1 = angles_[jj]; + double a2 = angles_[jj+1]; + + listCiaoPre(str); + str << "pie("; + ptr->listFromRef(str,center,sys,Coord::FK5,Coord::SEXAGESIMAL); + str << ','; + ptr->listLenFromRef(str,annuli_[ii][0],sys,Coord::ARCMIN); + str << '\''; + str << ','; + ptr->listLenFromRef(str,annuli_[ii+1][0],sys,Coord::ARCMIN); + str << '\''; + str << ','; + parent->listAngleFromRef(str,a1,Coord::PHYSICAL); + str << ','; + parent->listAngleFromRef(str,a2,a1,Coord::PHYSICAL); + str << ')'; + listCiaoPost(str, strip); } } } diff --git a/tksao/frame/ellipse.C b/tksao/frame/ellipse.C index 94744e1..94d37fd 100644 --- a/tksao/frame/ellipse.C +++ b/tksao/frame/ellipse.C @@ -311,7 +311,7 @@ void Ellipse::listCiao(ostream& str, Coord::CoordSystem sys, int strip) str << setunit('\''); ptr->listLenFromRef(str,annuli_[0],sys,Coord::ARCMIN); str << ','; - parent->listAngleFromRef(str,angle,Coord::PHYSICAL,Coord::FK5); + parent->listAngleFromRef(str,angle,Coord::PHYSICAL); break; } str << ')'; diff --git a/tksao/frame/marker.C b/tksao/frame/marker.C index 5741cf6..2a6ba16 100644 --- a/tksao/frame/marker.C +++ b/tksao/frame/marker.C @@ -1392,66 +1392,6 @@ void Marker::setMatrices(Coord::InternalSystem sys, Matrix* fwd, Matrix* bck) // list -void Marker::listWCS(FitsImage* ptr, - const Vector& vv, Coord::CoordSystem sys, - Coord::SkyFrame sky, Coord::SkyFormat format) -{ - char buf[128]; - ptr->mapFromRef(vv,sys,sky,format,buf); - char* bptr = buf; - - // lon - char* rptr = ra; - while (*bptr && *bptr != ' ') - *rptr++ = *bptr++; - *rptr = '\0'; - - // lat - char* dptr = dec; - bptr++; - while (*bptr && *bptr != ' ') - *dptr++ = *bptr++; - *dptr = '\0'; -} - -void Marker::listWCSLen(ostream& str, FitsImage* ptr, - const Vector& vv, Coord::CoordSystem sys) -{ - if (ptr->hasWCSCel(sys)) { - str << setprecision(parent->precArcsec_) << fixed << setunit('"') << vv; - str.unsetf(ios_base::floatfield); - } - else - str << setprecision(parent->precLinear_) << vv; - str << ','; -} - -void Marker::listWCSPros(FitsImage* ptr, - const Vector& vv, Coord::CoordSystem sys, - Coord::SkyFrame sky, Coord::SkyFormat format) -{ - char buf[128]; - ptr->mapFromRef(vv,sys,sky,format,buf); - char* bptr = buf; - - // lon - char* rptr = ra; - while (*bptr && *bptr != ' ') - *rptr++ = *bptr++; - *rptr = '\0'; - - // lat - char* dptr = dec; - - // skip '+' at beginning - bptr++; - if (*bptr == '+') - bptr++; - while (*bptr && *bptr != ' ') - *dptr++ = *bptr++; - *dptr = '\0'; -} - void Marker::listPre(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, FitsImage* ptr, int strip, int hash) { diff --git a/tksao/frame/marker.h b/tksao/frame/marker.h index 8700eb1..d0846fe 100644 --- a/tksao/frame/marker.h +++ b/tksao/frame/marker.h @@ -159,11 +159,6 @@ protected: void initFonts(const char*); - void listWCS(FitsImage*, const Vector&, Coord::CoordSystem, - Coord::SkyFrame, Coord::SkyFormat); - void listWCSLen(ostream&, FitsImage*, const Vector&, Coord::CoordSystem); - void listWCSPros(FitsImage*, const Vector&, Coord::CoordSystem, - Coord::SkyFrame, Coord::SkyFormat); void listPre(ostream&, Coord::CoordSystem, Coord::SkyFrame, FitsImage*, int, int); virtual void listPost(ostream&, int, int); |