// Copyright (C) 1999-2018 // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" #include "basemarker.h" #include "base.h" // Base Markers Public BaseMarker::BaseMarker(Base* p, const Vector& ctr, double ang) : Marker(p, ctr, ang) { startAng_ = 0; stopAng_ = M_TWOPI; numAnnuli_ = 0; annuli_ = NULL; numAngles_ = 0; angles_ = NULL; } BaseMarker::BaseMarker(Base* p, const Vector& ctr, double ang, const char* clr, int* dsh, int w, const char* f, const char* t, unsigned short prop, const char* c, const List& tag, const List& cb) : Marker(p, ctr, ang, clr, dsh, w, f, t, prop, c, tag, cb) { startAng_ = 0; stopAng_ = M_TWOPI; numAnnuli_ = 0; annuli_ = NULL; numAngles_ = 0; angles_ = NULL; } BaseMarker::BaseMarker(const BaseMarker& a) : Marker(a) { startAng_ = a.startAng_; stopAng_ = a.stopAng_; numAnnuli_ = a.numAnnuli_; annuli_ = new Vector[a.numAnnuli_]; for (int i=0; i4) { int hh = h-4-1; if (numAnnuli_>2 && hhannuli_[j][0]) { Vector d = annuli_[i]; annuli_[i] = annuli_[j]; annuli_[j] = d; } } int BaseMarker::isInAngle(Vector& vv, int nn) { double aa = -vv.angle(); while (aa=angles_[nn] && aa1 && angles_[0]==0 && angles_[numAngles_-1]==0) angles_[numAngles_-1] += M_TWOPI; } void BaseMarker::setAngles(double a1, double a2, int an) { numAngles_ = an+1; if (angles_) delete [] angles_; angles_ = new double[numAngles_]; // yes this is really needed // for a2a1 very small if (teq(a2,a1,FLT_EPSILON)) { a1 = zeroTWOPI(a1); a2 = zeroTWOPI(a2); if (teq(a2,a1,FLT_EPSILON)) a2 += M_TWOPI; } for (int ii=0; iirefToCanvas; return Rotate(calcAngle()) * Translate(cc) * parent->canvasToRef; } else return Marker::fwdMatrix(); } Matrix BaseMarker::bckMatrix() { if (properties & FIXED) { Vector cc = center * parent->refToCanvas; return parent->refToCanvas * Translate(-cc) * Rotate(-calcAngle()); } else return Marker::bckMatrix(); } Vector BaseMarker::fwdMap(const Vector& vv, Coord::InternalSystem sys) { if (properties & FIXED) { Vector cc = center * parent->refToCanvas; Vector dd = vv * Rotate(calcAngle()) * Translate(cc); Vector ee = dd*parent->canvasToRef; return parent->mapFromRef(ee,sys); } else return Marker::fwdMap(vv,sys); } Vector BaseMarker::bckMap(const Vector& vv, Coord::InternalSystem sys) { if (properties & FIXED) { Vector aa = parent->mapToRef(vv,sys); Vector bb = aa*parent->refToCanvas; Vector cc = center * parent->refToCanvas; return bb * Translate(-cc) * Rotate(-calcAngle()); } else return Marker::bckMap(vv,sys); }