1 #ifndef LIBR2C2_OBJECT_H_
2 #define LIBR2C2_OBJECT_H_
5 #include "objecttype.h"
19 Object(Layout &l): layout(l) { }
23 virtual Object *clone(Layout * = 0) const = 0;
24 virtual const ObjectType &get_type() const = 0;
25 Layout &get_layout() const { return layout; }
26 virtual void set_position(const Vector &) = 0;
27 virtual void set_rotation(const Angle &) = 0;
28 const Vector &get_position() const { return position; }
29 const Angle &get_rotation() const { return rotation; }
30 virtual Object *get_parent() const { return 0; }
32 virtual unsigned get_n_snap_nodes() const { return 0; }
33 virtual Snap get_snap_node(unsigned) const;
34 virtual bool snap(Snap &, float, SnapType = SNAP_DEFAULT) const;
35 virtual bool snap_to(const Object &, float, SnapType = SNAP_DEFAULT);
37 virtual SnapType get_default_snap_type_to(const Object &) const { return NO_SNAP; }
40 virtual unsigned get_n_link_slots() const { return 0; }
41 virtual Object *get_link(unsigned) const;
42 virtual int get_link_slot(const Object &) const { return -1; }
43 virtual bool link_to(Object &) { return false; }
44 virtual bool break_link(Object &);
45 virtual bool break_link(unsigned) { return false; }
46 virtual void break_links();
48 virtual bool collide_ray(const Ray &) const;
49 virtual BoundingBox get_bounding_box() const;