13 gpointer unused_data);
20 int main (
int argc,
char **argv)
37 options_string(ops,
"use", &(p->
use),
"estimate",
"One in 'odometry','estimate','true_pose'");
43 fprintf(stderr,
"A simple experimental GTK viewer.\n\nUsage:\n");
53 GtkWidget *window, *scrolled_win, *canvas;
58 gtk_init (&argc, &argv);
61 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
62 gtk_window_set_default_size (GTK_WINDOW (window), 640, 600);
63 gtk_widget_show (window);
64 g_signal_connect (window,
"delete_event", (GtkSignalFunc)
on_delete_event,
67 scrolled_win = gtk_scrolled_window_new (NULL, NULL);
68 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
70 gtk_widget_show (scrolled_win);
71 gtk_container_add (GTK_CONTAINER (window), scrolled_win);
73 canvas = goo_canvas_new ();
75 root = goo_canvas_get_root_item (GOO_CANVAS (canvas));
82 gtk_widget_show (canvas);
83 gtk_container_add (GTK_CONTAINER (scrolled_win), canvas);
90 rect_item = goo_canvas_rect_new (root, 0, 0, 50, 50,
94 "stroke-color",
"yellow",
108 g_printerr (
"Failed to create YES thread: %s\n", error->message);
122 p->
scans = malloc(1);
140 g_signal_connect (gld,
"button_press_event",
149 goo_canvas_update(p->
canvas);
162 const oriented_bbox*obbox,
const double device_size[2], cairo_matrix_t*
m) {
164 cairo_matrix_init_identity(m);
167 device_size[0] / obbox->
size[0],
168 device_size[1] / obbox->
size[1]};
170 double s = scale[0] < scale[1] ? scale[0] : scale[1];
171 cairo_matrix_scale(m, s, s);
172 cairo_matrix_scale(m, 1, -1);
173 cairo_matrix_rotate(m, -obbox->
pose[2]);
174 cairo_matrix_translate(m, -obbox->
pose[0], -obbox->
pose[1]);
179 cairo_matrix_init_identity(m);
180 cairo_matrix_translate(m, pose[0], pose[1]);
181 cairo_matrix_rotate(m, pose[2]);
208 global.
pose[0] = -22;
209 global.
pose[1] = -41;
211 global.
size[0] = 106;
214 cairo_matrix_t m_world_to_viewport;
217 cairo_matrix_t *
m = &m_world_to_viewport;
218 sm_info(
"Matrix: %f %f %f %f %f %f\n", m->xx,m->yx,m->xy,m->yy, m->x0, m->y0);
221 cairo_matrix_init_identity(&mm);
223 cairo_matrix_translate(&mm, 300, 600);
225 goo_canvas_item_set_transform(
rect_item, &mm);
234 cairo_matrix_t m_item_to_world;
238 cairo_matrix_multiply(&transform, &m_item_to_world, &m_world_to_viewport);
239 goo_canvas_item_set_transform(gld, &transform);
247 GooCanvasItem *target,
248 GdkEventButton *event,
251 g_print (
"rect item received button press event\n");
261 gpointer unused_data)
void * reading_thread(void *data)
void sm_set_program_name(const char *name)
void ls_add_options(line_style *ls, struct option *ops, const char *prefix, const char *desc_prefix)
void lds_add_options(ld_style *lds, struct option *ops, const char *prefix, const char *desc_prefix)
const char * input_filename
static gboolean on_delete_event(GtkWidget *window, GdkEvent *event, gpointer unused_data)
const char * friendly_pose(const double *pose)
void compute_transformations(viewer_params *p)
int main(int argc, char **argv)
LDP ld_read_smart(FILE *)
void item_to_world(const double pose[3], cairo_matrix_t *m)
int bbfind_add_bbox(bbfind *bbf, const BB2 bbox)
void bbfind_free(bbfind *bbf)
struct option * options_allocate(int n)
bbfind * bbfind_new(void)
struct GooLaserData ** scans_items
void world_to_viewport(const oriented_bbox *obbox, const double device_size[2], cairo_matrix_t *m)
FILE * open_file_for_reading(const char *filename)
GooCanvasItem * text_item
GooCanvasItem * rect_item
void options_print_help(struct option *options, FILE *f)
void ls_set_defaults(line_style *ls)
void sm_debug(const char *msg,...)
void transform(const gsl_vector *p, const gsl_vector *x, gsl_vector *res)
void sm_info(const char *msg,...)
void options_string(struct option *, const char *name, const char **p, const char *def_balue, const char *desc)
int bbfind_compute(bbfind *bbf, BB2 bbox)
static gboolean on_rect_button_press(GooCanvasItem *view, GooCanvasItem *target, GdkEventButton *event, gpointer data)
void sm_error(const char *msg,...)
void lds_set_defaults(ld_style *lds)
int options_parse_args(struct option *ops, int argc, const char *argv[])
GooCanvasItem * goo_laser_data_new(GooCanvasItem *parent, viewer_params *p, LDP ld)