X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdimension.h;h=ba30b8f7e98980eb82274d8983c6b41190e90160;hb=4d6ba8a6eb781dbee818b6a55d21df7b52468936;hp=26fc58800fa5423546ee5451869b8908e1303ac9;hpb=9f6ad3fe0b9cb30115a5d38e8af3aebed0d70c08;p=architektonas diff --git a/src/dimension.h b/src/dimension.h index 26fc588..ba30b8f 100644 --- a/src/dimension.h +++ b/src/dimension.h @@ -1,32 +1,68 @@ #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); -// virtual bool NeedsUpdate(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 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; bool draggingHandle1; bool draggingHandle2; -// bool needUpdate; 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 + + 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__