YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::dev::Nav2D::Map2DArea Class Reference

#include <yarp/dev/Map2DArea.h>

+ Inheritance diagram for yarp::dev::Nav2D::Map2DArea:

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 &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
 
bool getCentroid (yarp::dev::Nav2D::Map2DLocation &cent)
 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< Map2DAreaDataunwrapped
 
- 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
 

Detailed Description

Definition at line 22 of file Map2DArea.h.

Constructor & Destructor Documentation

◆ Map2DArea() [1/3]

Map2DArea::Map2DArea ( const std::string &  map_name,
const std::vector< yarp::math::Vec2D< double > > &  area_points,
const std::string &  desc = "" 
)

Constructor.

Parameters
map_namethe name of the map the location refers to.
area_pointsa 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() [2/3]

Map2DArea::Map2DArea ( const std::string &  map_name,
const std::vector< yarp::dev::Nav2D::Map2DLocation > &  area_points,
const std::string &  desc = "" 
)

Constructor.

Parameters
map_namethe name of the map the location refers to.
area_pointsa 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() [3/3]

Map2DArea::Map2DArea ( )

Default constructor: the map name is empty, coordinates are set to zero.

Definition at line 68 of file Map2DArea.cpp.

Member Function Documentation

◆ checkLocationInsideArea()

bool Map2DArea::checkLocationInsideArea ( yarp::dev::Nav2D::Map2DLocation  loc)

Check if a Map2DLocation is inside a Map2DArea.

Returns
loc the Map2DLocation
true if Map2DLocation is inside the Map2DArea

Definition at line 87 of file Map2DArea.cpp.

◆ clear()

void Map2DArea::clear ( )

Remove all elements from the path.

Definition at line 207 of file Map2DArea.cpp.

◆ findAreaBounds()

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

Returns
true if the two Locations were successfully generated (the Map2DArea must be valid)

Definition at line 151 of file Map2DArea.cpp.

◆ getCentroid()

bool Map2DArea::getCentroid ( yarp::dev::Nav2D::Map2DLocation cent)

retrieves the centroid of the area @cent the centroid

Returns
true if the centroid was successfully generated (the Map2DArea must be valid)

Definition at line 136 of file Map2DArea.cpp.

◆ getRandomLocation()

bool Map2DArea::getRandomLocation ( yarp::dev::Nav2D::Map2DLocation loc)

get a random Map2DLocation inside the Map2DArea @loc the computed Map2DLocation

Returns
true if the Location was successfully generated (the Map2DArea must be valid)

Definition at line 169 of file Map2DArea.cpp.

◆ isValid()

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.

◆ operator!=()

bool Map2DArea::operator!= ( const Map2DArea r) const

Compares two Map2DAreas.

Returns
true if the two areas are different.

Definition at line 101 of file Map2DArea.cpp.

◆ operator==()

bool Map2DArea::operator== ( const Map2DArea r) const

Compares two Map2DArea.

Returns
true if the two areas are identical.

Definition at line 113 of file Map2DArea.cpp.

◆ operator[]()

yarp::math::Vec2D< double > & Map2DArea::operator[] ( size_t  index)

Returns a vertex of the area.

Parameters
indexthe vertex index
Returns
the vertex

Definition at line 214 of file Map2DArea.cpp.

◆ read() [1/2]

bool yarp::dev::Nav2D::Map2DArea::read ( yarp::os::ConnectionReader reader)
inlineoverridevirtual

Read this object from a network connection.

Override this for your particular class.

Parameters
readeran interface to the network connection for reading
Returns
true iff the object is successfully read

Implements yarp::os::Portable.

Definition at line 120 of file Map2DArea.h.

◆ read() [2/2]

bool yarp::dev::Nav2D::Map2DArea::read ( yarp::os::idl::WireReader reader)
inlineoverridevirtual

Serialization methods.

Reimplemented from yarp::os::idl::WirePortable.

Definition at line 112 of file Map2DArea.h.

◆ toString()

std::string Map2DArea::toString ( ) const

Returns text representation of the area.

Returns
a human readable string containing the area infos.

Definition at line 73 of file Map2DArea.cpp.

◆ write() [1/2]

bool yarp::dev::Nav2D::Map2DArea::write ( const yarp::os::idl::WireWriter writer) const
inlineoverridevirtual

Reimplemented from yarp::os::idl::WirePortable.

Definition at line 116 of file Map2DArea.h.

◆ write() [2/2]

bool yarp::dev::Nav2D::Map2DArea::write ( yarp::os::ConnectionWriter writer) const
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

Parameters
writeran interface to the network connection for writing
Returns
true iff the object is successfully written

Implements yarp::os::Portable.

Definition at line 124 of file Map2DArea.h.


The documentation for this class was generated from the following files: