X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fobject.h;h=08b7e9dc9f9324c79a3c9da6d6f6aedc0f287438;hb=4d6ba8a6eb781dbee818b6a55d21df7b52468936;hp=deaa91f3604f923b16a805fd57ccc55e241ca749;hpb=c51c02d23ddd4423882da2c54b76f8f2c90c1c99;p=architektonas diff --git a/src/object.h b/src/object.h index deaa91f..08b7e9d 100644 --- a/src/object.h +++ b/src/object.h @@ -1,52 +1,101 @@ #ifndef __OBJECT_H__ #define __OBJECT_H__ -#include "vector.h" +#include +#include // This is a container +#include "vector.h" // This is the mathematical construct +#include "connection.h" +#include -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 { + 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 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: Vector position; // All objects have a position (doubles as reference point) 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 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__