Exemplo n.º 1
0
int RunG2OViewer::run(int argc, char** argv, CommandArgs& arg)
{
  std::string inputFilename;
  arg.paramLeftOver("graph-input", inputFilename, "", "graph file which will be processed", true);
  arg.parseArgs(argc, argv);

  MainWindow mw;
  mw.updateDisplayedSolvers();
  mw.updateRobustKernels();
  mw.show();

  // redirect the output that normally goes to cerr to the textedit in the viewer
  StreamRedirect redirect(std::cerr, mw.plainTextEdit);

  // setting up the optimizer
  SparseOptimizer* optimizer = new SparseOptimizer();
  mw.viewer->graph = optimizer;

  // set up the GUI action
  GuiHyperGraphAction guiHyperGraphAction;
  guiHyperGraphAction.viewer = mw.viewer;
  //optimizer->addPostIterationAction(&guiHyperGraphAction);
  optimizer->addPreIterationAction(&guiHyperGraphAction);

  if (inputFilename.size() > 0) {
    mw.loadFromFile(QString::fromLocal8Bit(inputFilename.c_str()));
  }

  QCoreApplication* myapp = QApplication::instance();
  while (mw.isVisible()) {
    guiHyperGraphAction.dumpScreenshots = mw.actionDump_Images->isChecked();
    if (myapp)
      myapp->processEvents();
    SleepThread::msleep(10);
  }

  delete optimizer;
  return 0;
}
Exemplo n.º 2
0
  SEXP qanviz_painter_test(SEXP r_op, SEXP r_opengl, SEXP r_antialias,
                           SEXP r_filled)
  {
    QWidget *test = NULL;
    bool antialias = asLogical(r_antialias);
    Operation op = (Operation)asInteger(r_op);
    bool filled = asLogical(r_filled);
    if (asLogical(r_opengl)) {
#ifdef QT_OPENGL_LIB
      test = new TestGLWidget(op, antialias, filled);
#else
      warning("No OpenGL support, skipping OpenGL benchmarks");
      return R_NilValue;
#endif
    }
    else test = new TestWidget(op, antialias, filled);
    test->show();
    QCoreApplication *app = QCoreApplication::instance();
    app->processEvents();
    test->repaint();
    test->repaint();
    delete test;
    return R_NilValue;
  }