Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * VisualDisplay2DInterface.h - Fawkes BlackBoard Interface - VisualDisplay2DInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2009 Tim Niemueller 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __INTERFACES_VISUALDISPLAY2DINTERFACE_H_ 00025 #define __INTERFACES_VISUALDISPLAY2DINTERFACE_H_ 00026 00027 #include <interface/interface.h> 00028 #include <interface/message.h> 00029 #include <interface/field_iterator.h> 00030 00031 namespace fawkes { 00032 00033 class VisualDisplay2DInterface : public Interface 00034 { 00035 /// @cond INTERNALS 00036 INTERFACE_MGMT_FRIENDS(VisualDisplay2DInterface) 00037 /// @endcond 00038 public: 00039 /* constants */ 00040 00041 /** 00042 Enumeration defining the possible line styles. 00043 */ 00044 typedef enum { 00045 LS_SOLID /**< Solid line. */, 00046 LS_DASHED /**< Dashed line. */, 00047 LS_DOTTED /**< Dotted line. */, 00048 LS_DASH_DOTTED /**< Dashed and dotted line */ 00049 } LineStyle; 00050 const char * tostring_LineStyle(LineStyle value) const; 00051 00052 /** 00053 Enumeration defining the possible anchor points. They are used 00054 for determining text alignment towards the reference point. The 00055 point is at the appropriate position of the bounding box of 00056 the text. 00057 */ 00058 typedef enum { 00059 CENTERED /**< Vertically and horitontally centered. */, 00060 NORTH /**< Top and horiz. centered. */, 00061 EAST /**< Right and vert. centered. */, 00062 SOUTH /**< Bottom and horiz. centered. */, 00063 WEST /**< Left Right . */, 00064 NORTH_EAST /**< Top right. */, 00065 SOUTH_EAST /**< Bottom right. */, 00066 SOUTH_WEST /**< Bottom left. */, 00067 NORTH_WEST /**< Top left. */ 00068 } Anchor; 00069 const char * tostring_Anchor(Anchor value) const; 00070 00071 private: 00072 #pragma pack(push,4) 00073 /** Internal data storage, do NOT modify! */ 00074 typedef struct { 00075 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00076 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00077 uint32_t counter; /**< Field */ 00078 } VisualDisplay2DInterface_data_t; 00079 #pragma pack(pop) 00080 00081 VisualDisplay2DInterface_data_t *data; 00082 00083 public: 00084 /* messages */ 00085 class AddCartLineMessage : public Message 00086 { 00087 private: 00088 #pragma pack(push,4) 00089 /** Internal data storage, do NOT modify! */ 00090 typedef struct { 00091 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00092 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00093 float x[2]; /**< X coordinates of two points */ 00094 float y[2]; /**< Y coordinates of two 00095 points */ 00096 LineStyle style; /**< Style of this object. */ 00097 uint8_t color[4]; /**< Color in RGBA */ 00098 } AddCartLineMessage_data_t; 00099 #pragma pack(pop) 00100 00101 AddCartLineMessage_data_t *data; 00102 00103 public: 00104 AddCartLineMessage(const float * ini_x, const float * ini_y, const LineStyle ini_style, const uint8_t * ini_color); 00105 AddCartLineMessage(); 00106 ~AddCartLineMessage(); 00107 00108 AddCartLineMessage(const AddCartLineMessage *m); 00109 /* Methods */ 00110 float * x() const; 00111 float x(unsigned int index) const; 00112 void set_x(unsigned int index, const float new_x); 00113 void set_x(const float * new_x); 00114 size_t maxlenof_x() const; 00115 float * y() const; 00116 float y(unsigned int index) const; 00117 void set_y(unsigned int index, const float new_y); 00118 void set_y(const float * new_y); 00119 size_t maxlenof_y() const; 00120 LineStyle style() const; 00121 void set_style(const LineStyle new_style); 00122 size_t maxlenof_style() const; 00123 uint8_t * color() const; 00124 uint8_t color(unsigned int index) const; 00125 void set_color(unsigned int index, const uint8_t new_color); 00126 void set_color(const uint8_t * new_color); 00127 size_t maxlenof_color() const; 00128 virtual Message * clone() const; 00129 }; 00130 00131 class AddCartCircleMessage : public Message 00132 { 00133 private: 00134 #pragma pack(push,4) 00135 /** Internal data storage, do NOT modify! */ 00136 typedef struct { 00137 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00138 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00139 float x; /**< X coordinate of center point */ 00140 float y; /**< Y coordinate of center point */ 00141 float radius; /**< Radius of the circle. */ 00142 LineStyle style; /**< Style of this object. */ 00143 uint8_t color[4]; /**< Color in RGBA */ 00144 } AddCartCircleMessage_data_t; 00145 #pragma pack(pop) 00146 00147 AddCartCircleMessage_data_t *data; 00148 00149 public: 00150 AddCartCircleMessage(const float ini_x, const float ini_y, const float ini_radius, const LineStyle ini_style, const uint8_t * ini_color); 00151 AddCartCircleMessage(); 00152 ~AddCartCircleMessage(); 00153 00154 AddCartCircleMessage(const AddCartCircleMessage *m); 00155 /* Methods */ 00156 float x() const; 00157 void set_x(const float new_x); 00158 size_t maxlenof_x() const; 00159 float y() const; 00160 void set_y(const float new_y); 00161 size_t maxlenof_y() const; 00162 float radius() const; 00163 void set_radius(const float new_radius); 00164 size_t maxlenof_radius() const; 00165 LineStyle style() const; 00166 void set_style(const LineStyle new_style); 00167 size_t maxlenof_style() const; 00168 uint8_t * color() const; 00169 uint8_t color(unsigned int index) const; 00170 void set_color(unsigned int index, const uint8_t new_color); 00171 void set_color(const uint8_t * new_color); 00172 size_t maxlenof_color() const; 00173 virtual Message * clone() const; 00174 }; 00175 00176 class AddCartRectMessage : public Message 00177 { 00178 private: 00179 #pragma pack(push,4) 00180 /** Internal data storage, do NOT modify! */ 00181 typedef struct { 00182 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00183 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00184 float x; /**< X coordinate of lower right corner */ 00185 float y; /**< Y coordinate of lower right corner */ 00186 float width; /**< Width of rectangle */ 00187 float height; /**< Height of rectangle */ 00188 LineStyle style; /**< Style of this object. */ 00189 uint8_t color[4]; /**< Color in RGBA */ 00190 } AddCartRectMessage_data_t; 00191 #pragma pack(pop) 00192 00193 AddCartRectMessage_data_t *data; 00194 00195 public: 00196 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); 00197 AddCartRectMessage(); 00198 ~AddCartRectMessage(); 00199 00200 AddCartRectMessage(const AddCartRectMessage *m); 00201 /* Methods */ 00202 float x() const; 00203 void set_x(const float new_x); 00204 size_t maxlenof_x() const; 00205 float y() const; 00206 void set_y(const float new_y); 00207 size_t maxlenof_y() const; 00208 float width() const; 00209 void set_width(const float new_width); 00210 size_t maxlenof_width() const; 00211 float height() const; 00212 void set_height(const float new_height); 00213 size_t maxlenof_height() const; 00214 LineStyle style() const; 00215 void set_style(const LineStyle new_style); 00216 size_t maxlenof_style() const; 00217 uint8_t * color() const; 00218 uint8_t color(unsigned int index) const; 00219 void set_color(unsigned int index, const uint8_t new_color); 00220 void set_color(const uint8_t * new_color); 00221 size_t maxlenof_color() const; 00222 virtual Message * clone() const; 00223 }; 00224 00225 class AddCartTextMessage : public Message 00226 { 00227 private: 00228 #pragma pack(push,4) 00229 /** Internal data storage, do NOT modify! */ 00230 typedef struct { 00231 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00232 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00233 float x; /**< X coordinate of upper left corner */ 00234 float y; /**< Y coordinate of upper left corner */ 00235 char text[128]; /**< Width of rectangle */ 00236 Anchor anchor; /**< Anchor which marks the 00237 alignment to the given point. */ 00238 float size; /**< Font size (max height in m). */ 00239 uint8_t color[4]; /**< Color in RGBA */ 00240 } AddCartTextMessage_data_t; 00241 #pragma pack(pop) 00242 00243 AddCartTextMessage_data_t *data; 00244 00245 public: 00246 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); 00247 AddCartTextMessage(); 00248 ~AddCartTextMessage(); 00249 00250 AddCartTextMessage(const AddCartTextMessage *m); 00251 /* Methods */ 00252 float x() const; 00253 void set_x(const float new_x); 00254 size_t maxlenof_x() const; 00255 float y() const; 00256 void set_y(const float new_y); 00257 size_t maxlenof_y() const; 00258 char * text() const; 00259 void set_text(const char * new_text); 00260 size_t maxlenof_text() const; 00261 Anchor anchor() const; 00262 void set_anchor(const Anchor new_anchor); 00263 size_t maxlenof_anchor() const; 00264 float size() const; 00265 void set_size(const float new_size); 00266 size_t maxlenof_size() const; 00267 uint8_t * color() const; 00268 uint8_t color(unsigned int index) const; 00269 void set_color(unsigned int index, const uint8_t new_color); 00270 void set_color(const uint8_t * new_color); 00271 size_t maxlenof_color() const; 00272 virtual Message * clone() const; 00273 }; 00274 00275 class DeleteObjectMessage : public Message 00276 { 00277 private: 00278 #pragma pack(push,4) 00279 /** Internal data storage, do NOT modify! */ 00280 typedef struct { 00281 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00282 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00283 uint32_t object_id; /**< Object ID, which is 00284 the message ID of the Add* message. */ 00285 } DeleteObjectMessage_data_t; 00286 #pragma pack(pop) 00287 00288 DeleteObjectMessage_data_t *data; 00289 00290 public: 00291 DeleteObjectMessage(const uint32_t ini_object_id); 00292 DeleteObjectMessage(); 00293 ~DeleteObjectMessage(); 00294 00295 DeleteObjectMessage(const DeleteObjectMessage *m); 00296 /* Methods */ 00297 uint32_t object_id() const; 00298 void set_object_id(const uint32_t new_object_id); 00299 size_t maxlenof_object_id() const; 00300 virtual Message * clone() const; 00301 }; 00302 00303 class DeleteAllMessage : public Message 00304 { 00305 private: 00306 #pragma pack(push,4) 00307 /** Internal data storage, do NOT modify! */ 00308 typedef struct { 00309 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00310 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00311 } DeleteAllMessage_data_t; 00312 #pragma pack(pop) 00313 00314 DeleteAllMessage_data_t *data; 00315 00316 public: 00317 DeleteAllMessage(); 00318 ~DeleteAllMessage(); 00319 00320 DeleteAllMessage(const DeleteAllMessage *m); 00321 /* Methods */ 00322 virtual Message * clone() const; 00323 }; 00324 00325 virtual bool message_valid(const Message *message) const; 00326 private: 00327 VisualDisplay2DInterface(); 00328 ~VisualDisplay2DInterface(); 00329 00330 public: 00331 /* Methods */ 00332 uint32_t counter() const; 00333 void set_counter(const uint32_t new_counter); 00334 size_t maxlenof_counter() const; 00335 virtual Message * create_message(const char *type) const; 00336 00337 virtual void copy_values(const Interface *other); 00338 virtual const char * enum_tostring(const char *enumtype, int val) const; 00339 00340 }; 00341 00342 } // end namespace fawkes 00343 00344 #endif