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 PLOTSVIEW3D_H |
22 | #define PLOTSVIEW3D_H |
23 | |
24 | #ifdef _WIN32 |
25 | #include <GL/glew.h> |
26 | #endif |
27 | |
28 | #include <QGLWidget> |
29 | #include <QMouseEvent> |
30 | |
31 | #include <QModelIndex> |
32 | #include "analitzaguiexport.h" |
33 | #include <analitzaplot/plotter3d.h> |
34 | |
35 | class QItemSelectionModel; |
36 | |
37 | namespace Analitza |
38 | { |
39 | class Surface; |
40 | class PlotItem; |
41 | |
42 | /** |
43 | * \class PlotsView3D |
44 | * |
45 | * \ingroup AnalitzaGUIModule |
46 | * |
47 | * \brief Widget that allows visualization of 3D plots. |
48 | * |
49 | * This class lets you create a widget that can draw multiple 3D graphs. This widget |
50 | * use Plotter3D and OpenGL as a backend. |
51 | */ |
52 | |
53 | class ANALITZAGUI_EXPORT PlotsView3D : public QGLWidget, public Plotter3D |
54 | { |
55 | Q_OBJECT |
56 | |
57 | public: |
58 | PlotsView3D(QWidget* parent = 0); |
59 | virtual ~PlotsView3D(); |
60 | |
61 | void setSelectionModel(QItemSelectionModel* selection); |
62 | |
63 | public slots: |
64 | void resetView(); |
65 | |
66 | private slots: |
67 | void updateFuncs(const QModelIndex &indexf,const QModelIndex &indext); |
68 | void addFuncs(const QModelIndex &index,int,int); |
69 | void removeFuncs(const QModelIndex &index,int,int); |
70 | |
71 | private: |
72 | virtual int currentPlot() const { return -1 ;} |
73 | virtual void modelChanged(); |
74 | virtual void renderGL(); |
75 | |
76 | virtual void keyPressEvent(QKeyEvent*); |
77 | |
78 | virtual void wheelEvent(QWheelEvent* ev); |
79 | virtual void mousePressEvent(QMouseEvent *event); |
80 | virtual void mouseMoveEvent(QMouseEvent *event); |
81 | |
82 | virtual void paintGL(); |
83 | virtual void initializeGL(); |
84 | virtual void resizeGL(int width, int height); |
85 | |
86 | QItemSelectionModel* m_selection; |
87 | |
88 | Qt::MouseButtons buttons; |
89 | double old_x, old_y; |
90 | }; |
91 | |
92 | } |
93 | |
94 | #endif |
95 | |