23 #include "visdisplay.h" 25 #include <interfaces/VisualDisplay2DInterface.h> 45 for (sit_ = shapes_.begin(); sit_ != shapes_.end(); ++sit_) {
57 interface_ = interface;
67 while (!interface_->msgq_empty()) {
71 shapes_[m->
id()] =
new Line(m->
x(0),
115 shapes_[m->
id()] =
new Text(m->
x(),
128 for (sit_ = shapes_.begin(); sit_ != shapes_.end(); ++sit_) {
134 interface_->msgq_pop();
146 for (sit_ = shapes_.begin(); sit_ != shapes_.end(); ++sit_) {
148 sit_->second->color(r, g, b, a);
149 sit_->second->apply_style(cr);
150 sit_->second->draw(cr);
214 _line_style = line_style;
215 _color_r = r / 255.f;
216 _color_g = g / 255.f;
217 _color_b = b / 255.f;
218 _color_a = a / 255.f;
256 :
Shape(id, owner, line_style, r, g, b, a)
267 cr->move_to(x1_, y1_);
268 cr->line_to(x2_, y2_);
303 :
Shape(id, owner, line_style, r, g, b, a)
314 cr->rectangle(x_, y_, width_, height_);
345 :
Shape(id, owner, line_style, r, g, b, a)
355 cr->arc(x_, y_, radius_, 0, 2 * M_PI);
380 const std::string & text,
403 cr->rotate(-0.5 * M_PI);
404 cr->set_font_size(1.36 * size_);
406 Cairo::TextExtents te;
407 cr->get_text_extents(text_, te);
409 float x = x_, y = y_;
411 case VisualDisplay2DInterface::CENTERED:
412 x = x_ - te.width / 2.;
413 y = y_ + te.height / 2.;
415 case VisualDisplay2DInterface::NORTH:
416 x = x_ - te.width / 2.;
419 case VisualDisplay2DInterface::EAST:
421 y = y_ + te.height / 2.;
423 case VisualDisplay2DInterface::SOUTH: x = x_ - te.width / 2.;
break;
424 case VisualDisplay2DInterface::WEST: y = y_ + te.height / 2.;
break;
425 case VisualDisplay2DInterface::NORTH_EAST:
429 case VisualDisplay2DInterface::SOUTH_EAST: x = x_ - te.width;
break;
430 case VisualDisplay2DInterface::SOUTH_WEST:
break;
431 case VisualDisplay2DInterface::NORTH_WEST: y = y_ + te.height;
break;
435 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 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, const 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.