X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdimension.h;h=9a9b3d48c024e4e4f35666304f281a4e19492f74;hb=31dd33b097661175a86b6799df525972055099fb;hp=4afc2ace68a2ac59c336efd8fac309cfc6c874f9;hpb=631fbe38f52222a65f1c3bcefb11a616d6806dd6;p=architektonas diff --git a/src/dimension.h b/src/dimension.h index 4afc2ac..9a9b3d4 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -1,16 +1,19 @@ #ifndef __DIMENSION_H__ #define __DIMENSION_H__ -#include "connection.h" #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, DimensionType dt = DTLinear, Object * p = 0); - Dimension(Connection, Connection, DimensionType dt = DTLinear, Object * p = 0); ~Dimension(); virtual void Draw(Painter *); @@ -18,18 +21,23 @@ 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); + virtual Object * Copy(void); virtual Vector GetPointAtParameter(double parameter); - virtual void Connect(Object *, double); - virtual void Disconnect(Object *, double); - virtual void DisconnectAll(Object *); + 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; @@ -38,12 +46,13 @@ class Dimension: public Object bool objectWasDragged; double length; 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 - - // We use these in lieu of the built-in connected[] array; no reason to - // do it this way especially - Connection point1; - Connection point2; }; #endif // __DIMENSION_H__