#include <vector> // This is a container
#include "vector.h" // This is the mathematical construct
#include "connection.h"
+#include <QRectF>
class Painter;
class QFont;
//class FILE;
enum ObjectState { OSInactive, OSSelected };
+enum ObjectType { OTNone, OTObject, OTLine, OTCircle, OTArc, OTDimension, OTEllipse, OTContainer };
class Object
{
+ friend class Geometry;
+
public:
Object();
Object(Vector, Object * passedInParent = 0);
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 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 *);
-// Dimension * GetAttachedDimension(void);
-//Hm. Object * Connect(Object *);
// Class methods
static void SetFixedAngle(bool state = true);
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 * 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__