X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdimension.h;h=9a9b3d48c024e4e4f35666304f281a4e19492f74;hb=31dd33b097661175a86b6799df525972055099fb;hp=44e2afe3e4b1101de32c176f4cf236359f110c48;hpb=5446001bd9adfd9f4787f5de5a2a7afd8d7cdb5a;p=architektonas diff --git a/src/dimension.h b/src/dimension.h index 44e2afe..9a9b3d4 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -3,11 +3,17 @@ #include "object.h" +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, Object * p = 0); - Dimension(Vector *, Vector *, Object * p = 0); + Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0); ~Dimension(); virtual void Draw(Painter *); @@ -15,15 +21,23 @@ class Dimension: public Object virtual bool Collided(Vector); virtual void PointerMoved(Vector); virtual void PointerReleased(void); - void SetPoint1(Vector *); - void SetPoint2(Vector *); - Vector GetPoint1(void); - Vector GetPoint2(void); + virtual bool HitTest(Point); + 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; @@ -31,9 +45,14 @@ class Dimension: public Object bool draggingHandle2; bool objectWasDragged; double length; - - 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 oldHitPoint1, oldHitPoint2, oldHitLine, oldHitFlipSwitch; + public: + double size; // Size of arrows/text in base units }; #endif // __DIMENSION_H__