int main(int argc, char** argv) { GtkWidget* w; GtkWidget* box; GtkWidget* p; GtkWidget* f; GtkWidget* menu; GtkWidget* item; GtkWidget* sub; gtk_init(&argc, &argv); // creates the window w = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(w), "ev.view"); gtk_window_resize(GTK_WINDOW(w), 640, 480); box = gtk_vbox_new(FALSE, 0); // set menues menu = gtk_menu_bar_new(); gtk_box_pack_start(GTK_BOX(box), menu, FALSE, TRUE, 0); // File item = gtk_menu_item_new_with_label("File"); sub = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), sub); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); newMenuItem(sub, "Open data...", G_CALLBACK(menuOpenData), w); itemRecons = newMenuItem(sub, "Open reconstruction...", G_CALLBACK(menuOpenRec), w); gtk_widget_set_sensitive(GTK_WIDGET(itemRecons), FALSE); newMenuItem(sub, "Quit", G_CALLBACK(menuQuit), NULL); // Map item = gtk_menu_item_new_with_label("Map"); sub = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), sub); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); newMenuItem(sub, "Open raster...", G_CALLBACK(menuOpenRaster), NULL); // Layout p = gtk_hpaned_new(); gtk_widget_set_size_request(p, 100, -1); f = gtk_frame_new(NULL); gtk_paned_pack1(GTK_PANED(p), f, TRUE, FALSE); gtk_widget_set_size_request(f, 50, -1); initTree(f); f = gtk_frame_new(NULL); gtk_paned_pack2(GTK_PANED(p), f, TRUE, FALSE); gtk_widget_set_size_request(f, 50, -1); initMap(f); gtk_box_pack_start(GTK_BOX(box), p, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(w), box); gtk_widget_show_all(w); gtk_widget_add_events(w, GDK_KEY_PRESS_MASK); g_signal_connect(G_OBJECT(w), "key_press_event", G_CALLBACK(keyPress), w); gtk_main(); return 0; }
void Graphical_UI::createProcessingMenu() { QMenu* pm = menuBar()->addMenu(tr("&Processing")); newMenuItem(pm, "&Reset", SLOT(resetCmd()), "Reset the graph, clear all data collected", "Ctrl+R", QIcon::fromTheme("edit-delete")); newMenuItem(pm, "&Process", this, SLOT(pause(bool)), "Start/stop processing of frames", !ParameterServer::instance()->get<bool>("start_paused"), " ", QIcon::fromTheme("media-playback-start")); newMenuItem(pm, "Capture One& Frame", SLOT(getOneFrameCmd()), "Process one frame only", QKeySequence::InsertParagraphSeparator); /* Crashes newMenuItem(pm, "&Delete Last Node", SLOT(deleteLastFrameCmd()), "Remove last node from graph", "Backspace", QIcon::fromTheme("edit-undo")); */ pm->addSeparator(); newMenuItem(pm, "Clear Cloud Storage", SIGNAL(clearClouds()), "Remove Point Clouds from Memory", "", QIcon::fromTheme("edit-delete")); newMenuItem(pm, "Optimize Trajectory &Estimate", SLOT(optimizeGraphTrig()), "Compute optimized pose graph with g2o", "O"); pm->addSeparator(); newMenuItem(pm, "E&xit", SLOT(close()), "Exit the application", "Ctrl+Q", QIcon::fromTheme("application-exit"));//doesn't work for gnome }
void Graphical_UI::createLoadMenu() { QMenu* lm = menuBar()->addMenu(tr("&Load")); newMenuItem(lm, "&Open PCD files", SLOT(openPCDFilesDialog()), "Open one or more pcd files to process", QKeySequence::Open, QIcon::fromTheme("document-open")); newMenuItem(lm, "Open ROS &bag file", SLOT(openBagFileDialog()), "Open a bag file to process", "Ctrl+B", QIcon::fromTheme("document-open")); }
MenuItem * newStringsMenuItem ( Menu *menu, unsigned char *setting, const MenuString *name, const MenuString *strings, unsigned char count ) { MenuItem *item = newMenuItem(menu, setting, name); if (item) { setMenuItemStrings(item, strings, count); } return item; }
MenuItem * newNumericMenuItem ( Menu *menu, unsigned char *setting, const MenuString *name, unsigned char minimum, unsigned char maximum, unsigned char divisor ) { MenuItem *item = newMenuItem(menu, setting, name); if (item) { item->methods = &menuItemMethods_numeric; item->minimum = minimum; item->maximum = maximum; item->divisor = divisor; } return item; }
void Graphical_UI::createMenus() { createProcessingMenu(); createLoadMenu(); QAction* octoMapAction = createSaveMenu(); QMenu *om = menuBar()->addMenu(tr("&OctoMap")); newMenuItem(om, "Point Cloud Occupancy Filter", SLOT(triggerCloudFiltering()), "Remove points from the cloud that fall into unoccupied voxels of the OctoMap"); newMenuItem(om, "Octomap Resolution", SLOT(setOctoMapResolution()), "Change the octomap resolution. Clears previously created maps on next update."); newMenuItem(om, "&Online OctoMapping", this, SLOT(toggleOnlineVoxelMapping(bool)), "Toggle Online/Offline OctoMapping. Make sure to set a low octomap_resolution and/or high cloud_creation_skip_step for online mapping", ParameterServer::instance()->get<bool>("octomap_online_creation")); /* Separation of computation and saving of octomap not yet Implemented QAction *computeOctoAct = new QAction(tr("Compute Octomap"), this); //computeOctoAct->setShortcuts(QKeySequence::SaveAs); computeOctoAct->setStatusTip(tr("Create OctoMap from stored point clouds")); connect(computeOctoAct, SIGNAL(triggered()), this, SLOT(computeOctomap())); octoMapMenu->addAction(computeOctoAct); this->addAction(computeOctoAct); */ /* QAction *showErrorAct = new QAction(tr("Show Edge Errors"), this); showErrorAct->setShortcut(QString("Ctrl+Shift+E")); showErrorAct->setStatusTip(tr("")); connect(showErrorAct, SIGNAL(triggered()), this, SLOT(showEdgeErrors())); actionMenu->addAction(showErrorAct); this->addAction(showErrorAct); */ //View Menus ############################################################### //View Menus ############################################################### if(ParameterServer::instance()->get<bool>("use_glwidget")) { QMenu* v3 = menuBar()->addMenu(tr("&3D View")); newMenuItem(v3, "&Clear 3D Display", glviewer, SLOT(reset()), "Clears 3D viewer cloud data. Point Clouds are still retained, e.g. for mapping purposes.", "", QIcon::fromTheme("edit-delete")); newMenuItem(v3, "Toggle &3D Display", glviewer, SLOT(setVisible(bool)), "Turn off the OpenGL Display", true, "3"); newMenuItem(v3, "&Toggle Triangulation", glviewer, SLOT(toggleTriangulation()), "Switch between surface, wireframe and point cloud", "T"); newMenuItem(v3, "Follow &Camera", glviewer, SLOT(toggleFollowMode(bool)), "Always use viewpoint of last frame (except zoom)", true, "Shift+F"); newMenuItem(v3, "Show Grid", glviewer, SLOT(toggleShowGrid(bool)), "Display XY plane grid", false); newMenuItem(v3, "Show Pose TFs", glviewer, SLOT(toggleShowTFs(bool)), "Display pose transformations at axes", false); newMenuItem(v3, "Show Pose IDs", glviewer, SLOT(toggleShowIDs(bool)), "Display pose ids at axes", false, "I"); newMenuItem(v3, "Show &Poses of Graph", glviewer, SLOT(toggleShowPoses(bool)), "Display poses as axes", ParameterServer::instance()->get<bool>("show_axis"), "P"); newMenuItem(v3, "Show &Edges of Graph", glviewer, SLOT(toggleShowEdges(bool)), "Display edges of pose graph as lines", ParameterServer::instance()->get<bool>("show_axis"), "E"); newMenuItem(v3, "Stere&o View", glviewer, SLOT(toggleStereo(bool)), "Split screen view with slightly shifted Camera", false); newMenuItem(v3, "Show &Feature Locations", glviewer, SLOT(toggleShowFeatures(bool)), "Toggle whether feature locations should be rendered", false); newMenuItem(v3, "Show &Octomap", glviewer, SLOT(toggleShowOctoMap(bool)), "Toggle whether octomap should be displayed", true, "Ctrl+Shift+O"); newMenuItem(v3, "Show &Clouds", glviewer, SLOT(toggleShowClouds(bool)), "Toggle whether point clouds should be rendered", true, "C"); newMenuItem(v3, "Toggle Background", glviewer, SLOT(toggleBackgroundColor(bool)), "Toggle whether background should be white or black", true, "B"); newMenuItem(v3, "Set Rotation &Grid", this, SLOT(setRotationGrid()), "Discretize Rotation in Viewer", "G"); newMenuItem(v3, "Set Stereo Offset", this, SLOT(setStereoShift()), "Set the distance between the virtual cameras for stereo view", "<"); }
QAction* Graphical_UI::createSaveMenu() {//octomap Menu QMenu* sm = menuBar()->addMenu(tr("&Save")); newMenuItem(sm, "&Save", SLOT(quickSaveAll()), "Save all stored point clouds with common coordinate frame to a pcd file", QKeySequence::Save, QIcon::fromTheme("document-save")); newMenuItem(sm, "Save &Feature Map...", SLOT(saveFeatures()), "Save all feature positions and descriptions in a common coordinate frame to a yaml or xml file", "Ctrl+F", QIcon::fromTheme("document-save")); QAction* oa = newMenuItem(sm, "Save Octomap...", SLOT(saveOctomap()), "Save computed OctoMap", "", QIcon::fromTheme("document-save-as")); newMenuItem(sm, "&Save as Point Cloud ...", SLOT(saveAll()), "Save all stored point clouds with common coordinate frame", QKeySequence::SaveAs, QIcon::fromTheme("document-save-as")); newMenuItem(sm, "&Save Point Cloud Node-Wise...", SLOT(saveIndividual()), "Save stored point clouds in individual files", "Ctrl+N", QIcon::fromTheme("document-save-all")); newMenuItem(sm, "Save &G2O Graph...", SLOT(saveG2OGraphDialog()), "Save G2O graph (e.g. for use with the g2o viewer or external optimization)", "", QIcon::fromTheme("document-save")); newMenuItem(sm, "Save Clouds to &Bag...", SLOT(saveBagDialog()), "Save clouds and transforms to bagfile", "Ctrl+Shift+B"); newMenuItem(sm, "Save Trajectory &Estimate...", SLOT(saveTrajectoryDialog()), "Save trajectory estimate (and ground truth trajectory if available) for external evaluation.", "Ctrl+E"); sm->addSeparator(); newMenuItem(sm, "&Send Model", SLOT(sendAll()), "Send out all stored point clouds with corrected transform", "Ctrl+M", QIcon::fromTheme("document-send")); sm->addSeparator(); newMenuItem(sm, "Save &3D as PDF File...", SLOT(saveVectorGraphic()), "Write 3D Scene to a PDF File. Warning: Meant for Pose Graphs not for the clouds or octomaps!", "", QIcon::fromTheme("application-pdf")); newMenuItem(sm, "Save Input &Images to Files...", SLOT(saveAllImages()), "Write All images shown in the gui to appropriate files", "", QIcon::fromTheme("image-x-generic")); newMenuItem(sm, "Capture Screencast...", this, SLOT(toggleScreencast(bool)), "Dump Screen as Video", !ParameterServer::instance()->get<std::string>("screencast_path_prefix").empty()); return oa; }