#ifndef ROOM_H_ #define ROOM_H_ #include "Polygon.h" #include "SharedPtr.h" #include "LevelObject.h" #include "VertexProvider.h" #include "EdgeProvider.h" #include class Room : public LevelObject, private VertexProvider, private EdgeProvider { private: Polygon polygon; std::string name; float height; std::vector edges; public: Room() {height = 10;} Room(std::string name) {this->name = name; height = 10;} Room(const Room &room) : name(room.name), height(room.height) { for(Polygon::const_iterator v = room.polygon.begin(); v != room.polygon.end(); v++) addVertex(*v); } const Room& operator=(const Room &room); std::string &getName() {return name;} const std::string &getName() const {return name;} void setName(const std::string &name) {this->name = name;} float getHeight() const {return height;} void setHeight(float height) {this->height = height;} void addVertex(Vertex v); const Polygon& getPolygon() const {return polygon;} virtual bool hit(const Vertex &v) const {return polygon.contains(v);} virtual int getPriority() const {return 0;} virtual std::vector > getChildren(); virtual const char* getType() const { return "Room"; } virtual bool canMove() const {return true;} virtual void move(float x, float y) { Vertex m(x, y); for(Polygon::iterator v = polygon.begin(); v != polygon.end(); v++) *v += m; } virtual bool canRotate() const {return true;} virtual void rotate(Vertex m, float a); virtual const Vertex* getVertex(size_t id) const { return &polygon[id]; } virtual size_t getVertexCount() const { return polygon.size(); } virtual void moveVertex(size_t id, float x, float y) { polygon[id] += Vertex(x, y); } virtual void rotateVertex(size_t id, Vertex m, float a) { rotate(m, a); } virtual const Edge* getEdge(size_t id) const { return &edges[id]; } virtual size_t getEdgeCount() const { return edges.size(); } virtual void moveEdge(size_t id, float x, float y) { moveVertex(id, x, y); moveVertex((id+1)%polygon.size(), x, y); } virtual void rotateEdge(size_t id, Vertex m, float a) { rotate(m, a); } }; #endif /*ROOM_H_*/