1 /************************************************************************************* 2 * Copyright (C) 2010-2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com> * 3 * Copyright (C) 2007 by Abderrahman Taha: Basic OpenGL calls like scene, lights * 4 * and mouse behaviour taken from K3DSurf * 5 * * 6 * This program is free software; you can redistribute it and/or * 7 * modify it under the terms of the GNU General Public License * 8 * as published by the Free Software Foundation; either version 2 * 9 * of the License, or (at your option) any later version. * 10 * * 11 * This program 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 this program; if not, write to the Free Software * 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 19 *************************************************************************************/ 20 21 #ifndef PLOTSVIEW3DES_H 22 #define PLOTSVIEW3DES_H 23 24 #include <QOpenGLWidget> 25 #include <QMouseEvent> 26 27 #include <QModelIndex> 28 #include "analitzawidgets_export.h" 29 #include <analitzaplot/plotter3d_es.h> 30 31 class QItemSelectionModel; 32 33 namespace Analitza 34 { 35 36 /** 37 * \class PlotsView3DES 38 * 39 * \ingroup AnalitzaGUIModule 40 * 41 * \brief Widget that allows visualization of 3D plots. 42 * 43 * This class lets you create a widget that can draw multiple 3D graphs. This widget 44 * use Plotter3D and OpenGL as a backend. 45 */ 46 47 class ANALITZAWIDGETS_EXPORT PlotsView3DES : public QOpenGLWidget, public Plotter3DES 48 { 49 Q_OBJECT 50 51 public: 52 explicit PlotsView3DES(QWidget* parent = nullptr); 53 ~PlotsView3DES() override; 54 55 void setSelectionModel(QItemSelectionModel* selection); 56 57 private Q_SLOTS: 58 void updateFuncs(const QModelIndex &indexf,const QModelIndex &indext); 59 void addFuncs(const QModelIndex &index,int,int); 60 void removeFuncs(const QModelIndex &index,int,int); 61 62 private: currentPlot()63 virtual int currentPlot() const override { return -1 ;} 64 virtual void modelChanged() override; 65 virtual void renderGL() override; 66 67 virtual void keyPressEvent(QKeyEvent*) override; 68 69 virtual void wheelEvent(QWheelEvent* ev) override; 70 virtual void mousePressEvent(QMouseEvent *event) override; 71 virtual void mouseMoveEvent(QMouseEvent *event) override; 72 73 virtual void paintGL() override; 74 virtual void initializeGL() override; 75 virtual void resizeGL(int width, int height) override; 76 QImage grabImage() override; 77 78 QItemSelectionModel* m_selection; 79 80 Qt::MouseButtons buttons; 81 double old_x, old_y; 82 }; 83 84 } 85 86 #endif 87