]> Shamusworld >> Repos - architektonas/blobdiff - src/dimension.h
Fixed duplicate Connection issue.
[architektonas] / src / dimension.h
index 0cda92924fa9cd75aabe1e0e64a4a3d7452d5e8e..ca146bb4a48abd184e9343b52c58c8d3aa0e6592 100644 (file)
@@ -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;
+
        public:
                Dimension(Vector, Vector, DimensionType dt = DTLinear, 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 *);
@@ -17,15 +22,25 @@ 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 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;
@@ -33,10 +48,18 @@ class Dimension: public Object
                bool draggingHandle2;
                bool objectWasDragged;
                double length;
-               DimensionType type;
+               DimensionType dimensionType;
+               bool hitPoint1;
+               bool hitPoint2;
+               bool oldHitPoint1, oldHitPoint2;
+       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__