YARP
Yet Another Robot Platform
Map2DArea.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_DEV_MAP2DAREA_H
7 #define YARP_DEV_MAP2DAREA_H
8 
9 #include <yarp/os/Portable.h>
10 #include <yarp/math/Vec2D.h>
11 #include <yarp/dev/api.h>
12 #include <yarp/dev/Map2DLocation.h>
13 #include <sstream>
14 #include <string>
15 #include <vector>
16 
20 namespace yarp
21 {
22  namespace dev
23  {
24  namespace Nav2D
25  {
27  {
28  private:
29  yarp::dev::Nav2D::Map2DLocation helper_tmp_location;
30 
31  public:
37  Map2DArea(const std::string& map_name, const std::vector<yarp::math::Vec2D<double>> area_points);
38 
44  Map2DArea(const std::string& map_name, const std::vector<yarp::dev::Nav2D::Map2DLocation> area_points);
45 
49  Map2DArea();
50 
55  std::string toString() const;
56 
61  bool operator!=(const Map2DArea& r) const;
62 
67  bool operator==(const Map2DArea& r) const;
68 
73  bool isValid() const;
74 
80  bool checkLocationInsideArea(yarp::dev::Nav2D::Map2DLocation loc);
81 
89 
95  bool getRandomLocation(yarp::dev::Nav2D::Map2DLocation& loc);
96 
102  yarp::math::Vec2D<double>& operator[](size_t index);
103 
107  void clear();
108 
109  public:
110  std::string map_id;
111  std::vector<yarp::math::Vec2D<double>> points;
112 
113  public:
114  /*
115  * Read a map2DArea from a connection.
116  * return true iff a map2DArea was read correctly
117  */
118  bool read(yarp::os::ConnectionReader& connection) override;
119 
124  bool write(yarp::os::ConnectionWriter& connection) const override;
125  };
126  }
127  }
128 }
129 
130 #endif // YARP_DEV_MAP2DAREA_H
contains the definition of a Map2DLocation type
std::vector< yarp::math::Vec2D< double > > points
Definition: Map2DArea.h:111
An interface for reading from a network connection.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:26
std::string toString(const T &value)
convert an arbitrary type to string.
bool isValid()
Check if time is valid (non-zero).
Definition: Time.cpp:314
bool read(ImageOf< PixelRgb > &dest, const std::string &src, image_fileformat format=FORMAT_ANY)
Definition: ImageFile.cpp:923
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
Definition: ImageFile.cpp:1099
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18