X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdimension.h;h=c3709b61bbaf24da3fa23aa78a273ba3a399ec7f;hb=51de783e1c8d149c9dd9bd0999f2ad25dbe6edf2;hp=52f838f665c7cfea629e9148d0470b507cad5c63;hpb=eb0057e8a8145032152e4c417fcd102ef5a21484;p=architektonas diff --git a/src/dimension.h b/src/dimension.h index 52f838f..c3709b6 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -1,15 +1,20 @@ #ifndef __DIMENSION_H__ #define __DIMENSION_H__ +#include "connection.h" #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 *); @@ -17,17 +22,22 @@ class Dimension: public Object virtual bool Collided(Vector); virtual void PointerMoved(Vector); virtual void PointerReleased(void); + virtual bool HitTest(Point); virtual void Enumerate(FILE *); virtual Object * Copy(void); - void SetPoint1(Vector *); - void SetPoint2(Vector *); - Vector GetPoint1(void); - Vector GetPoint2(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; private: bool dragging; @@ -35,10 +45,14 @@ 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 oldHitPoint1, oldHitPoint2, oldHitLine, oldHitFlipSwitch; + public: + double size; // Size of arrows/text in base units }; #endif // __DIMENSION_H__