Fawkes API  Fawkes Development Version
VisualDisplay2DInterface.h
1 
2 /***************************************************************************
3  * VisualDisplay2DInterface.h - Fawkes BlackBoard Interface - VisualDisplay2DInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2009 Tim Niemueller
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __INTERFACES_VISUALDISPLAY2DINTERFACE_H_
25 #define __INTERFACES_VISUALDISPLAY2DINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(VisualDisplay2DInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  /**
42  Enumeration defining the possible line styles.
43  */
44  typedef enum {
45  LS_SOLID /**< Solid line. */,
46  LS_DASHED /**< Dashed line. */,
47  LS_DOTTED /**< Dotted line. */,
48  LS_DASH_DOTTED /**< Dashed and dotted line */
49  } LineStyle;
50  const char * tostring_LineStyle(LineStyle value) const;
51 
52  /**
53  Enumeration defining the possible anchor points. They are used
54  for determining text alignment towards the reference point. The
55  point is at the appropriate position of the bounding box of
56  the text.
57  */
58  typedef enum {
59  CENTERED /**< Vertically and horitontally centered. */,
60  NORTH /**< Top and horiz. centered. */,
61  EAST /**< Right and vert. centered. */,
62  SOUTH /**< Bottom and horiz. centered. */,
63  WEST /**< Left Right . */,
64  NORTH_EAST /**< Top right. */,
65  SOUTH_EAST /**< Bottom right. */,
66  SOUTH_WEST /**< Bottom left. */,
67  NORTH_WEST /**< Top left. */
68  } Anchor;
69  const char * tostring_Anchor(Anchor value) const;
70 
71  private:
72 #pragma pack(push,4)
73  /** Internal data storage, do NOT modify! */
74  typedef struct {
75  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
76  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
77  uint32_t counter; /**< Field */
78  } VisualDisplay2DInterface_data_t;
79 #pragma pack(pop)
80 
81  VisualDisplay2DInterface_data_t *data;
82 
83  public:
84  /* messages */
85  class AddCartLineMessage : public Message
86  {
87  private:
88 #pragma pack(push,4)
89  /** Internal data storage, do NOT modify! */
90  typedef struct {
91  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
92  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
93  float x[2]; /**< X coordinates of two points */
94  float y[2]; /**< Y coordinates of two
95  points */
96  int32_t style; /**< Style of this object. */
97  uint8_t color[4]; /**< Color in RGBA */
98  } AddCartLineMessage_data_t;
99 #pragma pack(pop)
100 
101  AddCartLineMessage_data_t *data;
102 
103  public:
104  AddCartLineMessage(const float * ini_x, const float * ini_y, const LineStyle ini_style, const uint8_t * ini_color);
107 
109  /* Methods */
110  float * x() const;
111  float x(unsigned int index) const;
112  void set_x(unsigned int index, const float new_x);
113  void set_x(const float * new_x);
114  size_t maxlenof_x() const;
115  float * y() const;
116  float y(unsigned int index) const;
117  void set_y(unsigned int index, const float new_y);
118  void set_y(const float * new_y);
119  size_t maxlenof_y() const;
120  LineStyle style() const;
121  void set_style(const LineStyle new_style);
122  size_t maxlenof_style() const;
123  uint8_t * color() const;
124  uint8_t color(unsigned int index) const;
125  void set_color(unsigned int index, const uint8_t new_color);
126  void set_color(const uint8_t * new_color);
127  size_t maxlenof_color() const;
128  virtual Message * clone() const;
129  };
130 
132  {
133  private:
134 #pragma pack(push,4)
135  /** Internal data storage, do NOT modify! */
136  typedef struct {
137  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
138  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
139  float x; /**< X coordinate of center point */
140  float y; /**< Y coordinate of center point */
141  float radius; /**< Radius of the circle. */
142  int32_t style; /**< Style of this object. */
143  uint8_t color[4]; /**< Color in RGBA */
144  } AddCartCircleMessage_data_t;
145 #pragma pack(pop)
146 
147  AddCartCircleMessage_data_t *data;
148 
149  public:
150  AddCartCircleMessage(const float ini_x, const float ini_y, const float ini_radius, const LineStyle ini_style, const uint8_t * ini_color);
153 
155  /* Methods */
156  float x() const;
157  void set_x(const float new_x);
158  size_t maxlenof_x() const;
159  float y() const;
160  void set_y(const float new_y);
161  size_t maxlenof_y() const;
162  float radius() const;
163  void set_radius(const float new_radius);
164  size_t maxlenof_radius() const;
165  LineStyle style() const;
166  void set_style(const LineStyle new_style);
167  size_t maxlenof_style() const;
168  uint8_t * color() const;
169  uint8_t color(unsigned int index) const;
170  void set_color(unsigned int index, const uint8_t new_color);
171  void set_color(const uint8_t * new_color);
172  size_t maxlenof_color() const;
173  virtual Message * clone() const;
174  };
175 
177  {
178  private:
179 #pragma pack(push,4)
180  /** Internal data storage, do NOT modify! */
181  typedef struct {
182  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
183  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
184  float x; /**< X coordinate of lower right corner */
185  float y; /**< Y coordinate of lower right corner */
186  float width; /**< Width of rectangle */
187  float height; /**< Height of rectangle */
188  int32_t style; /**< Style of this object. */
189  uint8_t color[4]; /**< Color in RGBA */
190  } AddCartRectMessage_data_t;
191 #pragma pack(pop)
192 
193  AddCartRectMessage_data_t *data;
194 
195  public:
196  AddCartRectMessage(const float ini_x, const float ini_y, const float ini_width, const float ini_height, const LineStyle ini_style, const uint8_t * ini_color);
199 
201  /* Methods */
202  float x() const;
203  void set_x(const float new_x);
204  size_t maxlenof_x() const;
205  float y() const;
206  void set_y(const float new_y);
207  size_t maxlenof_y() const;
208  float width() const;
209  void set_width(const float new_width);
210  size_t maxlenof_width() const;
211  float height() const;
212  void set_height(const float new_height);
213  size_t maxlenof_height() const;
214  LineStyle style() const;
215  void set_style(const LineStyle new_style);
216  size_t maxlenof_style() const;
217  uint8_t * color() const;
218  uint8_t color(unsigned int index) const;
219  void set_color(unsigned int index, const uint8_t new_color);
220  void set_color(const uint8_t * new_color);
221  size_t maxlenof_color() const;
222  virtual Message * clone() const;
223  };
224 
226  {
227  private:
228 #pragma pack(push,4)
229  /** Internal data storage, do NOT modify! */
230  typedef struct {
231  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
232  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
233  float x; /**< X coordinate of upper left corner */
234  float y; /**< Y coordinate of upper left corner */
235  char text[128]; /**< Width of rectangle */
236  int32_t anchor; /**< Anchor which marks the
237  alignment to the given point. */
238  float size; /**< Font size (max height in m). */
239  uint8_t color[4]; /**< Color in RGBA */
240  } AddCartTextMessage_data_t;
241 #pragma pack(pop)
242 
243  AddCartTextMessage_data_t *data;
244 
245  public:
246  AddCartTextMessage(const float ini_x, const float ini_y, const char * ini_text, const Anchor ini_anchor, const float ini_size, const uint8_t * ini_color);
249 
251  /* Methods */
252  float x() const;
253  void set_x(const float new_x);
254  size_t maxlenof_x() const;
255  float y() const;
256  void set_y(const float new_y);
257  size_t maxlenof_y() const;
258  char * text() const;
259  void set_text(const char * new_text);
260  size_t maxlenof_text() const;
261  Anchor anchor() const;
262  void set_anchor(const Anchor new_anchor);
263  size_t maxlenof_anchor() const;
264  float size() const;
265  void set_size(const float new_size);
266  size_t maxlenof_size() const;
267  uint8_t * color() const;
268  uint8_t color(unsigned int index) const;
269  void set_color(unsigned int index, const uint8_t new_color);
270  void set_color(const uint8_t * new_color);
271  size_t maxlenof_color() const;
272  virtual Message * clone() const;
273  };
274 
276  {
277  private:
278 #pragma pack(push,4)
279  /** Internal data storage, do NOT modify! */
280  typedef struct {
281  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
282  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
283  uint32_t object_id; /**< Object ID, which is
284  the message ID of the Add* message. */
285  } DeleteObjectMessage_data_t;
286 #pragma pack(pop)
287 
288  DeleteObjectMessage_data_t *data;
289 
290  public:
291  DeleteObjectMessage(const uint32_t ini_object_id);
294 
296  /* Methods */
297  uint32_t object_id() const;
298  void set_object_id(const uint32_t new_object_id);
299  size_t maxlenof_object_id() const;
300  virtual Message * clone() const;
301  };
302 
303  class DeleteAllMessage : public Message
304  {
305  private:
306 #pragma pack(push,4)
307  /** Internal data storage, do NOT modify! */
308  typedef struct {
309  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
310  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
311  } DeleteAllMessage_data_t;
312 #pragma pack(pop)
313 
314  DeleteAllMessage_data_t *data;
315 
316  public:
318  ~DeleteAllMessage();
319 
321  /* Methods */
322  virtual Message * clone() const;
323  };
324 
325  virtual bool message_valid(const Message *message) const;
326  private:
329 
330  public:
331  /* Methods */
332  uint32_t counter() const;
333  void set_counter(const uint32_t new_counter);
334  size_t maxlenof_counter() const;
335  virtual Message * create_message(const char *type) const;
336 
337  virtual void copy_values(const Interface *other);
338  virtual const char * enum_tostring(const char *enumtype, int val) const;
339 
340 };
341 
342 } // end namespace fawkes
343 
344 #endif
AddCartRectMessage Fawkes BlackBoard Interface Message.
LineStyle
Enumeration defining the possible line styles.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:43
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_color() const
Get maximum length of color value.
const char * type() const
Get message type.
Definition: message.cpp:378
Fawkes library namespace.
AddCartCircleMessage Fawkes BlackBoard Interface Message.
Anchor
Enumeration defining the possible anchor points.
size_t maxlenof_y() const
Get maximum length of y value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
size_t maxlenof_counter() const
Get maximum length of counter value.
AddCartTextMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_style() const
Get maximum length of style value.
DeleteObjectMessage Fawkes BlackBoard Interface Message.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
AddCartLineMessage Fawkes BlackBoard Interface Message.
void set_x(unsigned int index, const float new_x)
Set x value at given index.
const char * tostring_LineStyle(LineStyle value) const
Convert LineStyle constant to string.
uint32_t counter() const
Get counter value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
Vertically and horitontally centered.
const char * tostring_Anchor(Anchor value) const
Convert Anchor constant to string.
virtual Message * clone() const
Clone this message.
virtual Message * create_message(const char *type) const
Create message based on type name.
DeleteAllMessage Fawkes BlackBoard Interface Message.
VisualDisplay2DInterface Fawkes BlackBoard Interface.
void set_y(unsigned int index, const float new_y)
Set y value at given index.
void set_style(const LineStyle new_style)
Set style value.
void set_counter(const uint32_t new_counter)
Set counter value.