glviewer.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2013, Intelligent Robotics Lab, DLUT.
00005  *  Author: Qinghua Li, Yan Zhuang, Fei Yan
00006  *
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of Intelligent Robotics Lab, DLUT. nor the names
00020  *     of its contributors may be used to endorse or promote products
00021  *     derived from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  */
00036 
00037 /*
00038  * glviewer.h
00039  *
00040  *  Created on: 2012.01.07
00041  *      Author: Qinghua Li (qinghua__li@163.com)
00042  */
00043 
00044 #ifndef GLVIEWER_H_
00045 #define GLVIEWER_H_
00046 
00047 #include <QGLWidget>
00048 #include <pcl/point_types.h>
00049 
00050 // OpenGL based display of the 3D point cloud
00051 class GLViewer : public QGLWidget
00052 {
00053   public:
00054     GLViewer (std::vector< std::vector<pcl::PointXYZ> > &points, int flag, QWidget *parent = 0);
00055     ~GLViewer ();
00056 
00057     QSize minimumSizeHint () const;
00058     QSize sizeHint () const;
00059 
00060     void reset ();
00061 
00062   protected:
00063     void setXRotation (int angle);
00064     void setYRotation (int angle);
00065     void setZRotation (int angle);
00066 
00067     void initializeGL ();
00068     void paintGL ();
00069     void resizeGL (int width, int height);
00070 
00071     // Draw colored axis, scale long
00072     void drawAxis (float scale);
00073     // Draw the scene
00074     void drawPointCloud ();
00075 
00076     void wheelEvent (QWheelEvent *event);
00077     void mousePressEvent (QMouseEvent *event);
00078     void mouseMoveEvent (QMouseEvent *event);
00079 
00080     void keyPressEvent (QKeyEvent *e);
00081 
00082   private:
00083     int label;
00084     float bg_color[4];
00085     int xRot, yRot, zRot;
00086     float xTra, yTra, zTra;
00087 
00088     int width_, height_;
00089     double fov_;   /* Field of view */
00090     double rotation_step_, translation_step_;
00091 
00092     QPoint lastPos;
00093     bool show_axis_;
00094     std::vector< std::vector<pcl::PointXYZ> > &point_cloud;
00095 };
00096 
00097 #endif // GLVIEWER_H_


dlut_place_recognition
Author(s): Qinghua Li, Yan Zhuang, Fei Yan
autogenerated on Sun Oct 5 2014 23:29:57