diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-08-07 18:18:23 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-08-07 18:18:23 (GMT) |
commit | c0ae76bd0d0f5e40c66792f29e12b67bb4a5c785 (patch) | |
tree | ac9f46834dc74cdb9cb5c37293619b81dacc4eb5 /tksao/frame | |
parent | ac5f936afba9b8aca203ad64d4676821464e78dc (diff) | |
download | blt-c0ae76bd0d0f5e40c66792f29e12b67bb4a5c785.zip blt-c0ae76bd0d0f5e40c66792f29e12b67bb4a5c785.tar.gz blt-c0ae76bd0d0f5e40c66792f29e12b67bb4a5c785.tar.bz2 |
clean up code
Diffstat (limited to 'tksao/frame')
-rw-r--r-- | tksao/frame/ruler.C | 35 | ||||
-rw-r--r-- | tksao/frame/ruler.h | 3 |
2 files changed, 25 insertions, 13 deletions
diff --git a/tksao/frame/ruler.C b/tksao/frame/ruler.C index 3b2addb..fc42870 100644 --- a/tksao/frame/ruler.C +++ b/tksao/frame/ruler.C @@ -12,14 +12,15 @@ Ruler::Ruler(const Ruler& a) : BaseLine(a) p3 = a.p3; coordSystem = a.coordSystem; skyFrame = a.skyFrame; + dist = a.dist; distSystem = a.distSystem; distDist = a.distDist; - dist = a.dist; + strncpy(distSpec, a.distSpec, 32); } Ruler::Ruler(Base* p, const Vector& ptr1, const Vector& ptr2, Coord::CoordSystem sys, Coord::SkyFrame sky, - Coord::CoordSystem distsys, Coord::DistFormat distfor, + Coord::CoordSystem distsys, Coord::DistFormat distformat, const char* clr, int* dsh, int wth, const char* fnt, const char* txt, unsigned short prop, const char* cmt, @@ -28,9 +29,11 @@ Ruler::Ruler(Base* p, const Vector& ptr1, const Vector& ptr2, { coordSystem = sys; skyFrame = sky; - distSystem = distsys; - distDist = distfor; dist = 0; + distSystem = distsys; + distDist = distformat; + // strncpy(distSpec, spec, 32); + distSpec[0] = '\0'; strcpy(type_,"ruler"); handle = new Vector[2]; @@ -434,34 +437,42 @@ void Ruler::setCoordSystem(Coord::CoordSystem sys, Coord::SkyFrame sky, void Ruler::distToStr(ostringstream& str) { + if (*distSpec) { + char buf[64]; + sprintf(buf, distSpec, dist); + str << buf; + } + else + str << dist; + switch (distSystem) { case Coord::IMAGE: - str << dist << " img"; + str << " img"; break; case Coord::PHYSICAL: - str << dist << " phy"; + str << " phy"; break; case Coord::AMPLIFIER: - str << dist << " amp"; + str << " amp"; break; case Coord::DETECTOR: - str << dist << " det"; + str << " det"; break; default: if (parent->findFits()->hasWCSCel(distSystem)) switch (distDist) { case Coord::DEGREE: - str << dist << " deg"; + str << " deg"; break; case Coord::ARCMIN: - str << dist << '\''; + str << '\''; break; case Coord::ARCSEC: - str << dist << '"'; + str << '"'; break; } else - str << dist << " lin"; + str << " lin"; } } diff --git a/tksao/frame/ruler.h b/tksao/frame/ruler.h index 849d5fc..3068c13 100644 --- a/tksao/frame/ruler.h +++ b/tksao/frame/ruler.h @@ -12,9 +12,10 @@ private: Vector p3; Coord::CoordSystem coordSystem; Coord::SkyFrame skyFrame; + double dist; Coord::CoordSystem distSystem; Coord::DistFormat distDist; - double dist; + char distSpec[32]; private: void renderX(Drawable, Coord::InternalSystem, RenderMode); |