gui_hyper_graph_action.cpp
Go to the documentation of this file.
00001 // g2o - General Graph Optimization
00002 // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
00003 //
00004 // This file is part of g2o.
00005 // 
00006 // g2o is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // (at your option) any later version.
00010 // 
00011 // g2o is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU General Public License
00017 // along with g2o.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 #include "gui_hyper_graph_action.h"
00020 
00021 #include "g2o_qglviewer.h"
00022 
00023 #include <QApplication>
00024 
00025 namespace g2o {
00026 
00027 GuiHyperGraphAction::GuiHyperGraphAction() :
00028   HyperGraphAction(),
00029   viewer(0), dumpScreenshots(false)
00030 {
00031 }
00032 
00033 GuiHyperGraphAction::~GuiHyperGraphAction()
00034 {
00035 }
00036 
00037 HyperGraphAction* GuiHyperGraphAction::operator()(const HyperGraph* graph, Parameters* parameters)
00038 {
00039   (void) graph;
00040   if (viewer) {
00041     viewer->setUpdateDisplay(true);
00042     viewer->updateGL();
00043 
00044     if (dumpScreenshots) {
00045       ParametersIteration* p = dynamic_cast<ParametersIteration*>(parameters);
00046       if (p) {
00047         viewer->setSnapshotFormat(QString("PNG"));
00048         viewer->setSnapshotQuality(-1);
00049         viewer->saveSnapshot(QString().sprintf("g2o%.6d.png", p->iteration), true);
00050       }
00051     }
00052 
00053     qApp->processEvents();
00054     return this;
00055   }
00056   return 0;
00057 }
00058 
00059 } // end namespace


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:31:17