X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdimension.h;h=a5767a3ebfb4ad94a17492788424d29838e2743c;hb=9590e4ed45fd4e05eccc16bd8e9d51596aea5a6d;hp=34084c26af291a8d31e4bf70aacf58acc1e9f25a;hpb=c51c02d23ddd4423882da2c54b76f8f2c90c1c99;p=architektonas diff --git a/src/dimension.h b/src/dimension.h index 34084c2..a5767a3 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -1,25 +1,47 @@ #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, Object * p = 0); + Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0); + Dimension(Connection, Connection, DimensionType dt = DTLinear, Object * p = 0); ~Dimension(); - virtual void Draw(QPainter *); + virtual void Draw(Painter *); virtual Vector Center(void); virtual bool Collided(Vector); virtual void PointerMoved(Vector); virtual void PointerReleased(void); - void SetPoint1(Vector); - void SetPoint2(Vector); + virtual bool HitTest(Point); + virtual void Enumerate(FILE *); + virtual Object * Copy(void); + virtual Vector GetPointAtParameter(double parameter); + virtual void MovePointAtParameter(double parameter, Vector); + virtual void Connect(Object *, double); + virtual void Disconnect(Object *, double); + virtual void DisconnectAll(Object *); + 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; @@ -27,6 +49,18 @@ class Dimension: public Object bool draggingHandle2; bool objectWasDragged; double length; + DimensionType dimensionType; + bool hitPoint1; + bool hitPoint2; + bool oldHitPoint1, oldHitPoint2; + public: + double size; // Size of arrows/text in base units + + private: + // 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__