From f82e40472155ec329ecf6ecb96af54f22e39e2ba Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 10 Aug 2018 15:22:10 -0400 Subject: simplify marker code --- tksao/frame/line.C | 21 +++++++++++---------- tksao/frame/projection.C | 35 ++++++++++++++++------------------- tksao/frame/projection.h | 3 --- tksao/frame/vect.C | 32 +++++++++++++++----------------- 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); -- cgit v0.12