g2o
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
g2o::RunG2OViewer Class Reference

wrapper for running the g2o viewer More...

#include <run_g2o_viewer.h>

Static Public Member Functions

static int run (int argc, char **argv, CommandArgs &arg)
 

Detailed Description

wrapper for running the g2o viewer

Definition at line 39 of file run_g2o_viewer.h.

Member Function Documentation

◆ run()

int g2o::RunG2OViewer::run ( int  argc,
char **  argv,
CommandArgs arg 
)
static

Definition at line 47 of file run_g2o_viewer.cpp.

47 {
48 std::string inputFilename;
49 std::string loadLookup;
50 arg.param("renameTypes", loadLookup, "",
51 "create a lookup for loading types into other types,\n\t "
52 "TAG_IN_FILE=INTERNAL_TAG_FOR_TYPE,TAG2=INTERNAL2\n\t e.g., "
53 "VERTEX_CAM=VERTEX_SE3:EXPMAP");
54 arg.paramLeftOver("graph-input", inputFilename, "",
55 "graph file which will be processed", true);
56 arg.parseArgs(argc, argv);
57
58 MainWindow mw;
61 mw.show();
62
63 // redirect the output that normally goes to cerr to the textedit in the
64 // viewer
65 StreamRedirect redirect(std::cerr, mw.plainTextEdit);
66
67 // setting up the optimizer
68 SparseOptimizer* optimizer = new SparseOptimizer();
69 // Loading the input data
70 if (loadLookup.size() > 0) {
71 optimizer->setRenamedTypesFromString(loadLookup);
72 }
73 mw.viewer->graph = optimizer;
74
75 // set up the GUI action
76 GuiHyperGraphAction guiHyperGraphAction;
77 guiHyperGraphAction.viewer = mw.viewer;
78 // optimizer->addPostIterationAction(&guiHyperGraphAction);
79 optimizer->addPreIterationAction(&guiHyperGraphAction);
80
81 if (inputFilename.size() > 0) {
82 mw.loadFromFile(QString::fromStdString(inputFilename));
83 }
84
85 QCoreApplication* myapp = QApplication::instance();
86 while (mw.isVisible()) {
87 guiHyperGraphAction.dumpScreenshots = mw.actionDump_Images->isChecked();
88 if (myapp) myapp->processEvents();
89 SleepThread::msleep(10);
90 }
91
92 delete optimizer;
93 return 0;
94}
main window of the g2o viewer
Definition main_window.h:40
void updateDisplayedSolvers()
bool loadFromFile(const QString &filename)
void updateRobustKernels()
redirect a stream to a QPlainTextEdit

References g2o::OptimizableGraph::addPreIterationAction(), g2o::GuiHyperGraphAction::dumpScreenshots, MainWindow::loadFromFile(), g2o::CommandArgs::param(), g2o::CommandArgs::paramLeftOver(), g2o::CommandArgs::parseArgs(), g2o::OptimizableGraph::setRenamedTypesFromString(), MainWindow::updateDisplayedSolvers(), MainWindow::updateRobustKernels(), and g2o::GuiHyperGraphAction::viewer.

Referenced by main().


The documentation for this class was generated from the following files: