24 #include <interfaces/VisualDisplay2DInterface.h>
26 #include <core/exceptions/software.h>
59 VisualDisplay2DInterface::VisualDisplay2DInterface() : Interface()
61 data_size =
sizeof(VisualDisplay2DInterface_data_t);
63 data = (VisualDisplay2DInterface_data_t *)
data_ptr;
66 enum_map_LineStyle[(int)LS_SOLID] =
"LS_SOLID";
67 enum_map_LineStyle[(int)LS_DASHED] =
"LS_DASHED";
68 enum_map_LineStyle[(int)LS_DOTTED] =
"LS_DOTTED";
69 enum_map_LineStyle[(int)LS_DASH_DOTTED] =
"LS_DASH_DOTTED";
70 enum_map_Anchor[(int)CENTERED] =
"CENTERED";
71 enum_map_Anchor[(int)NORTH] =
"NORTH";
72 enum_map_Anchor[(int)EAST] =
"EAST";
73 enum_map_Anchor[(int)SOUTH] =
"SOUTH";
74 enum_map_Anchor[(int)WEST] =
"WEST";
75 enum_map_Anchor[(int)NORTH_EAST] =
"NORTH_EAST";
76 enum_map_Anchor[(int)SOUTH_EAST] =
"SOUTH_EAST";
77 enum_map_Anchor[(int)SOUTH_WEST] =
"SOUTH_WEST";
78 enum_map_Anchor[(int)NORTH_WEST] =
"NORTH_WEST";
86 unsigned char tmp_hash[] = {0xd9, 0x2, 0xad, 0xbb, 0x7a, 0x47, 0x40, 0x6a, 0x4f, 0x6d, 0xfa, 0xa, 0x20, 0x35, 0xe6, 0x1};
91 VisualDisplay2DInterface::~VisualDisplay2DInterface()
107 default:
return "UNKNOWN";
120 case EAST:
return "EAST";
121 case SOUTH:
return "SOUTH";
122 case WEST:
return "WEST";
127 default:
return "UNKNOWN";
138 return data->counter;
158 data->counter = new_counter;
166 if ( strncmp(
"AddCartLineMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
167 return new AddCartLineMessage();
168 }
else if ( strncmp(
"AddCartCircleMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
169 return new AddCartCircleMessage();
170 }
else if ( strncmp(
"AddCartRectMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
171 return new AddCartRectMessage();
172 }
else if ( strncmp(
"AddCartTextMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
173 return new AddCartTextMessage();
174 }
else if ( strncmp(
"DeleteObjectMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
175 return new DeleteObjectMessage();
176 }
else if ( strncmp(
"DeleteAllMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
177 return new DeleteAllMessage();
179 throw UnknownTypeException(
"The given type '%s' does not match any known "
180 "message type for this interface type.",
type);
191 const VisualDisplay2DInterface *oi = dynamic_cast<const VisualDisplay2DInterface *>(other);
194 type(), other->type());
196 memcpy(data, oi->data,
sizeof(VisualDisplay2DInterface_data_t));
202 if (strcmp(enumtype,
"LineStyle") == 0) {
205 if (strcmp(enumtype,
"Anchor") == 0) {
208 throw UnknownTypeException(
"Unknown enum type %s", enumtype);
227 data_size =
sizeof(AddCartLineMessage_data_t);
230 data = (AddCartLineMessage_data_t *)
data_ptr;
232 memcpy(data->x, ini_x,
sizeof(
float) * 2);
233 memcpy(data->y, ini_y,
sizeof(
float) * 2);
234 data->style = ini_style;
235 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
236 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
237 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
238 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
240 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
241 enum_map_Anchor[(int)
NORTH] =
"NORTH";
242 enum_map_Anchor[(int)
EAST] =
"EAST";
243 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
244 enum_map_Anchor[(int)
WEST] =
"WEST";
245 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
246 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
247 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
248 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
257 data_size =
sizeof(AddCartLineMessage_data_t);
260 data = (AddCartLineMessage_data_t *)
data_ptr;
262 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
263 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
264 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
266 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
267 enum_map_Anchor[(int)
NORTH] =
"NORTH";
268 enum_map_Anchor[(int)
EAST] =
"EAST";
269 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
270 enum_map_Anchor[(int)
WEST] =
"WEST";
271 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
272 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
273 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
274 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
295 data = (AddCartLineMessage_data_t *)
data_ptr;
320 throw Exception(
"Index value %u out of bounds (0..1)", index);
322 return data->x[index];
342 memcpy(data->x, new_x,
sizeof(
float) * 2);
354 throw Exception(
"Index value %u out of bounds (0..1)", index);
356 data->x[index] = new_x;
380 throw Exception(
"Index value %u out of bounds (0..1)", index);
382 return data->y[index];
403 memcpy(data->y, new_y,
sizeof(
float) * 2);
416 throw Exception(
"Index value %u out of bounds (0..1)", index);
418 data->y[index] = new_y;
447 data->style = new_style;
470 throw Exception(
"Index value %u out of bounds (0..3)", index);
472 return data->color[index];
492 memcpy(data->color, new_color,
sizeof(uint8_t) * 4);
504 throw Exception(
"Index value %u out of bounds (0..3)", index);
506 data->color[index] = new_color;
534 data_size =
sizeof(AddCartCircleMessage_data_t);
537 data = (AddCartCircleMessage_data_t *)
data_ptr;
541 data->radius = ini_radius;
542 data->style = ini_style;
543 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
544 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
545 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
546 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
548 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
549 enum_map_Anchor[(int)
NORTH] =
"NORTH";
550 enum_map_Anchor[(int)
EAST] =
"EAST";
551 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
552 enum_map_Anchor[(int)
WEST] =
"WEST";
553 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
554 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
555 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
556 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
566 data_size =
sizeof(AddCartCircleMessage_data_t);
569 data = (AddCartCircleMessage_data_t *)
data_ptr;
571 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
572 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
573 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
575 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
576 enum_map_Anchor[(int)
NORTH] =
"NORTH";
577 enum_map_Anchor[(int)
EAST] =
"EAST";
578 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
579 enum_map_Anchor[(int)
WEST] =
"WEST";
580 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
581 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
582 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
583 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
605 data = (AddCartCircleMessage_data_t *)
data_ptr;
697 data->radius = new_radius;
727 data->style = new_style;
750 throw Exception(
"Index value %u out of bounds (0..3)", index);
752 return data->color[index];
772 memcpy(data->color, new_color,
sizeof(uint8_t) * 4);
784 throw Exception(
"Index value %u out of bounds (0..3)", index);
786 data->color[index] = new_color;
815 data_size =
sizeof(AddCartRectMessage_data_t);
818 data = (AddCartRectMessage_data_t *)
data_ptr;
822 data->width = ini_width;
823 data->height = ini_height;
824 data->style = ini_style;
825 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
826 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
827 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
828 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
830 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
831 enum_map_Anchor[(int)
NORTH] =
"NORTH";
832 enum_map_Anchor[(int)
EAST] =
"EAST";
833 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
834 enum_map_Anchor[(int)
WEST] =
"WEST";
835 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
836 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
837 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
838 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
849 data_size =
sizeof(AddCartRectMessage_data_t);
852 data = (AddCartRectMessage_data_t *)
data_ptr;
854 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
855 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
856 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
858 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
859 enum_map_Anchor[(int)
NORTH] =
"NORTH";
860 enum_map_Anchor[(int)
EAST] =
"EAST";
861 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
862 enum_map_Anchor[(int)
WEST] =
"WEST";
863 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
864 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
865 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
866 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
889 data = (AddCartRectMessage_data_t *)
data_ptr;
981 data->width = new_width;
1011 data->height = new_height;
1041 data->style = new_style;
1064 throw Exception(
"Index value %u out of bounds (0..3)", index);
1066 return data->color[index];
1086 memcpy(data->color, new_color,
sizeof(uint8_t) * 4);
1098 throw Exception(
"Index value %u out of bounds (0..3)", index);
1100 data->color[index] = new_color;
1129 data_size =
sizeof(AddCartTextMessage_data_t);
1132 data = (AddCartTextMessage_data_t *)
data_ptr;
1136 strncpy(data->text, ini_text, 128-1);
1137 data->text[128-1] = 0;
1138 data->anchor = ini_anchor;
1139 data->size = ini_size;
1140 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
1141 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1142 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1143 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1145 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1146 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1147 enum_map_Anchor[(int)
EAST] =
"EAST";
1148 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1149 enum_map_Anchor[(int)
WEST] =
"WEST";
1150 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1151 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1152 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1153 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1164 data_size =
sizeof(AddCartTextMessage_data_t);
1167 data = (AddCartTextMessage_data_t *)
data_ptr;
1169 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1170 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1171 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1173 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1174 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1175 enum_map_Anchor[(int)
EAST] =
"EAST";
1176 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1177 enum_map_Anchor[(int)
WEST] =
"WEST";
1178 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1179 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1180 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1181 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1204 data = (AddCartTextMessage_data_t *)
data_ptr;
1296 strncpy(data->text, new_text,
sizeof(data->text)-1);
1297 data->text[
sizeof(data->text)-1] = 0;
1329 data->anchor = new_anchor;
1359 data->size = new_size;
1382 throw Exception(
"Index value %u out of bounds (0..3)", index);
1384 return data->color[index];
1404 memcpy(data->color, new_color,
sizeof(uint8_t) * 4);
1416 throw Exception(
"Index value %u out of bounds (0..3)", index);
1418 data->color[index] = new_color;
1442 data_size =
sizeof(DeleteObjectMessage_data_t);
1445 data = (DeleteObjectMessage_data_t *)
data_ptr;
1447 data->object_id = ini_object_id;
1448 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1449 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1450 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1452 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1453 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1454 enum_map_Anchor[(int)
EAST] =
"EAST";
1455 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1456 enum_map_Anchor[(int)
WEST] =
"WEST";
1457 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1458 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1459 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1460 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1466 data_size =
sizeof(DeleteObjectMessage_data_t);
1469 data = (DeleteObjectMessage_data_t *)
data_ptr;
1471 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1472 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1473 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1475 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1476 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1477 enum_map_Anchor[(int)
EAST] =
"EAST";
1478 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1479 enum_map_Anchor[(int)
WEST] =
"WEST";
1480 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1481 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1482 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1483 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1501 data = (DeleteObjectMessage_data_t *)
data_ptr;
1514 return data->object_id;
1535 data->object_id = new_object_id;
1558 data_size =
sizeof(DeleteAllMessage_data_t);
1561 data = (DeleteAllMessage_data_t *)
data_ptr;
1563 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1564 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1565 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1567 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1568 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1569 enum_map_Anchor[(int)
EAST] =
"EAST";
1570 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1571 enum_map_Anchor[(int)
WEST] =
"WEST";
1572 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1573 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1574 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1575 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1592 data = (DeleteAllMessage_data_t *)
data_ptr;
1618 const AddCartCircleMessage *m1 = dynamic_cast<const AddCartCircleMessage *>(message);
1622 const AddCartRectMessage *m2 = dynamic_cast<const AddCartRectMessage *>(message);
1626 const AddCartTextMessage *m3 = dynamic_cast<const AddCartTextMessage *>(message);
1630 const DeleteObjectMessage *m4 = dynamic_cast<const DeleteObjectMessage *>(message);
1634 const DeleteAllMessage *m5 = dynamic_cast<const DeleteAllMessage *>(message);
1642 EXPORT_INTERFACE(VisualDisplay2DInterface)