23 #ifndef __UTILS_GRAPH_TOPOLOGICAL_MAP_NODE_H_ 24 #define __UTILS_GRAPH_TOPOLOGICAL_MAP_NODE_H_ 26 #include <utils/misc/string_conversions.h> 43 std::map<std::string, std::string>
properties);
49 const std::string &
name()
const 65 {
return unconnected_; }
69 void set_name(
const std::string &name);
76 {
return sqrtf(powf(x_ - n.x_, 2) + powf(y_ - n.y_, 2)); }
83 {
return sqrtf(powf(x_ - x, 2) + powf(y_ - y, 2)); }
88 const std::map<std::string, std::string> &
properties()
const 89 {
return properties_; }
96 {
return properties_.find(property) != properties_.end(); }
102 {
return name_ !=
""; }
104 void set_properties(
const std::map<std::string, std::string> &properties);
106 void set_property(
const std::string &property,
float value);
107 void set_property(
const std::string &property,
int value);
108 void set_property(
const std::string &property,
bool value);
110 std::string
property(
const std::string &prop)
const;
139 {
return name_ == n.name_; }
147 {
return name_ != n.name_; }
153 operator bool()
const 154 {
return name_ !=
""; }
162 {
return reachable_nodes_; }
169 std::map<std::string, std::string> properties_;
170 std::vector<std::string> reachable_nodes_;
float distance(const NavGraphNode &n)
Get euclidean distance from this node to another.
void set_properties(const std::map< std::string, std::string > &properties)
Overwrite properties with given ones.
int property_as_int(const std::string &prop) const
Get property converted to int.
Fawkes library namespace.
void set_unconnected(bool unconnected)
Set unconnected state of the node.
void set_y(float y)
Set Y position.
std::string property(const std::string &prop) const
Get specified property as string.
bool has_property(const std::string &property) const
Check if node has specified property.
bool operator!=(const NavGraphNode &n) const
Check nodes for inequality.
bool is_valid() const
Check if node is valid, i.e.
static int to_int(std::string s)
Convert string to an int value.
const std::map< std::string, std::string > & properties() const
Get all properties.
void set_property(const std::string &property, const std::string &value)
Set property.
const std::string & name() const
Get name of node.
float y() const
Get Y coordinate in global frame.
bool property_as_bool(const std::string &prop) const
Get property converted to bol.
NavGraphNode()
Constructor for invalid node.
void set_x(float x)
Set X position.
void set_name(const std::string &name)
Set name of node.
bool unconnected() const
Check if this node shall be unconnected.
void set_reachable_nodes(std::vector< std::string > reachable_nodes)
Set directly reachable nodes of node.
float x() const
Get X coordinate in global frame.
static float to_float(std::string s)
Convert string to a float value.
float distance(float x, float y)
Get euclidean distance from this node to a point.
float property_as_float(const std::string &prop) const
Get property converted to float.
bool operator==(const NavGraphNode &n) const
Check nodes for equality.
static bool to_bool(std::string s)
Convert string to a bool value.
const std::vector< std::string > & reachable_nodes() const
Get reachable nodes.