X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fobject.h;h=a0bd4f362714313bd72c5bc28b7c120bfd4f119f;hb=d84f187ca34a6ab2f8c37d85fa13d5c113714344;hp=206ec336d8e1cb99b1dd26f9dad09ea9bd3907a3;hpb=2910db1364914c0ab98a0f80250cc39137821577;p=r2c2.git diff --git a/source/libr2c2/object.h b/source/libr2c2/object.h index 206ec33..a0bd4f3 100644 --- a/source/libr2c2/object.h +++ b/source/libr2c2/object.h @@ -3,6 +3,7 @@ #include "geometry.h" #include "objecttype.h" +#include "snap.h" namespace R2C2 { @@ -10,12 +11,17 @@ class Layout; class Object { +public: + sigc::signal signal_moved; + protected: Layout &layout; Vector position; - float rotation; + Angle rotation; + Angle tilt; + Shape *shape; - Object(Layout &l): layout(l) { } + Object(Layout &); public: virtual ~Object() { } @@ -23,11 +29,32 @@ public: virtual const ObjectType &get_type() const = 0; Layout &get_layout() const { return layout; } virtual void set_position(const Vector &) = 0; - virtual void set_rotation(float) = 0; + virtual void set_rotation(const Angle &) = 0; + virtual void set_tilt(const Angle &) = 0; const Vector &get_position() const { return position; } - float get_rotation() const { return rotation; } + const Angle &get_rotation() const { return rotation; } + const Angle &get_tilt() const { return tilt; } virtual Object *get_parent() const { return 0; } - virtual bool collide_ray(const Vector &, const Vector &) const = 0; + + virtual unsigned get_n_snap_nodes() const { return 0; } + virtual Snap get_snap_node(unsigned) const; + virtual bool snap(Snap &, float, SnapType = SNAP_DEFAULT) const; + virtual bool snap_to(const Object &, float, SnapType = SNAP_DEFAULT); +protected: + virtual SnapType get_default_snap_type_to(const Object &) const { return NO_SNAP; } + +public: + virtual unsigned get_n_link_slots() const { return 0; } + virtual Object *get_link(unsigned) const; + virtual int get_link_slot(const Object &) const { return -1; } + virtual bool link_to(Object &) { return false; } + virtual bool break_link(Object &); + virtual bool break_link(unsigned) { return false; } + virtual void break_links(); + + const Shape *get_shape() const; + virtual bool collide_ray(const Ray &, float * = 0) const; + virtual BoundingBox get_bounding_box() const; }; } // namespace R2C2