File indexing completed on 2024-04-14 14:07:56
0001 /************************************************************************************* 0002 * Copyright (C) 2010-2012 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com> * 0003 * Copyright (C) 2007 by Abderrahman Taha: Basic OpenGL calls like scene, lights * 0004 * and mouse behaviour taken from K3DSurf * 0005 * * 0006 * This program is free software; you can redistribute it and/or * 0007 * modify it under the terms of the GNU General Public License * 0008 * as published by the Free Software Foundation; either version 2 * 0009 * of the License, or (at your option) any later version. * 0010 * * 0011 * This program is distributed in the hope that it will be useful, * 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0014 * GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License * 0017 * along with this program; if not, write to the Free Software * 0018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 0019 *************************************************************************************/ 0020 0021 #ifndef PLOTSVIEW3DES_H 0022 #define PLOTSVIEW3DES_H 0023 0024 #include <QOpenGLWidget> 0025 #include <QMouseEvent> 0026 0027 #include <QModelIndex> 0028 #include "analitzawidgets_export.h" 0029 #include <analitzaplot/plotter3d_es.h> 0030 0031 class QItemSelectionModel; 0032 0033 namespace Analitza 0034 { 0035 0036 /** 0037 * \class PlotsView3DES 0038 * 0039 * \ingroup AnalitzaGUIModule 0040 * 0041 * \brief Widget that allows visualization of 3D plots. 0042 * 0043 * This class lets you create a widget that can draw multiple 3D graphs. This widget 0044 * use Plotter3D and OpenGL as a backend. 0045 */ 0046 0047 class ANALITZAWIDGETS_EXPORT PlotsView3DES : public QOpenGLWidget, public Plotter3DES 0048 { 0049 Q_OBJECT 0050 0051 public: 0052 explicit PlotsView3DES(QWidget* parent = nullptr); 0053 ~PlotsView3DES() override; 0054 0055 void setSelectionModel(QItemSelectionModel* selection); 0056 0057 private Q_SLOTS: 0058 void updateFuncs(const QModelIndex &indexf,const QModelIndex &indext); 0059 void addFuncs(const QModelIndex &index,int,int); 0060 void removeFuncs(const QModelIndex &index,int,int); 0061 0062 private: 0063 virtual int currentPlot() const override { return -1 ;} 0064 virtual void modelChanged() override; 0065 virtual void renderGL() override; 0066 0067 virtual void keyPressEvent(QKeyEvent*) override; 0068 0069 virtual void wheelEvent(QWheelEvent* ev) override; 0070 virtual void mousePressEvent(QMouseEvent *event) override; 0071 virtual void mouseMoveEvent(QMouseEvent *event) override; 0072 0073 virtual void paintGL() override; 0074 virtual void initializeGL() override; 0075 virtual void resizeGL(int width, int height) override; 0076 QImage grabImage() override; 0077 0078 QItemSelectionModel* m_selection; 0079 0080 Qt::MouseButtons buttons; 0081 double old_x, old_y; 0082 }; 0083 0084 } 0085 0086 #endif