YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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>
15#include <sstream>
16#include <string>
17#include <vector>
18
22namespace yarp::dev::Nav2D {
24{
25public:
31 Map2DArea(const std::string& map_name, const std::vector<yarp::math::Vec2D<double>>& area_points, const std::string& desc = "");
32
38 Map2DArea(const std::string& map_name, const std::vector<yarp::dev::Nav2D::Map2DLocation>& area_points, const std::string& desc = "");
39
43 Map2DArea();
44
49 std::string toString() const;
50
55 bool operator!=(const Map2DArea& r) const;
56
61 bool operator==(const Map2DArea& r) const;
62
67 bool isValid() const;
68
74 bool checkLocationInsideArea(yarp::dev::Nav2D::Map2DLocation loc);
75
81 bool checkObjectInsideArea(yarp::dev::Nav2D::Map2DObject obj);
82
90
96 bool getCentroid(yarp::dev::Nav2D::Map2DLocation& cent);
97
103 bool getRandomLocation(yarp::dev::Nav2D::Map2DLocation& loc);
104
110 yarp::math::Vec2D<double>& operator[](size_t index);
111
115 void clear();
116
120 bool read(yarp::os::idl::WireReader& reader) override
121 {
122 return Map2DAreaData::read(reader);
123 }
124 bool write(const yarp::os::idl::WireWriter& writer) const override
125 {
126 return Map2DAreaData::write(writer);
127 }
128 bool read(yarp::os::ConnectionReader& reader) override
129 {
130 return Map2DAreaData::read(reader);
131 }
132 bool write(yarp::os::ConnectionWriter& writer) const override
133 {
134 return Map2DAreaData::write(writer);
135 }
136};
137} // namespace yarp::dev::Nav2D
138
139#endif // YARP_DEV_MAP2DAREA_H
bool operator==(const struct v4l2_control &left, const struct v4l2_control &right)
Definition CApiMock.h:65
std::string toString(const T &value)
convert an arbitrary type to string.
contains the definition of a Map2DLocation type
contains the definition of a Map2DObject type
bool read(yarp::os::ConnectionReader &reader) override
Read this object from a network connection.
Definition Map2DArea.h:128
bool read(yarp::os::idl::WireReader &reader) override
Serialization methods.
Definition Map2DArea.h:120
bool write(const yarp::os::idl::WireWriter &writer) const override
Definition Map2DArea.h:124
bool write(yarp::os::ConnectionWriter &writer) const override
Write this object to a network connection.
Definition Map2DArea.h:132
An interface for reading from a network connection.
An interface for writing to a network connection.
IDL-friendly connection reader.
Definition WireReader.h:27
IDL-friendly connection writer.
Definition WireWriter.h:28
typename vec2D_selector< T >::type Vec2D
Definition Vec2D.h:104
#define YARP_dev_API
Definition api.h:18