Go to the documentation of this file.00001
00002 #include "goo_laser_data.h"
00003
00004
00005
00006
00007 G_DEFINE_TYPE (GooLaserData, goo_laser_data, GOO_TYPE_CANVAS_ITEM_SIMPLE)
00008
00009
00010
00011 static void
00012 goo_laser_data_init (GooLaserData *gld)
00013 {
00014
00015 }
00016
00017
00018
00019
00020
00021 GooCanvasItem*
00022 goo_laser_data_new (GooCanvasItem *parent, viewer_params *p, LDP ld)
00023 {
00024 GooCanvasItem *item;
00025 GooLaserData *gld;
00026
00027 item = g_object_new (goo_laser_data_get_type(), NULL);
00028
00029 gld = (GooLaserData*) item;
00030
00031 ld_get_bounding_box(ld, gld->bb_min, gld->bb_max, ld->estimate, 10);
00032 double padding = 1;
00033 gld->bb_min[0] -= padding;
00034 gld->bb_min[1] -= padding;
00035 gld->bb_max[0] += padding;
00036 gld->bb_max[1] += padding;
00037
00038
00039 gld->p = p;
00040 gld->ld = ld;
00041
00042 ld_get_oriented_bbox(ld, 20, &(gld->obbox) );
00043 oplus_d(ld->estimate, gld->obbox.pose, gld->obbox.pose);
00044
00045
00046
00047
00048
00049
00050
00051 if (parent)
00052 {
00053 goo_canvas_item_add_child (parent, item, -1);
00054 g_object_unref (item);
00055 }
00056
00057 return item;
00058 }
00059
00060
00061
00062
00063
00064
00065 static void
00066 goo_laser_data_update (GooCanvasItemSimple *simple,
00067 cairo_t *cr)
00068 {
00069 GooLaserData *gld = (GooLaserData*) simple;
00070
00071 double padding = 0;
00072
00073 simple->bounds.x1 = gld->bb_min[0] - padding;
00074 simple->bounds.y1 = gld->bb_min[1] - padding;
00075 simple->bounds.x2 = gld->bb_max[0] + padding;
00076 simple->bounds.y2 = gld->bb_max[1] + padding;
00077
00078
00079
00080
00081
00082 }
00083
00084
00085
00086 static void
00087 goo_laser_data_paint (GooCanvasItemSimple *simple,
00088 cairo_t *cr,
00089 const GooCanvasBounds *bounds)
00090 {
00091 GooLaserData *gld = (GooLaserData*) simple;
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 cairo_set_antialias( cr, CAIRO_ANTIALIAS_NONE );
00105
00106
00107 cairo_set_source_rgb(cr, 0.3, 0, 1.0);
00108 cairo_arc(cr, 0,0, 0.4, 0.0, 2*M_PI);
00109 cairo_fill(cr);
00110
00111 cr_ld_draw(cr, gld->ld, &(gld->p->laser));
00112 }
00113
00114
00115
00116
00117
00118 static gboolean
00119 goo_laser_data_is_item_at (GooCanvasItemSimple *simple,
00120 gdouble x,
00121 gdouble y,
00122 cairo_t *cr,
00123 gboolean is_pointer_event)
00124 {
00125 GooLaserData *gld = (GooLaserData*) simple;
00126
00127
00128
00129 return FALSE;
00130
00131 return TRUE;
00132 }
00133
00134
00135
00136
00137 static void
00138 goo_laser_data_class_init (GooLaserDataClass *klass)
00139 {
00140 GooCanvasItemSimpleClass *simple_class = (GooCanvasItemSimpleClass*) klass;
00141
00142 simple_class->simple_update = goo_laser_data_update;
00143 simple_class->simple_paint = goo_laser_data_paint;
00144 simple_class->simple_is_item_at = goo_laser_data_is_item_at;
00145 }
00146
00147