]> Shamusworld >> Repos - architektonas/blobdiff - src/object.h
Mirror tool now works successfully for all object types. :-D
[architektonas] / src / object.h
index 8b047be15ab92c0839012fa3f53f22a42098cafd..d34e79ae7598df74e85b3d330f63a390a9aeafe4 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 QPainter;
+class Painter;
 class QFont;
 class Dimension;
+//class FILE;
 
 enum ObjectState { OSInactive, OSSelected };
+enum ObjectType { OTNone, OTObject, OTLine, OTCircle, OTArc, OTDimension, OTEllipse, OTContainer };
 
 class Object
 {
@@ -17,16 +22,34 @@ class 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 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);
+               virtual void Mirror(Point, Point);
+               virtual void Save(void);
+               virtual void Restore(void);
                ObjectState GetState(void);
+               void Reparent(Object *);
+//             Dimension * GetAttachedDimension(void);
 //Hm.          Object * Connect(Object *);
 
                // Class methods
@@ -36,25 +59,43 @@ 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;
+               Point oldPosition;
+       public:
+               ObjectType type;
                ObjectState state;
+               unsigned int layer;
+       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
+               static int currentLayer;
 };
 
 #endif // __OBJECT_H__