#include <yarp/dev/Map2DArea.h>
Public Member Functions | |
Map2DArea (const std::string &map_name, const std::vector< yarp::math::Vec2D< double > > &area_points, const std::string &desc="") | |
Constructor. | |
Map2DArea (const std::string &map_name, const std::vector< yarp::dev::Nav2D::Map2DLocation > &area_points, const std::string &desc="") | |
Constructor. | |
Map2DArea () | |
Default constructor: the map name is empty, coordinates are set to zero. | |
std::string | toString () const |
Returns text representation of the area. | |
bool | operator!= (const Map2DArea &r) const |
Compares two Map2DAreas. | |
bool | operator== (const Map2DArea &r) const |
Compares two Map2DArea. | |
bool | isValid () const |
Checks if the Map2DArea is valid return true if the Map2DArea is valid. | |
bool | checkLocationInsideArea (yarp::dev::Nav2D::Map2DLocation loc) |
Check if a Map2DLocation is inside a Map2DArea. | |
bool | findAreaBounds (yarp::dev::Nav2D::Map2DLocation <, yarp::dev::Nav2D::Map2DLocation &rb) |
retrieves two Map2DLocations representing the bounding box of the Map2DArea @lt the left-top vertex @rb the right-bottom vertex | |
bool | getCentroid (yarp::dev::Nav2D::Map2DLocation ¢) |
retrieves the centroid of the area @cent the centroid | |
bool | getRandomLocation (yarp::dev::Nav2D::Map2DLocation &loc) |
get a random Map2DLocation inside the Map2DArea @loc the computed Map2DLocation | |
yarp::math::Vec2D< double > & | operator[] (size_t index) |
Returns a vertex of the area. | |
void | clear () |
Remove all elements from the path. | |
bool | read (yarp::os::idl::WireReader &reader) override |
Serialization methods. | |
bool | write (const yarp::os::idl::WireWriter &writer) const override |
bool | read (yarp::os::ConnectionReader &reader) override |
Read this object from a network connection. | |
bool | write (yarp::os::ConnectionWriter &writer) const override |
Write this object to a network connection. | |
Public Member Functions inherited from yarp::dev::Map2DAreaData | |
Map2DAreaData ()=default | |
Map2DAreaData (const std::string &map_id, const std::vector< yarp::math::Vec2D< double > > &points, const std::string &description) | |
bool | read (yarp::os::idl::WireReader &reader) override |
bool | read (yarp::os::ConnectionReader &connection) override |
Read this object from a network connection. | |
bool | write (const yarp::os::idl::WireWriter &writer) const override |
bool | write (yarp::os::ConnectionWriter &connection) const override |
Write this object to a network connection. | |
std::string | toString () const |
Public Member Functions inherited from yarp::os::idl::WirePortable | |
virtual bool | readBare (yarp::os::ConnectionReader &reader) |
virtual bool | writeBare (yarp::os::ConnectionWriter &writer) const |
virtual bool | readBottle (yarp::os::ConnectionReader &reader) |
virtual bool | writeBottle (yarp::os::ConnectionWriter &writer) const |
Public Member Functions inherited from yarp::os::Portable | |
virtual Type | getType () const |
Public Member Functions inherited from yarp::os::PortReader | |
virtual | ~PortReader () |
Destructor. | |
virtual Type | getReadType () const |
Public Member Functions inherited from yarp::os::PortWriter | |
virtual | ~PortWriter () |
Destructor. | |
virtual void | onCompletion () const |
This is called when the port has finished all writing operations. | |
virtual void | onCommencement () const |
This is called when the port is about to begin writing operations. | |
virtual yarp::os::Type | getWriteType () const |
Additional Inherited Members | |
Public Types inherited from yarp::dev::Map2DAreaData | |
typedef yarp::os::idl::Unwrapped< Map2DAreaData > | unwrapped |
Static Public Member Functions inherited from yarp::os::Portable | |
static bool | copyPortable (const PortWriter &writer, PortReader &reader) |
Copy one portable to another, via writing and reading. | |
Public Attributes inherited from yarp::dev::Map2DAreaData | |
std::string | map_id {} |
name of the map | |
std::vector< yarp::math::Vec2D< double > > | points {} |
list of points which define the vertices of the area | |
std::string | description {} |
user defined string | |
Definition at line 22 of file Map2DArea.h.
Map2DArea::Map2DArea | ( | const std::string & | map_name, |
const std::vector< yarp::math::Vec2D< double > > & | area_points, | ||
const std::string & | desc = "" |
||
) |
Constructor.
map_name | the name of the map the location refers to. |
area_points | a set of vertexes defining the area. At least three points are required to define a valid area. |
Definition at line 40 of file Map2DArea.cpp.
Map2DArea::Map2DArea | ( | const std::string & | map_name, |
const std::vector< yarp::dev::Nav2D::Map2DLocation > & | area_points, | ||
const std::string & | desc = "" |
||
) |
Constructor.
map_name | the name of the map the location refers to. |
area_points | a set of Map2DLocations defining the area. At least three points are required to define a valid area. |
Definition at line 47 of file Map2DArea.cpp.
Map2DArea::Map2DArea | ( | ) |
Default constructor: the map name is empty, coordinates are set to zero.
Definition at line 68 of file Map2DArea.cpp.
bool Map2DArea::checkLocationInsideArea | ( | yarp::dev::Nav2D::Map2DLocation | loc | ) |
Check if a Map2DLocation is inside a Map2DArea.
Definition at line 87 of file Map2DArea.cpp.
void Map2DArea::clear | ( | ) |
Remove all elements from the path.
Definition at line 207 of file Map2DArea.cpp.
bool Map2DArea::findAreaBounds | ( | yarp::dev::Nav2D::Map2DLocation & | lt, |
yarp::dev::Nav2D::Map2DLocation & | rb | ||
) |
retrieves two Map2DLocations representing the bounding box of the Map2DArea @lt the left-top vertex @rb the right-bottom vertex
Definition at line 151 of file Map2DArea.cpp.
bool Map2DArea::getCentroid | ( | yarp::dev::Nav2D::Map2DLocation & | cent | ) |
retrieves the centroid of the area @cent the centroid
Definition at line 136 of file Map2DArea.cpp.
bool Map2DArea::getRandomLocation | ( | yarp::dev::Nav2D::Map2DLocation & | loc | ) |
get a random Map2DLocation inside the Map2DArea @loc the computed Map2DLocation
Definition at line 169 of file Map2DArea.cpp.
bool Map2DArea::isValid | ( | ) | const |
Checks if the Map2DArea is valid return true if the Map2DArea is valid.
Definition at line 125 of file Map2DArea.cpp.
Compares two Map2DAreas.
Definition at line 101 of file Map2DArea.cpp.
Compares two Map2DArea.
Definition at line 113 of file Map2DArea.cpp.
yarp::math::Vec2D< double > & Map2DArea::operator[] | ( | size_t | index | ) |
Returns a vertex of the area.
index | the vertex index |
Definition at line 214 of file Map2DArea.cpp.
|
inlineoverridevirtual |
Read this object from a network connection.
Override this for your particular class.
reader | an interface to the network connection for reading |
Implements yarp::os::Portable.
Definition at line 120 of file Map2DArea.h.
|
inlineoverridevirtual |
Serialization methods.
Reimplemented from yarp::os::idl::WirePortable.
Definition at line 112 of file Map2DArea.h.
std::string Map2DArea::toString | ( | ) | const |
Returns text representation of the area.
Definition at line 73 of file Map2DArea.cpp.
|
inlineoverridevirtual |
Reimplemented from yarp::os::idl::WirePortable.
Definition at line 116 of file Map2DArea.h.
|
inlineoverridevirtual |
Write this object to a network connection.
Override this for your particular class. Be aware that depending on the nature of the connections a port has, and what protocol they use, and how efficient the YARP implementation is, this method may be called once, twice, or many times, as the result of a single call to Port::write
writer | an interface to the network connection for writing |
Implements yarp::os::Portable.
Definition at line 124 of file Map2DArea.h.