]> Shamusworld >> Repos - architektonas/blobdiff - src/object.h
Added new Spline object and Add Spline tool to GUI.
[architektonas] / src / object.h
index deaa91f3604f923b16a805fd57ccc55e241ca749..b83adaf02399fcb9e3f89db4dfaea9ebb3b2809f 100644 (file)
 #ifndef __OBJECT_H__
 #define __OBJECT_H__
 
-#include "vector.h"
+#include <stdio.h>
+#include <vector>                                                      // This is a container
+#include "vector.h"                                                    // This is the mathematical construct
+#include "connection.h"
+#include <QRectF>
 
-class QPainter;
+class Painter;
 class QFont;
 class Dimension;
+//class FILE;
 
 enum ObjectState { OSInactive, OSSelected };
+enum ObjectType { OTNone, OTObject, OTLine, OTCircle, OTArc, OTDimension, OTEllipse, OTContainer, OTSpline };
 
 class Object
 {
+       friend class Geometry;
+
        public:
                Object();
                Object(Vector, Object * passedInParent = 0);
                ~Object();
 
-               virtual void Draw(QPainter *);
+               virtual void Draw(Painter *);
                virtual Vector Center(void);
                virtual bool Collided(Vector);
-               virtual void PointerMoved(Vector);
+               virtual bool 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);
+//Not yet, soon though         virtual void MovePointAtParameter(double parameter, Vector);
+               virtual void Connect(Object *, double);
+               virtual void Disconnect(Object *, double);
+               virtual void DisconnectAll(Object *);
+               virtual QRectF Extents(void);
+               virtual void Translate(Vector);
+               virtual void Rotate(Point, double);
+               virtual void Scale(Point, double);
+               virtual void Mirror(Point, Point);
+               virtual void Save(void);
+               virtual void Restore(void);
                ObjectState GetState(void);
+               void Reparent(Object *);
 
                // Class methods
                static void SetFixedAngle(bool state = true);
                static void SetFixedLength(bool state = true);
                static void SetFont(QFont *);
                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:
+       public:
                Vector position;                                        // All objects have a position (doubles as reference point)
+       protected:
                Object * parent;
+//this needs to be added eventually
 //             Pen pen;
 //             Fill fill;
+               Point oldPosition;
+       public:
+               ObjectType type;
                ObjectState state;
+               unsigned int layer;
+       protected:
                ObjectState oldState;
                bool needUpdate;
-               Dimension * dimPoint1;
-               Dimension * dimPoint2;
+               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
+               static int currentLayer;
 };
 
 #endif // __OBJECT_H__