YARP
Yet Another Robot Platform
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)
 Constructor. More...
 
 Map2DArea (const std::string &map_name, const std::vector< yarp::dev::Nav2D::Map2DLocation > area_points)
 Constructor. More...
 
 Map2DArea ()
 Default constructor: the map name is empty, coordinates are set to zero. More...
 
std::string toString () const
 Returns text representation of the area. More...
 
bool operator!= (const Map2DArea &r) const
 Compares two Map2DAreas. More...
 
bool operator== (const Map2DArea &r) const
 Compares two Map2DArea. More...
 
bool isValid () const
 Checks if the Map2DArea is valid return true if the Map2DArea is valid. More...
 
bool checkLocationInsideArea (yarp::dev::Nav2D::Map2DLocation loc)
 Check if a Map2DLocation is inside a Map2DArea. More...
 
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 More...
 
bool getRandomLocation (yarp::dev::Nav2D::Map2DLocation &loc)
 get a random Map2DLocation inside the Map2DArea @loc the computed Map2DLocation More...
 
yarp::math::Vec2D< double > & operator[] (size_t index)
 Returns a vertex of the area. More...
 
void clear ()
 Remove all elements from the path. More...
 
bool read (yarp::os::ConnectionReader &connection) override
 Read this object from a network connection. More...
 
bool write (yarp::os::ConnectionWriter &connection) const override
 Write a map2DArea to a connection. More...
 
- Public Member Functions inherited from yarp::os::Portable
virtual Type getType () const
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual Type getReadType () const
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor. More...
 
virtual void onCompletion () const
 This is called when the port has finished all writing operations. More...
 
virtual void onCommencement () const
 This is called when the port is about to begin writing operations. More...
 
virtual yarp::os::Type getWriteType () const
 

Public Attributes

std::string map_id
 
std::vector< yarp::math::Vec2D< double > > points
 

Additional Inherited Members

- 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. More...
 

Detailed Description

Definition at line 29 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 
)

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 44 of file Map2DArea.cpp.

◆ Map2DArea() [2/3]

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

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 50 of file Map2DArea.cpp.

◆ Map2DArea() [3/3]

Map2DArea::Map2DArea ( )

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

Definition at line 70 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 150 of file Map2DArea.cpp.

◆ clear()

void Map2DArea::clear ( )

Remove all elements from the path.

Definition at line 240 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 189 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 205 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 182 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 158 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 170 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 246 of file Map2DArea.cpp.

◆ read()

bool Map2DArea::read ( yarp::os::ConnectionReader reader)
overridevirtual

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 75 of file Map2DArea.cpp.

◆ toString()

std::string Map2DArea::toString ( ) const

Returns text representation of the area.

Returns
a human readable string containing the area infos.

Definition at line 137 of file Map2DArea.cpp.

◆ write()

bool Map2DArea::write ( yarp::os::ConnectionWriter connection) const
overridevirtual

Write a map2DArea to a connection.

return true iff a map2DArea was written correctly

Implements yarp::os::Portable.

Definition at line 112 of file Map2DArea.cpp.

Member Data Documentation

◆ map_id

std::string yarp::dev::Nav2D::Map2DArea::map_id

Definition at line 113 of file Map2DArea.h.

◆ points

std::vector<yarp::math::Vec2D<double> > yarp::dev::Nav2D::Map2DArea::points

Definition at line 114 of file Map2DArea.h.


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