41 m_defaultAction(NULL),
48 std::map<std::string, Action*>::const_iterator i(
m_actions->begin());
69 m_restrictedRotation(false) {
93 std::map<std::string, Action*>* actions;
103 std::map<std::string, Action*>::const_iterator it = actions->begin();
104 for(; it != actions->end(); ++it) {
105 if(identifier == it->second->getId()) {
106 throw NameClash(identifier);
112 a =
new Action(identifier);
113 (*actions)[identifier] = a;
122 std::map<std::string, Action*>* actions = NULL;
127 std::map<std::string, Action*>::const_iterator i;
129 i = actions->find(identifier);
131 if ((!actions) || (i == actions->end())) {
141 std::map<std::string, Action*>* actions = NULL;
145 std::list<std::string> action_ids;
147 std::map<std::string, Action*>::const_iterator actions_it = actions->begin();
148 for(; actions_it != actions->end(); ++actions_it) {
149 action_ids.push_back(actions_it->first);
156 std::map<std::string, Action*>::const_iterator i;
158 std::map<std::string, Action*>* actions = NULL;
163 i = actions->find(identifier);
165 if ((!actions) || (i == actions->end())) {
370 return std::list<std::string>();
424 return std::set<Object*>();
457 return std::multimap<int32_t, ModelCoordinate>();
461 std::vector<ModelCoordinate> coordinates;
466 std::pair<std::multimap<int32_t, ModelCoordinate>::iterator,
468 std::multimap<int32_t, ModelCoordinate>::iterator it = result.first;
469 for (; it != result.second; ++it) {
470 coordinates.push_back((*it).second);
479 std::vector<ModelCoordinate> coordinates;
484 const std::multimap<int32_t, ModelCoordinate>& subcoords = (*subit)->getMultiPartCoordinates();
494 std::pair<std::multimap<int32_t, ModelCoordinate>::iterator,
496 std::multimap<int32_t, ModelCoordinate>::iterator it = result.first;
498 coordinates.push_back(parent);
499 for (; it != result.second; ++it) {
500 coordinates.push_back((*it).second);
543 int32_t closest = rotation;
613 return std::list<std::string>();
double m_speed
speed modifier, default 1.0
MultiObjectProperty()
Constructor.
std::list< std::string > getWalkableAreas() const
Returns a list that contains all walkable area ids.
bool operator==(const Object &obj) const
Compares equality of two objects.
const std::string & getFilename() const
Action * getAction(const std::string &identifier, bool deepsearch=true) const
Gets action with given id.
void setDefaultAction(const std::string &identifier)
Sets default action assigned to this object.
std::string getCostId() const
Returns the cost id.
MovableObjectProperty()
Constructor.
void removeMultiPart(Object *obj)
Removes a multi part object.
IPather * getPather() const
Gets associated pather.
void removeWalkableArea(const std::string &id)
Removes an area id from walkable areas.
std::vector< ModelCoordinate > getMultiObjectCoordinates(int32_t rotation) const
Returns all multi object coordinates for the given rotation.
double getSpeed() const
Returns the speed modifier.
void setArea(const std::string &id)
Sets the area id that the instances of this object adds to their cells.
void adoptVisual(IVisual *visual)
Sets visualization to be used.
void setRotationAnchor(const ExactModelCoordinate &anchor)
Sets the rotation anchor for this multi object.
Action * m_defaultAction
pointer to default action
IPather * m_pather
pointer to pathfinder
void setCellStackPosition(uint8_t position)
Sets the cell stack position.
int32_t m_zRange
z range value
uint8_t m_cellStack
position on cellstack
~BasicObjectProperty()
Destructor.
void setZStepRange(int32_t zRange)
Sets z-step range for object.
Object(const std::string &identifier, const std::string &name_space, Object *inherited=NULL)
Constructor An object may optionally inherit default attributes from another object.
void setFilename(const std::string &file)
std::list< std::string > m_multiPartIds
list with part identifiers
std::string m_namespace
namespace
type_angle2id m_multiAngleMap
multi object angles
std::string m_area
area id
const std::string & getId() const
bool m_blocking
indicates if object blocks
std::string getArea() const
Gets the area id that the instances of this object adds to their cells.
double getCost() const
Returns the cost.
std::string m_costId
cost identifier
void removeAllMultiPartIds()
Removes all multi part identifiers.
void removeMultiPartId(const std::string &partId)
Removes a multi part identifier.
uint8_t getCellStackPosition() const
Returns cell stack position.
MovableObjectProperty * m_moveProperty
bool isStatic() const
Gets if object moves.
void setMultiPart(bool part)
Sets the object as a part of a multi object.
std::string m_id
identifier
bool operator!=(const Object &obj) const
Compares unequality of two objects.
static bool Equal(T _val1, T _val2)
std::set< Object * > m_multiParts
set contains part objects
const std::string & getNamespace() const
void setRestrictedRotation(bool restrict)
Sets the rotation to restricted.
void addMultiPartCoordinate(int32_t rotation, ModelCoordinate coord)
Adds rotationally dependent coordinates for this object part.
std::multimap< int32_t, ModelCoordinate > m_multiObjectCoordinates
multi object coordinates
BasicObjectProperty * m_basicProperty
std::list< std::string > getActionIds() const
Gets all available action ids of the object and packs them into a list.
bool isRestrictedRotation() const
Gets if object uses restricted rotations.
bool isBlocking() const
Gets if object blocks movement.
bool isMultiObject() const
Gets if object uses special cost.
type_angle2id m_partAngleMap
part object angles
Object * m_inherited
pointer to inherited object
void setCost(double cost)
Sets the cost.
ExactModelCoordinate getRotationAnchor() const
Returns the rotation anchor for this multi object.
void removeMultiParts()
Removes all multi part objects.
Object * getInherited() const
Gets an object where this object was inherited from.
Action * createAction(const std::string &identifier, bool is_default=false)
Adds new action with given id.
MultiObjectProperty * m_multiProperty
std::multimap< int32_t, ModelCoordinate > getMultiPartCoordinates() const
Returns all rotationally dependent coordinates from this object part.
std::string m_filename
filename
void addMultiPart(Object *obj)
Adds a object as a part of a multi object.
std::list< std::string > m_walkableAreas
list contains walkable area ids
double m_cost
cost value, default 1.0
DoublePoint3D ExactModelCoordinate
void addMultiPartId(const std::string &partId)
Adds a multi part identifier.
std::multimap< int32_t, ModelCoordinate > m_multiPartCoordinates
part object coordinates
void setStatic(bool stat)
Set to true, if object is such that it doesn't move.
std::list< std::string > getMultiPartIds() const
Returns all multi part identifiers.
Action * getDefaultAction() const
Gets default action assigned to this object.
int32_t getZStepRange() const
Returns z-step range from object.
std::map< std::string, Action * > * m_actions
holds action ids and assigned actions
int32_t getIndexByAngle(int32_t angle, const type_angle2id &angle2id, int32_t &closestMatchingAngle)
Returns id for given angle from angle2id map in case there are no elements in the map...
bool m_multiPart
indicates if object is part of multi object
void addWalkableArea(const std::string &id)
Adds an area id to walkable area.
std::set< Object * > getMultiParts() const
Returns all multi part objects.
void setPather(IPather *pather)
Sets pather used by instances created out of this object.
bool m_restrictedRotation
indicates if object uses only restricted rotations
bool m_static
indicates if object is static
void setBlocking(bool blocking)
Sets if object blocks movement.
bool isSpecialSpeed() const
Gets if object uses special speed modifier.
BasicObjectProperty()
Constructor.
void setSpeed(double cost)
Sets the speed modifier.
~MovableObjectProperty()
Destructor.
bool isSpecialCost() const
Gets if object uses special cost.
int32_t getRestrictedRotation(int32_t rotation)
Returns the most obvious rotation, based on multi coordinates.
ExactModelCoordinate m_rotationAnchor
rotation anchor
void setCostId(const std::string &cost)
Sets the cost id.
bool isMultiPart() const
Gets if object is a part of a multi object.
~MultiObjectProperty()
Destructor.
IVisual * m_visual
pointer to object visual