File indexing completed on 2022-11-29 18:10:07

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 PLOTSVIEW3D_H
0022 #define PLOTSVIEW3D_H
0023 
0024 #include <QGLWidget>
0025 #include <QMouseEvent>
0026 
0027 #include <QModelIndex>
0028 #include "analitzawidgets_export.h"
0029 #include <analitzaplot/plotter3d.h>
0030 
0031 class QItemSelectionModel;
0032 
0033 namespace Analitza
0034 {
0035 
0036 /**
0037  * \class PlotsView3D
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_DEPRECATED_EXPORT PlotsView3D : public  QGLWidget, public Plotter3D
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052     explicit PlotsView3D(QWidget* parent = 0);
0053     virtual ~PlotsView3D();
0054 
0055     void setSelectionModel(QItemSelectionModel* selection);
0056 
0057 public Q_SLOTS:
0058     void resetView();
0059     
0060 private Q_SLOTS:
0061     void updateFuncs(const QModelIndex &indexf,const QModelIndex &indext);
0062     void addFuncs(const QModelIndex &index,int,int);
0063     void removeFuncs(const QModelIndex &index,int,int);
0064 
0065 private:
0066     virtual int currentPlot() const override { return -1 ;}
0067     virtual void modelChanged() override;
0068     virtual void renderGL() override;
0069 
0070     virtual void keyPressEvent(QKeyEvent*) override;
0071     
0072     virtual void wheelEvent(QWheelEvent* ev) override;
0073     virtual void mousePressEvent(QMouseEvent *event) override;
0074     virtual void mouseMoveEvent(QMouseEvent *event) override;
0075     
0076     virtual void paintGL() override;
0077     virtual void initializeGL() override;
0078     virtual void resizeGL(int width, int height) override;
0079     
0080     QItemSelectionModel* m_selection;
0081     
0082     Qt::MouseButtons buttons;
0083     double old_x, old_y;
0084 };
0085 
0086 }
0087 
0088 #endif