qgl_graph_viewer.cpp
Go to the documentation of this file.
00001 // HOG-Man - Hierarchical Optimization for Pose Graphs on Manifolds
00002 // Copyright (C) 2010 G. Grisetti, R. Kümmerle, C. Stachniss
00003 //
00004 // This file is part of HOG-Man.
00005 // 
00006 // HOG-Man 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 // HOG-Man 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 HOG-Man.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 #include "qgl_graph_viewer.h"
00020 
00021 #include "standard_camera.h"
00022 
00023 namespace AISNavigation {
00024 
00025 QGLGraphViewer::QGLGraphViewer(QWidget* parent, const QGLWidget* shareWidget, Qt::WFlags flags) :
00026   QGLViewer(parent, shareWidget, flags)
00027 {
00028 }
00029 
00030 QGLGraphViewer::~QGLGraphViewer()
00031 {
00032 }
00033 
00034 void QGLGraphViewer::draw()
00035 {
00036   glPushMatrix();
00037   graph.draw();
00038   glPopMatrix();
00039 }
00040 
00041 void QGLGraphViewer::init()
00042 {
00043   QGLViewer::init();
00044 
00045   // some default settings i like
00046   glEnable(GL_LINE_SMOOTH);
00047   glEnable(GL_BLEND); 
00048   glEnable(GL_DEPTH_TEST);
00049   glShadeModel(GL_SMOOTH);
00050   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00051 
00052   setAxisIsDrawn();
00053 
00054   // don't save state
00055   setStateFileName(QString::null);
00056 
00057   // mouse bindings
00058   setMouseBinding(Qt::RightButton, CAMERA, ZOOM);
00059   setMouseBinding(Qt::MidButton, CAMERA, TRANSLATE);
00060 
00061   // keyboard shortcuts
00062   setShortcut(CAMERA_MODE, 0);
00063   setShortcut(EXIT_VIEWER, 0);
00064   //setShortcut(SAVE_SCREENSHOT, 0);
00065 
00066   // replace camera
00067   qglviewer::Camera* oldcam = camera();
00068   qglviewer::Camera* cam = new StandardCamera();
00069   cam->setPosition(qglviewer::Vec(0., 0., 75.));
00070   cam->setUpVector(qglviewer::Vec(0., 1., 0.));
00071   cam->lookAt(qglviewer::Vec(0., 0., 0.));
00072   setCamera(cam);
00073   delete oldcam;
00074 }
00075 
00076 } // end namespace


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Mon Oct 6 2014 00:06:59