g2o
gui_hyper_graph_action.cpp
Go to the documentation of this file.
1 // g2o - General Graph Optimization
2 // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
3 //
4 // This file is part of g2o.
5 //
6 // g2o is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // g2o is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with g2o. If not, see <http://www.gnu.org/licenses/>.
18 
19 #include "gui_hyper_graph_action.h"
20 
21 #include "g2o_qglviewer.h"
22 
23 #include <QApplication>
24 
25 namespace g2o {
26 
29  viewer(0), dumpScreenshots(false)
30 {
31 }
32 
34 {
35 }
36 
38 {
39  (void) graph;
40  if (viewer) {
41  viewer->setUpdateDisplay(true);
42  viewer->updateGL();
43 
44  if (dumpScreenshots) {
45  ParametersIteration* p = dynamic_cast<ParametersIteration*>(parameters);
46  if (p) {
47  viewer->setSnapshotFormat(QString("PNG"));
48  viewer->setSnapshotQuality(-1);
49  viewer->saveSnapshot(QString().sprintf("g2o%.6d.png", p->iteration), true);
50  }
51  }
52 
53  qApp->processEvents();
54  return this;
55  }
56  return 0;
57 }
58 
59 } // end namespace
void setUpdateDisplay(bool updateDisplay)
HyperGraphAction * operator()(const HyperGraph *graph, Parameters *parameters=0)
G2oQGLViewer * viewer
the viewer which visualizes the graph
Protocol The SLAM executable accepts such as solving the and retrieving or vertices in the graph
Definition: protocol.txt:7
Abstract action that operates on an entire graph.