Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#ifndef POINTOFINTEREST_H
#define POINTOFINTEREST_H
#include <string>
#include <map>
#include "Workers/Math/Pose.h"
//#include "Architecture/Serializer/ExtendedOutStream.h"
//#include "Architecture/Serializer/ExtendedInStream.h"
using namespace std;
typedef std::map< std::string, std::string > StringMapT;
typedef std::map< std::string, float > FloatMapT;
typedef std::map< std::string, int > IntMapT;
/**
* @class PointOfInterest
*
* @author Robert Hoffmann (RX), David Gossow (RX), Simon Graeser (RX),
* Nicolai Wojke (R14)
*
* @brief This class represents a point of interest (POI)
*
* This class represents a point of interest (POI). It is derived from
* Point2D and thus inherits its methods x(), y(), and theta() to query
* the world position and orientation.
*/
class PointOfInterest: public Pose
{
public:
enum PoiType { DEFAULT =100,
VICTIM =200,
OBJECT =300,
GRIPPABLE_OBJECT =400,
PERSON =600,
ROOMBA =700,
HAZARD_MATERIAL =800,
START_POSITION =900,
START_ORIENTATION =1000
};
PointOfInterest( );
/**
* @brief The constructor
*
* Creates a point of interest with orientation 0.0.
*
* @param id unique identification number
* @param name name of the poi
* @param type type of the poi (victim, etc.)
* @param posX,posY position within the map
* @param remarks additional information associated with the poi
*/
PointOfInterest ( int id, string name, PoiType type, float posX, float posY, string remarks,
StringMapT stringMap=StringMapT(), FloatMapT floatMap=FloatMapT() ,
IntMapT intMap=IntMapT() )
: Pose ( posX, posY, 0.0f )
{
init ( id, name, type , remarks, stringMap, floatMap, intMap );
}
/** @brief The constructor
* @param id unique identification number
* @param name name of the poi
* @param type type of the poi (victim, etc.)
* @param posX,posY position within the map
* @param theta orientation of the poi
* @param remarks additional information associated with the poi
*/
PointOfInterest ( int id, string name, PoiType type, float posX, float posY, float theta, string remarks,
StringMapT stringMap=StringMapT(), FloatMapT floatMap=FloatMapT(), IntMapT intMap=IntMapT() )
: Pose ( posX, posY, theta )
{
init ( id, name, type , remarks, stringMap, floatMap, intMap );
}
/** @brief Alternative constructor omitting the id parameter */
PointOfInterest ( string name, PoiType type, float posX, float posY , string remarks )
: Pose ( posX, posY, 0.0f )
{
init ( -1, name, type , remarks, StringMapT(), FloatMapT(), IntMapT() );
}
/** @brief Alternative constructor omitting the id parameter */
PointOfInterest ( string name, PoiType type, float posX, float posY , float theta, string remarks )
: Pose ( posX, posY, theta )
{
init ( -1, name, type , remarks, StringMapT(), FloatMapT(), IntMapT() );
}
/** @brief Copy constructor, assigns a new id */
PointOfInterest ( int id, const PointOfInterest* poi );
/** @brief The standard destructor */
virtual ~PointOfInterest() {}
/** @brief Tests whether this PointOfInterest has the specified name or not, ignoring case.
* @param name The name to test as a string.
* @return true if the given name matches the PointOfInterest's name (not case-sensitive), false if not.
*/
bool hasName ( string name ) const;
/** @brief Tests whether this PointOfInterest has the specified string in its name or not, ignoring case.
* @param part The string to test.
* @return true if the given string is contained in the PointOfInterest's name (not case-sensitive), false if not.
*/
bool hasInName ( string part ) const;
// SETTER FUNCTIONS /////////////////////////////
/** @param remarks Changes the contents of remarks attribute. */
void setRemarks ( string remarks ) { m_Remarks = remarks; }
void setName ( string name ) { m_Name = name; }
/** @brief Add a new String to the StringMap */
void addString ( string key, string data ) { m_StringMap.insert ( pair< string, string > ( key, data ) ); }
/** @brief Add a new Float to the FloatMap */
void addFloat ( string key, float data ) { m_FloatMap.insert ( pair< string, float > ( key, data ) ); }
/** @brief Add a new Int to the IntMap */
void addInt ( string key, int data ) { m_IntMap.insert ( pair< string, int > ( key, data ) ); }
// GETTER FUNCTIONS //////////////////////
/** @return id attribute */
int getId() const { return m_Id; }
/** @return name attribute */
string getName() const { return m_Name; }
/** @return type attribute */
PoiType getType() const { return m_Type; }
/** @return remarks attribute */
string getRemarks() const { return m_Remarks; }
/** Get the string to the matching string */
string getString ( string key ) const { return m_StringMap.find ( key )->second; }
/** Get the float to the matching string */
float getFloat ( string key ) const { return m_FloatMap.find ( key )->second; }
/** Get the Int to the matching string */
int getInt ( string key ) const { return m_IntMap.find ( key )->second; }
/** Get the string map */
map<string, string> getStringMap() const { return m_StringMap; }
/** Get the float map */
map<string, float> getFloatMap() const { return m_FloatMap; }
/** Get the int map */
map<string, int> getIntMap() const { return m_IntMap; }
// (DE)SERIALIZATION ///////////////////////////////////
//TODO
// void storer ( ExtendedOutStream& ) const ;
// PointOfInterest ( ExtendedInStream& );
/** @brief print description */
void printOn ( ostream& strm ) const;
private:
void init ( int id, string name, PoiType type, string remarks, StringMapT stringMap, FloatMapT floatMap, IntMapT intMap );
int m_Id;
string m_Name;
PoiType m_Type;
string m_Remarks;
StringMapT m_StringMap;
IntMapT m_IntMap;
FloatMapT m_FloatMap;
};
#endif