QGLMap.h
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2014, Southwest Research Institute® (SwRI®)
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
00008 //     * Redistributions of source code must retain the above copyright
00009 //       notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above copyright
00011 //       notice, this list of conditions and the following disclaimer in the
00012 //       documentation and/or other materials provided with the distribution.
00013 //     * Neither the name of Southwest Research Institute® (SwRI®) nor the
00014 //       names of its contributors may be used to endorse or promote products
00015 //       derived from this software without specific prior written permission.
00016 //
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020 // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //
00028 // *****************************************************************************
00029 
00030 #ifndef MULTIRES_IMAGE_QGLMAP_H_
00031 #define MULTIRES_IMAGE_QGLMAP_H_
00032 
00033 // QT libraries
00034 #include <QGLWidget>
00035 #include <QMouseEvent>
00036 #include <QWheelEvent>
00037 
00038 // QT auto-generated headers
00039 #include "ui_QGLMap.h"
00040 
00041 #include <tf/transform_datatypes.h>
00042 
00043 #include <multires_image/tile.h>
00044 #include <multires_image/tile_view.h>
00045 
00046 namespace multires_image
00047 {
00048   class QGLMap : public QGLWidget
00049   {
00050     Q_OBJECT
00051 
00052   public:
00053     explicit QGLMap(QWidget *parent = 0);
00054     ~QGLMap();
00055 
00056     void Exit();
00057     void UpdateView();
00058     void SetTiles(TileSet* tiles);
00059 
00060     tf::Point SceneCenter() { return m_scene_center; }
00061     tf::Point ViewCenter() { return m_view_center; }
00062 
00063   signals:
00064     void SignalZoomChange(double z);
00065     void SignalViewChange(double x1, double y1, double x2, double y2);
00066     void SignalMemorySize(int64_t bytes);
00067 
00068   public slots:
00069     void LoadTexture(Tile* tile);
00070     void DeleteTexture(Tile* tile);
00071     void ChangeCenter(double x, double y);
00072     void SetTextureMemory(int64_t bytes);
00073 
00074   protected:
00075     void initializeGL();
00076     void resizeGL(int w, int h);
00077     void paintGL();
00078     void mousePressEvent(QMouseEvent* e);
00079     void mouseDoubleClickEvent(QMouseEvent* e);
00080     void mouseReleaseEvent(QMouseEvent* e);
00081     void mouseMoveEvent(QMouseEvent* e);
00082     void wheelEvent(QWheelEvent* e);
00083 
00084   private:
00085     Ui::QGLMapClass ui;
00086 
00087     bool            m_initialized;
00088 
00089     double          m_scale;
00090 
00091     bool            m_mouseDown;
00092     int             m_mouseDownX;
00093     int             m_mouseDownY;
00094 
00095     TileView*       m_tileView;
00096 
00097     tf::Point m_view_top_left;
00098     tf::Point m_view_bottom_right;
00099     tf::Point m_view_center;
00100 
00101     tf::Point m_scene_top_left;
00102     tf::Point m_scene_bottom_right;
00103     tf::Point m_scene_center;
00104 
00105     void Recenter();
00106     void MousePan(int x, int y);
00107   };
00108 }
00109 
00110 #endif  // MULTIRES_IMAGE_QGLMAP_H_


multires_image
Author(s): Marc Alban
autogenerated on Thu Aug 24 2017 02:46:18