g2o
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 36 of file run_g2o_viewer.h.

Member Function Documentation

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

Definition at line 52 of file run_g2o_viewer.cpp.

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

53 {
54  std::string inputFilename;
55  arg.paramLeftOver("graph-input", inputFilename, "", "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 viewer
64  StreamRedirect redirect(std::cerr, mw.plainTextEdit);
65 
66  // setting up the optimizer
67  SparseOptimizer* optimizer = new SparseOptimizer();
68  mw.viewer->graph = optimizer;
69 
70  // set up the GUI action
71  GuiHyperGraphAction guiHyperGraphAction;
72  guiHyperGraphAction.viewer = mw.viewer;
73  //optimizer->addPostIterationAction(&guiHyperGraphAction);
74  optimizer->addPreIterationAction(&guiHyperGraphAction);
75 
76  if (inputFilename.size() > 0) {
77  mw.loadFromFile(QString::fromStdString(inputFilename));
78  }
79 
80  QCoreApplication* myapp = QApplication::instance();
81  while (mw.isVisible()) {
82  guiHyperGraphAction.dumpScreenshots = mw.actionDump_Images->isChecked();
83  if (myapp)
84  myapp->processEvents();
85  SleepThread::msleep(10);
86  }
87 
88  delete optimizer;
89  return 0;
90 }
void updateRobustKernels()
bool loadFromFile(const QString &filename)
void updateDisplayedSolvers()
redirect a stream to a QPlainTextEdit
class G2O_CORE_API SparseOptimizer
main window of the g2o viewer
Definition: main_window.h:40

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