]> Shamusworld >> Repos - architektonas/blobdiff - src/dimension.h
Add Dimension sizing.
[architektonas] / src / dimension.h
index 44e2afe3e4b1101de32c176f4cf236359f110c48..252c93375dfa3f2a0afe6ab66b8e98614d4046a0 100644 (file)
@@ -1,13 +1,16 @@
 #ifndef __DIMENSION_H__
 #define __DIMENSION_H__
 
+#include "connection.h"
 #include "object.h"
 
+enum DimensionType { DTLinear, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader };
+
 class Dimension: public Object
 {
        public:
-               Dimension(Vector, Vector, Object * p = 0);
-               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(Painter *);
@@ -15,10 +18,13 @@ 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 void Enumerate(FILE *);
+//             virtual Object * Copy(void);
+               virtual Vector GetPointAtParameter(double parameter);
+               virtual void Connect(Object *, double);
+               virtual void Disconnect(Object *, double);
+               virtual void DisconnectAll(Object *);
+               virtual QRectF Extents(void);
                void FlipSides(void);
 
        protected:
@@ -31,9 +37,15 @@ class Dimension: public Object
                bool draggingHandle2;
                bool objectWasDragged;
                double length;
+               DimensionType dimensionType;
+       public:
+               double size;                                            // Size of arrows/text in base units
 
-               Vector * point1;                                        // These couple to external points; if there
-               Vector * point2;                                        // are none then fall back to endpoint/position
+       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__