]> Shamusworld >> Repos - architektonas/blobdiff - src/object.h
Fixed Container loading, informative display.
[architektonas] / src / object.h
index b6f9558e452b9386a80cab88f841f49651dfa88c..b8fdd9db76f70b0a2cf8fbd5e797951c278183e3 100644 (file)
@@ -1,14 +1,19 @@
 #ifndef __OBJECT_H__
 #define __OBJECT_H__
 
+#include <stdio.h>
 #include <vector>                                                      // This is a container
 #include "vector.h"                                                    // This is the mathematical construct
+#include "connection.h"
+#include <QRectF>
 
 class Painter;
 class QFont;
 class Dimension;
+//class FILE;
 
 enum ObjectState { OSInactive, OSSelected };
+enum ObjectType { OTNone, OTObject, OTLine, OTCircle, OTArc, OTDimension, OTEllipse, OTContainer };
 
 class Object
 {
@@ -23,11 +28,25 @@ class Object
                virtual void PointerMoved(Vector);
                virtual void PointerReleased(void);
                virtual bool NeedsUpdate(void);
+               virtual bool HitTest(Point);
                virtual void Transmute(Object *, Object *);
                virtual Object * GetParent(void);
                virtual void Add(Object *);
+               virtual Vector * GetPointAt(Vector);
+               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);
+//             virtual ObjectType Type(void);// = 0; // Pure virtual, must be implemented
+               virtual void Translate(Vector);
+               virtual void Rotate(Vector, double);
+               virtual void Scale(Vector, double);
                ObjectState GetState(void);
                void Reparent(Object *);
+//             Dimension * GetAttachedDimension(void);
 //Hm.          Object * Connect(Object *);
 
                // Class methods
@@ -37,25 +56,40 @@ class Object
                static void SetViewportHeight(int);
                static void SetDeleteActive(bool state = true);
                static void SetDimensionActive(bool state = true);
+               static void SetSnapMode(bool state = true);
+               static Vector SnapPointToGrid(Vector);
 
        protected:
                Vector position;                                        // All objects have a position (doubles as reference point)
                Object * parent;
 //             Pen pen;
 //             Fill fill;
+       public:
+               ObjectType type;
                ObjectState state;
+       protected:
                ObjectState oldState;
                bool needUpdate;
-               Dimension * attachedDimension;
-               std::vector<Object *> connected;
+//             Dimension * attachedDimension;
+               std::vector<Connection> connected;
 
                // Class variables
+       public:
                static QFont * font;
+       protected:
                static bool fixedAngle;
                static bool fixedLength;
                static int viewportHeight;
                static bool deleteActive;
                static bool dimensionActive;
+       public:
+               static bool snapToGrid;
+               static bool ignoreClicks;
+               static bool dontMove;
+       public:
+               static bool selectionInProgress;
+               static QRectF selection;
+               static double gridSpacing;                      // Grid spacing in base units
 };
 
 #endif // __OBJECT_H__