23 #include "visdisplay.h" 25 #include <interfaces/VisualDisplay2DInterface.h> 46 for (__sit = __shapes.begin(); __sit != __shapes.end(); ++__sit) {
59 __interface = interface;
70 while (! __interface->msgq_empty()) {
73 __shapes[m->
id()] =
new Line(m->
x(0), m->
y(0), m->
x(1), m->
y(1),
101 for (__sit = __shapes.begin(); __sit != __shapes.end(); ++__sit) {
102 delete __sit->second;
107 __interface->msgq_pop();
120 for (__sit = __shapes.begin(); __sit != __shapes.end(); ++__sit) {
122 __sit->second->color(r, g, b, a);
123 __sit->second->apply_style(cr);
124 __sit->second->draw(cr);
181 unsigned char r,
unsigned char g,
182 unsigned char b,
unsigned char a)
186 _line_style = line_style;
187 _color_r = r / 255.f;
188 _color_g = g / 255.f;
189 _color_b = b / 255.f;
190 _color_a = a / 255.f;
220 unsigned int id,
unsigned int owner,
222 unsigned char r,
unsigned char g,
223 unsigned char b,
unsigned char a)
224 :
Shape(id, owner, line_style, r, g, b, a)
236 cr->move_to(__x1, __y1);
237 cr->line_to(__x2, __y2);
264 unsigned int id,
unsigned int owner,
266 unsigned char r,
unsigned char g,
267 unsigned char b,
unsigned char a)
268 :
Shape(id, owner, line_style, r, g, b, a)
280 cr->rectangle(__x, __y, __width, __height);
304 unsigned int id,
unsigned int owner,
306 unsigned char r,
unsigned char g,
307 unsigned char b,
unsigned char a)
308 :
Shape(id, owner, line_style, r, g, b, a)
319 cr->arc(__x, __y, __radius, 0, 2*M_PI);
346 unsigned int id,
unsigned int owner,
347 unsigned char r,
unsigned char g,
348 unsigned char b,
unsigned char a)
364 cr->rotate(-0.5 * M_PI);
365 cr->set_font_size(1.36 * __size);
367 Cairo::TextExtents te;
368 cr->get_text_extents(__text, te);
370 float x = __x, y = __y;
372 case VisualDisplay2DInterface::CENTERED:
373 x = __x - te.width / 2.; y = __y + te.height / 2.;
break;
374 case VisualDisplay2DInterface::NORTH:
375 x = __x - te.width / 2.; y = __y + te.height;
break;
376 case VisualDisplay2DInterface::EAST:
377 x = __x - te.width; y = __y + te.height / 2.;
break;
378 case VisualDisplay2DInterface::SOUTH:
379 x = __x - te.width / 2.;
break;
380 case VisualDisplay2DInterface::WEST:
381 y = __y + te.height / 2.;
break;
382 case VisualDisplay2DInterface::NORTH_EAST:
383 x = __x - te.width; y = __y + te.height;
break;
384 case VisualDisplay2DInterface::SOUTH_EAST:
385 x = __x - te.width;
break;
386 case VisualDisplay2DInterface::SOUTH_WEST:
388 case VisualDisplay2DInterface::NORTH_WEST:
389 y = __y + te.height;
break;
393 cr->show_text(__text);
AddCartRectMessage Fawkes BlackBoard Interface Message.
LineStyle
Enumeration defining the possible line styles.
void draw(Cairo::RefPtr< Cairo::Context > &cr)
Draw shape to Cairo context.
void draw(Cairo::RefPtr< Cairo::Context > &cr)
Draw shape to Cairo context.
float x() const
Get x value.
unsigned int id() const
Get message ID.
uint8_t * color() const
Get color value.
float y() const
Get y value.
uint8_t * color() const
Get color value.
float size() const
Get size value.
Fawkes library namespace.
uint8_t * color() const
Get color value.
void set_interface(fawkes::VisualDisplay2DInterface *interface)
Set interface.
Anchor anchor() const
Get anchor value.
AddCartCircleMessage Fawkes BlackBoard Interface Message.
Anchor
Enumeration defining the possible anchor points.
~VisualDisplay2D()
Destructor.
Line(float x1, float y1, float x2, float y2, unsigned int id, unsigned int owner, fawkes::VisualDisplay2DInterface::LineStyle line_style=fawkes::VisualDisplay2DInterface::LS_SOLID, unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
Constructor.
uint8_t * color() const
Get color value.
char * text() const
Get text value.
LineStyle style() const
Get style value.
float width() const
Get width value.
float x() const
Get x value.
void process_messages()
Process messages.
float * y() const
Get y value.
AddCartTextMessage Fawkes BlackBoard Interface Message.
Shape(unsigned int id, unsigned int owner, fawkes::VisualDisplay2DInterface::LineStyle line_style=fawkes::VisualDisplay2DInterface::LS_SOLID, unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
Constructor.
Class representing a text object.
unsigned int owner()
Get owner ID.
unsigned int sender_id() const
Get ID of sender.
float height() const
Get height value.
AddCartLineMessage Fawkes BlackBoard Interface Message.
LineStyle style() const
Get style value.
float * x() const
Get x value.
Class representing a circle Line represented by its center point and radius.
void draw(Cairo::RefPtr< Cairo::Context > &cr)
Draw shape to Cairo context.
Class representing a shape.
Text(float x, float y, std::string text, fawkes::VisualDisplay2DInterface::Anchor anchor, float size, unsigned int id, unsigned int owner, unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
Constructor.
Class representing a rectangle.
Class representing a line.
float x() const
Get x value.
float radius() const
Get radius value.
void draw(Cairo::RefPtr< Cairo::Context > cr)
Draw objects.
float y() const
Get y value.
DeleteAllMessage Fawkes BlackBoard Interface Message.
LineStyle style() const
Get style value.
Rectangle(float x, float y, float width, float height, unsigned int id, unsigned int owner, fawkes::VisualDisplay2DInterface::LineStyle line_style=fawkes::VisualDisplay2DInterface::LS_SOLID, unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
Constructor.
virtual ~Shape()
Virtual empty destructor.
Circle(float x, float y, float radius, unsigned int id, unsigned int owner, fawkes::VisualDisplay2DInterface::LineStyle line_style=fawkes::VisualDisplay2DInterface::LS_SOLID, unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0)
Constructor.
void draw(Cairo::RefPtr< Cairo::Context > &cr)
Draw shape to Cairo context.
VisualDisplay2DInterface Fawkes BlackBoard Interface.
VisualDisplay2D()
Constructor.
float y() const
Get y value.