diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-10 19:22:10 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-10 19:22:10 (GMT) |
commit | f82e40472155ec329ecf6ecb96af54f22e39e2ba (patch) | |
tree | 44e8d9f2e644a7b66161f9cc30af1d0a5ff2b783 /tksao | |
parent | 93d29c498fef16baaebbf801d4025e0a1f5fccf3 (diff) | |
download | blt-f82e40472155ec329ecf6ecb96af54f22e39e2ba.zip blt-f82e40472155ec329ecf6ecb96af54f22e39e2ba.tar.gz blt-f82e40472155ec329ecf6ecb96af54f22e39e2ba.tar.bz2 |
simplify marker code
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/frame/line.C | 21 | ||||
-rw-r--r-- | tksao/frame/projection.C | 35 | ||||
-rw-r--r-- | tksao/frame/projection.h | 3 | ||||
-rw-r--r-- | tksao/frame/vect.C | 32 | ||||
-rw-r--r-- | tksao/frame/vect.h | 3 |
5 files changed, 42 insertions, 52 deletions
diff --git a/tksao/frame/line.C b/tksao/frame/line.C index a0aac87..3b31095 100644 --- a/tksao/frame/line.C +++ b/tksao/frame/line.C @@ -210,18 +210,19 @@ void Line::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - listNonCel(ptr, str, sys); + { + Vector v1 = ptr->mapFromRef(p1,sys); + Vector v2 = ptr->mapFromRef(p2,sys); + str << type_ << '(' << setprecision(parent->precLinear_) + << v1 << ',' << v2 << ')'; + } break; default: - if (ptr->hasWCSCel(sys)) { - str << type_ << '('; - listWCS(ptr,p1,sys,sky,format); - str << ra << ',' << dec << ','; - listWCS(ptr,p2,sys,sky,format); - str << ra << ',' << dec << ')'; - } - else - listNonCel(ptr, str, sys); + str << type_ << '('; + listWCS(ptr,p1,sys,sky,format); + str << ra << ',' << dec << ','; + listWCS(ptr,p2,sys,sky,format); + str << ra << ',' << dec << ')'; } listPost(str, conj, strip); diff --git a/tksao/frame/projection.C b/tksao/frame/projection.C index d2af62f..6c22d6e 100644 --- a/tksao/frame/projection.C +++ b/tksao/frame/projection.C @@ -342,26 +342,34 @@ void Projection::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, FitsImage* ptr = parent->findFits(sys,center); listPre(str, sys, sky, ptr, strip, 1); + double ww = ptr->mapLenFromRef(width,sys,Coord::ARCSEC); + switch (sys) { case Coord::IMAGE: case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - listNonCel(ptr, str, sys); + { + Vector v1 = ptr->mapFromRef(p1,sys); + Vector v2 = ptr->mapFromRef(p2,sys); + str << type_ << '(' << setprecision(parent->precLinear_) + << v1 << ',' << v2 << ',' + << ww << ')'; + } break; default: + str << type_ << '('; + listWCS(ptr,p1,sys,sky,format); + str << ra << ',' << dec << ','; + listWCS(ptr,p2,sys,sky,format); + str << ra << ',' << dec << ','; + if (ptr->hasWCSCel(sys)) { - double ww = ptr->mapLenFromRef(width,sys,Coord::ARCSEC); - str << type_ << '('; - listWCS(ptr,p1,sys,sky,format); - str << ra << ',' << dec << ','; - listWCS(ptr,p2,sys,sky,format); - str << ra << ',' << dec << ','; str << setprecision(parent->precArcsec_) << fixed << ww << '"' << ')'; str.unsetf(ios_base::floatfield); } else - listNonCel(ptr, str, sys); + str << setprecision(parent->precLinear_) << ww << ')'; } if (conj) @@ -371,17 +379,6 @@ void Projection::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, } } -void Projection::listNonCel(FitsImage* ptr, ostream& str, - Coord::CoordSystem sys) -{ - Vector v1 = ptr->mapFromRef(p1,sys); - Vector v2 = ptr->mapFromRef(p2,sys); - double ww = ptr->mapLenFromRef(width,sys); - str << type_ << '(' << setprecision(parent->precLinear_) - << v1 << ',' << v2 << ',' - << ww << ')'; -} - void Projection::listXML(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, Coord::SkyFormat format) { diff --git a/tksao/frame/projection.h b/tksao/frame/projection.h index b758df5..edea362 100644 --- a/tksao/frame/projection.h +++ b/tksao/frame/projection.h @@ -33,9 +33,6 @@ class Projection : public BaseLine { void updateHandles(); void calcAllBBox(); - protected: - void listNonCel(FitsImage*, ostream&, Coord::CoordSystem); - public: Projection(const Projection&); Projection(Base* p, const Vector& ptr1, const Vector& ptr2, diff --git a/tksao/frame/vect.C b/tksao/frame/vect.C index 931180b..ea87b50 100644 --- a/tksao/frame/vect.C +++ b/tksao/frame/vect.C @@ -59,25 +59,32 @@ void Vect::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, FitsImage* ptr = parent->findFits(sys,center); listPre(str, sys, sky, ptr, strip, 1); + double rr = ptr->mapLenFromRef((p2-p1).length(),sys,Coord::ARCSEC); + double aa = parent->mapAngleFromRef((p2-p1).angle(),sys,sky); + switch (sys) { case Coord::IMAGE: case Coord::PHYSICAL: case Coord::DETECTOR: case Coord::AMPLIFIER: - listNonCel(ptr, str, sys); + { + Vector v1 = ptr->mapFromRef(p1,sys); + str << type_ << '(' << setprecision(parent->precLinear_) << v1 << ',' + << rr << ',' << radToDeg(aa) << ')'; + } break; default: + listWCS(ptr,p1,sys,sky,format); + str << type_ << '(' << ra << ',' << dec << ',' ; + if (ptr->hasWCSCel(sys)) { - listWCS(ptr,p1,sys,sky,format); - double rr = ptr->mapLenFromRef((p2-p1).length(),sys,Coord::ARCSEC); - double aa = parent->mapAngleFromRef((p2-p1).angle(),sys,sky); - str << type_ << '(' << ra << ',' << dec << ',' - << setprecision(parent->precArcsec_) << fixed << rr << '"' << ','; + str << setprecision(parent->precArcsec_) << fixed << rr << '"' << ','; str.unsetf(ios_base::floatfield); - str << setprecision(parent->precLinear_) << radToDeg(aa) << ')'; } else - listNonCel(ptr, str, sys); + str << setprecision(parent->precLinear_) << rr << ',' ; + + str << setprecision(parent->precLinear_) << radToDeg(aa) << ')'; } if (conj) @@ -88,15 +95,6 @@ void Vect::list(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, } } -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(parent->precLinear_) << v1 << ',' - << rr << ',' << radToDeg(aa) << ')'; -} - void Vect::listXML(ostream& str, Coord::CoordSystem sys, Coord::SkyFrame sky, Coord::SkyFormat format) { diff --git a/tksao/frame/vect.h b/tksao/frame/vect.h index 4a35101..76eccdd 100644 --- a/tksao/frame/vect.h +++ b/tksao/frame/vect.h @@ -8,9 +8,6 @@ #include "line.h" class Vect : public Line { - protected: - void listNonCel(FitsImage*, ostream&, Coord::CoordSystem); - public: Vect(Base* p, const Vector& pt, double mag, double ang); |