| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Data Visualization module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 or (at your option) any later version |
| 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
| 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
| 22 | ** included in the packaging of this file. Please review the following |
| 23 | ** information to ensure the GNU General Public License requirements will |
| 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 25 | ** |
| 26 | ** $QT_END_LICENSE$ |
| 27 | ** |
| 28 | ****************************************************************************/ |
| 29 | |
| 30 | #ifndef DATA_H |
| 31 | #define DATA_H |
| 32 | |
| 33 | #include <QtDataVisualization/Q3DScatter> |
| 34 | #include <QtDataVisualization/Q3DBars> |
| 35 | #include <QtDataVisualization/Q3DSurface> |
| 36 | #include <QtDataVisualization/QScatterDataProxy> |
| 37 | #include <QtDataVisualization/QBarDataProxy> |
| 38 | #include <QtDataVisualization/QHeightMapSurfaceDataProxy> |
| 39 | #include <QTextEdit> |
| 40 | |
| 41 | using namespace QtDataVisualization; |
| 42 | |
| 43 | class Data : public QObject |
| 44 | { |
| 45 | Q_OBJECT |
| 46 | |
| 47 | public: |
| 48 | explicit Data(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars, |
| 49 | QTextEdit *statusLabel, QWidget *widget); |
| 50 | ~Data(); |
| 51 | |
| 52 | void start(); |
| 53 | void stop(); |
| 54 | |
| 55 | void updateData(); |
| 56 | void clearData(); |
| 57 | |
| 58 | void scrollDown(); |
| 59 | void setData(const QImage &image); |
| 60 | void useGradientOne(); |
| 61 | void useGradientTwo(); |
| 62 | |
| 63 | public: |
| 64 | enum VisualizationMode { |
| 65 | Surface = 0, |
| 66 | Scatter, |
| 67 | Bars |
| 68 | }; |
| 69 | |
| 70 | public Q_SLOTS: |
| 71 | void setResolution(int selection); |
| 72 | void changeMode(int mode); |
| 73 | |
| 74 | private: |
| 75 | Q3DSurface *m_surface; |
| 76 | Q3DScatter *m_scatter; |
| 77 | Q3DBars *m_bars; |
| 78 | QTextEdit *m_statusArea; |
| 79 | QWidget *m_widget; |
| 80 | bool m_resize; |
| 81 | QSize m_resolution; |
| 82 | int m_resolutionLevel; |
| 83 | VisualizationMode m_mode; |
| 84 | QScatterDataArray *m_scatterDataArray; |
| 85 | QBarDataArray *m_barDataArray; |
| 86 | bool m_started; |
| 87 | }; |
| 88 | |
| 89 | class ContainerChanger : public QObject |
| 90 | { |
| 91 | Q_OBJECT |
| 92 | |
| 93 | public: |
| 94 | explicit ContainerChanger(QWidget *surface, QWidget *scatter, QWidget *bars, |
| 95 | QWidget *buttonOne, QWidget *buttonTwo); |
| 96 | ~ContainerChanger(); |
| 97 | |
| 98 | public Q_SLOTS: |
| 99 | void changeContainer(int container); |
| 100 | |
| 101 | private: |
| 102 | QWidget *m_surface; |
| 103 | QWidget *m_scatter; |
| 104 | QWidget *m_bars; |
| 105 | QWidget *m_button1; |
| 106 | QWidget *m_button2; |
| 107 | }; |
| 108 | |
| 109 | #endif |
| 110 | |