int main (int argc, char *argv[]) { OsmGpsMap *map; OsmGpsMapPolygon* poly; GtkWidget *window; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Window"); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); map = g_object_new (OSM_TYPE_GPS_MAP, NULL); gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(map)); poly = osm_gps_map_polygon_new(); OsmGpsMapTrack* polytrack = osm_gps_map_track_new(); OsmGpsMapPoint* p1, *p2, *p3; p1 = osm_gps_map_point_new_radians(1.25663706, -0.488692191); p2 = osm_gps_map_point_new_radians(1.06465084, -0.750491578); p3 = osm_gps_map_point_new_radians(1.064650849, -0.191986218); osm_gps_map_track_add_point(polytrack, p1); osm_gps_map_track_add_point(polytrack, p2); osm_gps_map_track_add_point(polytrack, p3); g_object_set(poly, "track", polytrack, NULL); g_object_set(poly, "editable", TRUE, NULL); osm_gps_map_polygon_add(map, poly); gtk_widget_show (GTK_WIDGET(map)); gtk_widget_show (window); gtk_main (); return 0; }
/** * @fn int main (int argc, char **argv) * @brief Main program & Gtk thread. * * Create window and all widgets, then set there parameters to be the <br> * ROS params. */ int main (int argc, char **argv) { GtkBuilder *builder; GdkColor black = { 0, 0, 0, 0 }; GError *error = NULL; char glade_gui_file[FILENAME_MAX]; int start_zoom = 15; char *mapcachedir; OsmGpsMapPoint ccny_coord = { 40.818551, -73.948674 }; struct arg param; param.argc = argc; param.argv = argv; pthread_t rosThread; // **** init threads g_thread_init (NULL); gdk_threads_init (); gdk_threads_enter (); // **** init gtk gtk_init (&argc, &argv); // **** allocate data structure data = g_slice_new (AppData); // **** set the glade gui file & set icon directory std::string package_path = ros::package::getPath (ROS_PACKAGE_NAME); sprintf (glade_gui_file, "%s/gui/%s", package_path.c_str (), "gui.glade"); sprintf (data->icon_directory, "%s/gui/icon", package_path.c_str ()); std::string rosbag_path = ros::package::getPath("rosbag"); sprintf (data->rosbag_rec_path, "%s/bin/record", rosbag_path.c_str ()); data->current_page = 0; data->telemetry_opt_popup_state = false; data->gps_opt_popup_state = false; data->fullscreen = false; load_icon (); // **** Create new GtkBuilder object builder = gtk_builder_new (); // **** Load UI from file if (!gtk_builder_add_from_file (builder, glade_gui_file, &error)) { g_warning ("%s", error->message); g_free (error); exit (-1); } // **** Get main window pointer from UI data->window = GTK_WIDGET (gtk_builder_get_object (builder, "window1")); gtk_window_set_title (GTK_WINDOW (data->window), "CityFlyer Ground Station"); gtk_window_set_position (GTK_WINDOW (data->window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (data->window), 1024, 576); // **** create ROS thread pthread_create (&rosThread, NULL, startROS, ¶m); // **** wait ros finish read params while (!data->ros_param_read) { ROS_DEBUG ("Waiting ROS params"); } // **** Get GtkNotebook objsect data->notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook1")); // ##################################################################### // ##################################################################### // **** Tab 1: Telemetry // **** create altimeter widgets data->alt = gtk_altimeter_new (); g_object_set (GTK_ALTIMETER (data->alt), "grayscale-color", data->grayscale_color, "unit-is-feet", data->altimeter_unit_is_feet, "unit-step-value", data->altimeter_step_value, "radial-color", data->radial_color, NULL); // **** create compass widgets data->comp = gtk_compass_new (); g_object_set (GTK_COMPASS (data->comp), "grayscale-color", data->grayscale_color, "radial-color", data->radial_color, NULL); data->comp2 = gtk_compass_new (); g_object_set (GTK_COMPASS (data->comp2), "grayscale-color", data->grayscale_color, "radial-color", data->radial_color, NULL); data->gauge1 = gtk_gauge_new (); g_object_set (GTK_GAUGE (data->gauge1), "name", data->gauge1_name_f, NULL); g_object_set (GTK_GAUGE (data->gauge1), "grayscale-color", data->grayscale_color, "radial-color", data->radial_color, "start-value", data->gauge1_start_value, "end-value", data->gauge1_end_value, "initial-step", data->gauge1_initial_step, "sub-step", (gdouble) data->gauge1_sub_step, "drawing-step", data->gauge1_drawing_step, "color-strip-order", data->gauge1_color_strip_order, "green-strip-start", data->gauge1_green_strip_start, "yellow-strip-start", data->gauge1_yellow_strip_start, "red-strip-start", data->gauge1_red_strip_start, NULL); // **** create artificial horizon widgets data->arh = gtk_artificial_horizon_new (); g_object_set (GTK_ARTIFICIAL_HORIZON (data->arh), "grayscale-color", data->grayscale_color, "radial-color", data->radial_color, NULL); // **** create variometer widgets data->vario = gtk_variometer_new (); g_object_set (GTK_VARIOMETER (data->vario), "grayscale-color", data->grayscale_color, "unit-is-feet", data->variometer_unit_is_feet, "unit-step-value", data->variometer_step_value, "radial-color", data->radial_color, NULL); data->widget_table = GTK_WIDGET (gtk_builder_get_object (builder, "table_Widgets")); gtk_table_attach_defaults (GTK_TABLE (data->widget_table), data->alt, 0, 1, 0, 1); gtk_table_attach_defaults (GTK_TABLE (data->widget_table), data->arh, 1, 2, 0, 1); gtk_table_attach_defaults (GTK_TABLE (data->widget_table), data->comp, 2, 3, 0, 1); gtk_table_attach_defaults (GTK_TABLE (data->widget_table), data->vario, 0, 1, 1, 2); gtk_table_attach_defaults (GTK_TABLE (data->widget_table), data->comp2, 1, 2, 1, 2); gtk_table_attach_defaults (GTK_TABLE (data->widget_table), data->gauge1, 2, 3, 1, 2); gtk_widget_modify_bg (data->alt, GTK_STATE_NORMAL, &black); gtk_widget_modify_bg (data->comp, GTK_STATE_NORMAL, &black); gtk_widget_modify_bg (data->comp2, GTK_STATE_NORMAL, &black); gtk_widget_modify_bg (data->arh, GTK_STATE_NORMAL, &black); gtk_widget_modify_bg (data->gauge1, GTK_STATE_NORMAL, &black); gtk_widget_modify_bg (data->vario, GTK_STATE_NORMAL, &black); data->telemetry_option_popup = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_TelemetryOption")); data->btn_open_telemetry_option_popup = GTK_WIDGET (gtk_builder_get_object (builder, "button_OpenTelemetryOptionPopup")); data->btn_close_telemetry_option_popup = GTK_WIDGET (gtk_builder_get_object (builder, "button_CloseTelemetryOptionPopup")); gtk_button_set_image (GTK_BUTTON (data->btn_open_telemetry_option_popup), gtk_image_new_from_pixbuf (gdk_pixbuf_scale_simple (data->leftarrow_icon_64, 24, 50, GDK_INTERP_HYPER))); gtk_button_set_image (GTK_BUTTON (data->btn_close_telemetry_option_popup), gtk_image_new_from_pixbuf (gdk_pixbuf_scale_simple (data->rightarrow_icon_64, 24, 50, GDK_INTERP_HYPER))); // ##################################################################### // ##################################################################### // **** Tab 2: Gps // Some GpsdViewer initialisation data->draw_path = false; data->map_provider = OSM_GPS_MAP_SOURCE_OPENSTREETMAP; data->map_zoom_max = 18; data->map_current_zoom = start_zoom; data->repo_uri = osm_gps_map_source_get_repo_uri (data->map_provider); data->friendly_name = osm_gps_map_source_get_friendly_name (data->map_provider); data->uav_track = osm_gps_map_track_new (); mapcachedir = osm_gps_map_get_default_cache_directory (); data->cachedir = g_build_filename (mapcachedir, data->friendly_name, NULL); g_free (mapcachedir); // Create the OsmGpsMap object data->map = (OsmGpsMap *) g_object_new (OSM_TYPE_GPS_MAP, "map-source", data->map_provider, "tile-cache", data->cachedir, "proxy-uri", g_getenv ("http_proxy"), NULL); //Set the starting coordinates and zoom level for the map osm_gps_map_set_zoom (data->map, start_zoom); osm_gps_map_set_center (data->map, ccny_coord.rlat, ccny_coord.rlon); data->osd = gpsd_viewer_osd_new (); g_object_set (GPSD_VIEWER_OSD (data->osd), "show-scale", true, "show-coordinates", true, "show-dpad", true, "show-zoom", true, "show-gps-in-dpad", true, "show-gps-in-zoom", false, "dpad-radius", 30, NULL); osm_gps_map_layer_add (OSM_GPS_MAP (data->map), OSM_GPS_MAP_LAYER (data->osd)); data->map_box = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_map_box")); data->map_container = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_map_container")); gtk_box_pack_start (GTK_BOX (data->map_box), GTK_WIDGET (data->map), TRUE, TRUE, 0); data->gpsd_option_popup = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_GpsdOptionPopup")); data->btn_open_gpsd_option_popup = GTK_WIDGET (gtk_builder_get_object (builder, "button_OpenGpsdOptionPopup")); data->btn_close_gpsd_option_popup = GTK_WIDGET (gtk_builder_get_object (builder, "button_CloseGpsdOptionPopup")); gtk_button_set_image (GTK_BUTTON (data->btn_open_gpsd_option_popup), gtk_image_new_from_pixbuf (gdk_pixbuf_scale_simple (data->leftarrow_icon_64, 24, 50, GDK_INTERP_HYPER))); gtk_button_set_image (GTK_BUTTON (data->btn_close_gpsd_option_popup), gtk_image_new_from_pixbuf (gdk_pixbuf_scale_simple (data->rightarrow_icon_64, 24, 50, GDK_INTERP_HYPER))); // ##################################################################### // ##################################################################### // **** Tab 3: Rec data->recording = 0; data->rosbag_record_cmd = "rosbag record"; data->topicsList = GTK_LIST_STORE (gtk_builder_get_object (builder, "liststore_TopicList")); data->cmd_line_entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry_CommandLine")); data->prefix_entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry_Prefix")); data->info_textview = GTK_WIDGET (gtk_builder_get_object (builder, "textview_BagInfo")); data->update_btn = GTK_WIDGET (gtk_builder_get_object (builder, "button_UpdateTopicList")); data->box_MotorStatus = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_MotorStatus")); data->box_Flying = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_Flying")); data->box_Gps = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_Gps")); data->flightMode_label = GTK_WIDGET (gtk_builder_get_object (builder, "label_FlightModeValue")); data->upTime_label = GTK_WIDGET (gtk_builder_get_object (builder, "label_UpTimeValue")); data->cpuLoad_label = GTK_WIDGET (gtk_builder_get_object (builder, "label_CpuLoadValue")); data->box_RecordStatus = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_RecordStatus")); data->record_stop_btn = GTK_WIDGET (gtk_builder_get_object (builder, "button_RecordStop")); gtk_box_pack_end (GTK_BOX (data->box_MotorStatus), data->status_ok_icon_motor, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (data->box_MotorStatus), data->status_fail_icon_motor, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (data->box_Flying), data->status_ok_icon_flying, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (data->box_Flying), data->status_fail_icon_flying, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (data->box_Gps), data->status_ok_icon_gps, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (data->box_Gps), data->status_fail_icon_gps, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (data->box_RecordStatus), data->record_icon, TRUE, TRUE, 0); gtk_box_pack_end (GTK_BOX (data->box_RecordStatus), data->record_g_icon, TRUE, TRUE, 0); gtk_button_set_image (GTK_BUTTON (data->update_btn), gtk_image_new_from_pixbuf (gdk_pixbuf_scale_simple (data->refresh_icon_64, 24, 24, GDK_INTERP_HYPER))); gtk_button_set_image (GTK_BUTTON (data->record_stop_btn), gtk_image_new_from_pixbuf (gdk_pixbuf_scale_simple (data->record_icon_64, 40, 40, GDK_INTERP_HYPER))); // Connect signals gtk_builder_connect_signals (builder, data); // Destroy builder, since we don't need it anymore g_object_unref (G_OBJECT (builder)); // Show window. All other widgets are automatically shown by GtkBuilder gtk_widget_show_all (data->window); gtk_widget_hide(data->record_icon); gtk_widget_hide(data->status_ok_icon_motor); gtk_widget_hide(data->status_ok_icon_flying); gtk_widget_hide(data->status_ok_icon_gps); gtk_widget_hide_all(data->telemetry_option_popup); gtk_widget_hide_all(data->gpsd_option_popup); // **** allow ROS spinning data->widget_created = true; // **** udpate all widgets g_timeout_add (data->telemetry_refresh_rate, widgets_update, NULL); gtk_main (); gdk_threads_leave (); return 0; }
int main (int argc, char **argv) { GtkBuilder *builder; GtkWidget *widget; GtkAccelGroup *ag; OsmGpsMap *map; OsmGpsMapLayer *osd; OsmGpsMapTrack *rightclicktrack; const char *repo_uri; char *cachedir, *cachebasedir; GError *error = NULL; GOptionContext *context; g_thread_init(NULL); gtk_init (&argc, &argv); context = g_option_context_new ("- Map browser"); g_option_context_set_help_enabled(context, FALSE); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { usage(context); return 1; } /* Only use the repo_uri to check if the user has supplied a valid map source ID */ repo_uri = osm_gps_map_source_get_repo_uri(opt_map_provider); if ( repo_uri == NULL ) { usage(context); return 2; } cachebasedir = osm_gps_map_get_default_cache_directory(); if (opt_cache_base_dir && g_file_test(opt_cache_base_dir, G_FILE_TEST_IS_DIR)) { cachedir = g_strdup(OSM_GPS_MAP_CACHE_AUTO); cachebasedir = g_strdup(opt_cache_base_dir); } else if (opt_friendly_cache) { cachedir = g_strdup(OSM_GPS_MAP_CACHE_FRIENDLY); } else if (opt_no_cache) { cachedir = g_strdup(OSM_GPS_MAP_CACHE_DISABLED); } else { cachedir = g_strdup(OSM_GPS_MAP_CACHE_AUTO); } if (opt_debug) gdk_window_set_debug_updates(TRUE); g_debug("Map Cache Dir: %s", cachedir); g_debug("Map Provider: %s (%d)", osm_gps_map_source_get_friendly_name(opt_map_provider), opt_map_provider); map = g_object_new (OSM_TYPE_GPS_MAP, "map-source",opt_map_provider, "tile-cache",cachedir, "tile-cache-base", cachebasedir, "proxy-uri",g_getenv("http_proxy"), NULL); osd = g_object_new (OSM_TYPE_GPS_MAP_OSD, "show-scale",TRUE, "show-coordinates",TRUE, "show-crosshair",TRUE, "show-dpad",TRUE, "show-zoom",TRUE, "show-gps-in-dpad",TRUE, "show-gps-in-zoom",FALSE, "dpad-radius", 30, NULL); osm_gps_map_layer_add(OSM_GPS_MAP(map), osd); g_object_unref(G_OBJECT(osd)); //Add a second track for right clicks rightclicktrack = osm_gps_map_track_new(); osm_gps_map_track_add(OSM_GPS_MAP(map), rightclicktrack); g_free(cachedir); g_free(cachebasedir); //Enable keyboard navigation osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_FULLSCREEN, GDK_F11); osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_UP, GDK_Up); osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_DOWN, GDK_Down); osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_LEFT, GDK_Left); osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_RIGHT, GDK_Right); //Build the UI g_star_image = gdk_pixbuf_new_from_file_at_size ("poi.png", 24,24,NULL); builder = gtk_builder_new(); gtk_builder_add_from_file (builder, "mapviewer.ui", &error); if (error) g_error ("ERROR: %s\n", error->message); gtk_box_pack_start ( GTK_BOX(gtk_builder_get_object(builder, "map_box")), GTK_WIDGET(map), TRUE, TRUE, 0); //Init values float lw,a; GdkColor c; OsmGpsMapTrack *gpstrack = osm_gps_map_gps_get_track (map); g_object_get (gpstrack, "line-width", &lw, "alpha", &a, NULL); osm_gps_map_track_get_color(gpstrack, &c); gtk_adjustment_set_value ( GTK_ADJUSTMENT(gtk_builder_get_object(builder, "gps_width_adjustment")), lw); gtk_adjustment_set_value ( GTK_ADJUSTMENT(gtk_builder_get_object(builder, "gps_alpha_adjustment")), a); gtk_adjustment_set_value ( GTK_ADJUSTMENT(gtk_builder_get_object(builder, "star_xalign_adjustment")), 0.5); gtk_adjustment_set_value ( GTK_ADJUSTMENT(gtk_builder_get_object(builder, "star_yalign_adjustment")), 0.5); gtk_color_button_set_color ( GTK_COLOR_BUTTON(gtk_builder_get_object(builder, "gps_colorbutton")), &c); //Connect to signals g_signal_connect ( gtk_builder_get_object(builder, "zoom_in_button"), "clicked", G_CALLBACK (on_zoom_in_clicked_event), (gpointer) map); g_signal_connect ( gtk_builder_get_object(builder, "zoom_out_button"), "clicked", G_CALLBACK (on_zoom_out_clicked_event), (gpointer) map); g_signal_connect ( gtk_builder_get_object(builder, "home_button"), "clicked", G_CALLBACK (on_home_clicked_event), (gpointer) map); g_signal_connect ( gtk_builder_get_object(builder, "cache_button"), "clicked", G_CALLBACK (on_cache_clicked_event), (gpointer) map); g_signal_connect ( gtk_builder_get_object(builder, "gps_alpha_adjustment"), "value-changed", G_CALLBACK (on_gps_alpha_changed), (gpointer) map); g_signal_connect ( gtk_builder_get_object(builder, "gps_width_adjustment"), "value-changed", G_CALLBACK (on_gps_width_changed), (gpointer) map); g_signal_connect ( gtk_builder_get_object(builder, "star_xalign_adjustment"), "value-changed", G_CALLBACK (on_star_align_changed), (gpointer) "x-align"); g_signal_connect ( gtk_builder_get_object(builder, "star_yalign_adjustment"), "value-changed", G_CALLBACK (on_star_align_changed), (gpointer) "y-align"); g_signal_connect ( gtk_builder_get_object(builder, "gps_colorbutton"), "color-set", G_CALLBACK (on_gps_color_changed), (gpointer) gpstrack); g_signal_connect (G_OBJECT (map), "button-press-event", G_CALLBACK (on_button_press_event), (gpointer) rightclicktrack); g_signal_connect (G_OBJECT (map), "button-release-event", G_CALLBACK (on_button_release_event), (gpointer) gtk_builder_get_object(builder, "text_entry")); g_signal_connect (G_OBJECT (map), "notify::tiles-queued", G_CALLBACK (on_tiles_queued_changed), (gpointer) gtk_builder_get_object(builder, "cache_label")); widget = GTK_WIDGET(gtk_builder_get_object(builder, "window1")); g_signal_connect (widget, "destroy", G_CALLBACK (on_close), (gpointer) map); //Setup accelerators. ag = gtk_accel_group_new(); gtk_accel_group_connect(ag, GDK_w, GDK_CONTROL_MASK, GTK_ACCEL_MASK, g_cclosure_new(gtk_main_quit, NULL, NULL)); gtk_accel_group_connect(ag, GDK_q, GDK_CONTROL_MASK, GTK_ACCEL_MASK, g_cclosure_new(gtk_main_quit, NULL, NULL)); gtk_window_add_accel_group(GTK_WINDOW(widget), ag); gtk_widget_show_all (widget); g_log_set_handler ("OsmGpsMap", G_LOG_LEVEL_MASK, g_log_default_handler, NULL); osm_gps_map_set_center_and_zoom(map, 48.858387,2.346268,12); gtk_main (); return 0; }
/** * @fn int main (int argc, char **argv) * @brief Main program & Gtk thread. * * Create window and all widgets, then set there parameters to be the <br> * ROS params. */ int main (int argc, char **argv) { GtkBuilder *builder; GError *error = NULL; char gui_filename[FILENAME_MAX]; int start_zoom = 15; OsmGpsMapPoint ccny_coord = { 33.421355, -111.928253 }; OsmGpsMapTrack *rightclicktrack; struct arg param; param.argc = argc; param.argv = argv; pthread_t rosThread; // **** init threads g_thread_init (NULL); gdk_threads_init (); gdk_threads_enter (); // **** init gtk gtk_init (&argc, &argv); // **** get the glade gui file std::string package_path = ros::package::getPath (ROS_PACKAGE_NAME); sprintf (gui_filename, "%s/%s", package_path.c_str (), "gui.glade"); // Allocate data structure data = g_slice_new (AppData); // Create new GtkBuilder object builder = gtk_builder_new (); // Load UI from file if (!gtk_builder_add_from_file (builder, gui_filename, &error)) { g_warning ("%s", error->message); g_free (error); pthread_exit (NULL); } // Get main window pointer from UI data->window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); // **** create ROS thread pthread_create (&rosThread, NULL, startROS, ¶m); // **** wait ros finish read params while (!data->ros_param_read) { ROS_DEBUG ("Waiting ROS params"); } // Some initialisation gdk_window_set_debug_updates (false); data->draw_path = false; data->map_provider = OSM_GPS_MAP_SOURCE_GOOGLE_SATELLITE; data->map_zoom_max = 18; data->map_current_zoom = start_zoom; data->repo_uri = osm_gps_map_source_get_repo_uri (data->map_provider); data->friendly_name = osm_gps_map_source_get_friendly_name (data->map_provider); char *mapcachedir; mapcachedir = osm_gps_map_get_default_cache_directory (); data->cachedir = g_build_filename (mapcachedir, data->friendly_name, NULL); g_free (mapcachedir); // Create the OsmGpsMap object data->map = (OsmGpsMap *) g_object_new (OSM_TYPE_GPS_MAP, "map-source", data->map_provider, "tile-cache", data->cachedir, "proxy-uri", g_getenv ("http_proxy"), "auto-center",FALSE, NULL); //Set the starting coordinates and zoom level for the map osm_gps_map_set_zoom (data->map, start_zoom); osm_gps_map_set_center (data->map, ccny_coord.rlat, ccny_coord.rlon); data->osd = gpsd_viewer_osd_new(); g_object_set(GPSD_VIEWER_OSD(data->osd), "show-scale",true, "show-coordinates",true, "show-dpad",true, "show-zoom",true, "show-gps-in-dpad",true, "show-gps-in-zoom",false, "dpad-radius", 30, NULL); osm_gps_map_layer_add(OSM_GPS_MAP(data->map), OSM_GPS_MAP_LAYER(data->osd)); data->current_track = osm_gps_map_track_new(); //Add a second track for right clicks rightclicktrack = osm_gps_map_track_new(); osm_gps_map_track_add(OSM_GPS_MAP(data->map), rightclicktrack); // Add the map to the box data->map_box = GTK_WIDGET (gtk_builder_get_object (builder, "hbox2")); gtk_box_pack_start (GTK_BOX (data->map_box), GTK_WIDGET (data->map), TRUE, TRUE, 0); data->map_container = GTK_WIDGET (gtk_builder_get_object (builder, "hbox1")); // Connect signals g_signal_connect (G_OBJECT (data->map), "button-press-event", G_CALLBACK (on_button_press_event), (gpointer) rightclicktrack); gtk_builder_connect_signals (builder, data); // Destroy builder, since we don't need it anymore g_object_unref (G_OBJECT (builder)); // Show window. All other widgets are automatically shown by GtkBuilder gtk_widget_show_all (data->window); // **** allow ROS spinning data->widget_created = true; // Start main loop gtk_main (); gdk_threads_leave (); return 0; }
OsmGpsMapPolygon * osm_gps_map_polygon_new (void) { return g_object_new (OSM_TYPE_GPS_MAP_POLYGON, "track", osm_gps_map_track_new(), NULL); }
static void osm_gps_map_polygon_init (OsmGpsMapPolygon *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE((self), OSM_TYPE_GPS_MAP_POLYGON, OsmGpsMapPolygonPrivate); self->priv->track = osm_gps_map_track_new(); }