X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdimension.h;h=b3993b0413856b858106b7a7d408cca38aba02c4;hb=6533354910fbf76d9747deeae02b2e910ef9aa48;hp=0cda92924fa9cd75aabe1e0e64a4a3d7452d5e8e;hpb=baf67656b97e3d61e9223e66ebe4f554e364cd4a;p=architektonas diff --git a/src/dimension.h b/src/dimension.h index 0cda929..b3993b0 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -3,29 +3,46 @@ #include "object.h" -enum DimensionType { DTLinear, DTRadial, DTDiametric, DTCircumferential, DTLeader }; +class Line; + +enum DimensionType { DTLinear, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader }; class Dimension: public Object { + friend class Line; + friend class Geometry; + public: Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0); - Dimension(Vector *, Vector *, DimensionType dt = DTLinear, Object * p = 0); ~Dimension(); virtual void Draw(Painter *); virtual Vector Center(void); virtual bool Collided(Vector); - virtual void PointerMoved(Vector); + virtual bool PointerMoved(Vector); virtual void PointerReleased(void); - void SetPoint1(Vector *); - void SetPoint2(Vector *); - Vector GetPoint1(void); - Vector GetPoint2(void); + virtual bool HitTest(Point); + virtual void Translate(Vector); + virtual void Rotate(Point, double); + virtual void Mirror(Point, Point); + virtual void Save(void); + virtual void Restore(void); + virtual void Enumerate(FILE *); + virtual Object * Copy(void); + virtual Vector GetPointAtParameter(double parameter); + virtual void MovePointAtParameter(double parameter, Vector); + virtual QRectF Extents(void); void FlipSides(void); + protected: + void SaveHitState(void); + bool HitStateChanged(void); + protected: Vector endpoint; // Starting point is Object::position Vector oldPoint; // Used for dragging + Point oldEndpoint; + Point linePt1, linePt2; // Used for testing dimension line hits private: bool dragging; @@ -33,10 +50,16 @@ class Dimension: public Object bool draggingHandle2; bool objectWasDragged; double length; - DimensionType type; - - Vector * point1; // These couple to external points; if there - Vector * point2; // are none then fall back to endpoint/position + DimensionType dimensionType; + bool hitPoint1; + bool hitPoint2; + bool hitLine; + bool hitFlipSwitch; + bool hitChangeSwitch1; + bool hitChangeSwitch2; + bool oldHitPoint1, oldHitPoint2, oldHitLine, oldHitFlipSwitch, oldHitChangeSwitch1, oldHitChangeSwitch2; + public: + double size; // Size of arrows/text in base units }; #endif // __DIMENSION_H__