X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fobject.h;h=ff29e1f7618328b5fa7689efc95c4ec6a6221b51;hb=7f3a6b11585376eecd80979ec3da2346c5314d88;hp=39dbb9e4137633bf0483e7711ecb6df8fc3d8d81;hpb=e8987f4028a1f9c0eeb33a45bd11b2e409b9c2c5;p=architektonas diff --git a/src/object.h b/src/object.h index 39dbb9e..ff29e1f 100644 --- a/src/object.h +++ b/src/object.h @@ -13,10 +13,12 @@ class Dimension; //class FILE; enum ObjectState { OSInactive, OSSelected }; -enum ObjectType { OTNone, OTObject, OTLine, OTCircle, OTArc, OTDimension, OTEllipse, OTContainer }; +enum ObjectType { OTNone, OTObject, OTLine, OTCircle, OTArc, OTDimension, OTEllipse, OTContainer, OTSpline }; class Object { + friend class Geometry; + public: Object(); Object(Vector, Object * passedInParent = 0); @@ -25,7 +27,7 @@ class Object 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); @@ -36,18 +38,19 @@ class 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 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 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); @@ -59,22 +62,27 @@ class Object 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 connected; // Class variables + public: static QFont * font; + protected: static bool fixedAngle; static bool fixedLength; static int viewportHeight; @@ -88,6 +96,9 @@ class Object static bool selectionInProgress; static QRectF selection; static double gridSpacing; // Grid spacing in base units + static int currentLayer; + static Point snapPoint; + static bool snapPointIsValid; }; #endif // __OBJECT_H__