| 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 SCATTERDATAMODIFIER_H |
| 31 | #define SCATTERDATAMODIFIER_H |
| 32 | |
| 33 | #include <QtDataVisualization/q3dscatter.h> |
| 34 | #include <QtDataVisualization/qscatter3dseries.h> |
| 35 | |
| 36 | #include <QFont> |
| 37 | #include <QDebug> |
| 38 | #include <QTimer> |
| 39 | #include <QLabel> |
| 40 | |
| 41 | using namespace QtDataVisualization; |
| 42 | |
| 43 | class ScatterDataModifier : public QObject |
| 44 | { |
| 45 | Q_OBJECT |
| 46 | public: |
| 47 | explicit ScatterDataModifier(Q3DScatter *scatter); |
| 48 | ~ScatterDataModifier(); |
| 49 | |
| 50 | void addData(); |
| 51 | void changeStyle(); |
| 52 | void changePresetCamera(); |
| 53 | void changeTheme(); |
| 54 | void changeLabelStyle(); |
| 55 | void changeFont(const QFont &font); |
| 56 | void changeFontSize(int fontSize); |
| 57 | void changePointSize(int pointSize); |
| 58 | void setBackgroundEnabled(int enabled); |
| 59 | void setGridEnabled(int enabled); |
| 60 | void setMinX(int min); |
| 61 | void setMinY(int min); |
| 62 | void setMinZ(int min); |
| 63 | void setMaxX(int max); |
| 64 | void setMaxY(int max); |
| 65 | void setMaxZ(int max); |
| 66 | void setAspectRatio(int ratio); |
| 67 | void setHorizontalAspectRatio(int ratio); |
| 68 | void start(); |
| 69 | void massiveDataTest(); |
| 70 | void massiveTestScroll(); |
| 71 | void massiveTestAppendAndScroll(); |
| 72 | void setFpsMeasurement(bool enable); |
| 73 | void setFpsLabel(QLabel *fpsLabel) { m_fpsLabel = fpsLabel; } |
| 74 | void testItemChanges(); |
| 75 | void testAxisReverse(); |
| 76 | |
| 77 | public Q_SLOTS: |
| 78 | void changeShadowQuality(int quality); |
| 79 | void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality); |
| 80 | void clear(); |
| 81 | void resetAxes(); |
| 82 | void addOne(); |
| 83 | void addBunch(); |
| 84 | void insertOne(); |
| 85 | void insertBunch(); |
| 86 | void changeOne(); |
| 87 | void changeBunch(); |
| 88 | void removeOne(); |
| 89 | void removeBunch(); |
| 90 | void timeout(); |
| 91 | void startStopTimer(); |
| 92 | void selectItem(); |
| 93 | void handleSelectionChange(int index); |
| 94 | void setGradient(); |
| 95 | void clearSeriesData(); |
| 96 | void addSeries(); |
| 97 | void removeSeries(); |
| 98 | void toggleSeriesVisibility(); |
| 99 | void changeSeriesName(); |
| 100 | void handleAxisXChanged(QValue3DAxis *axis); |
| 101 | void handleAxisYChanged(QValue3DAxis *axis); |
| 102 | void handleAxisZChanged(QValue3DAxis *axis); |
| 103 | void handleFpsChange(qreal fps); |
| 104 | void changeLabelRotation(int rotation); |
| 105 | void changeRadialLabelOffset(int offset); |
| 106 | void toggleAxisTitleVisibility(bool enabled); |
| 107 | void toggleAxisTitleFixed(bool enabled); |
| 108 | void renderToImage(); |
| 109 | void togglePolar(bool enable); |
| 110 | void toggleStatic(bool enable); |
| 111 | void toggleOrtho(bool enable); |
| 112 | void setCameraTargetX(int value); |
| 113 | void setCameraTargetY(int value); |
| 114 | void setCameraTargetZ(int value); |
| 115 | void setGraphMargin(int value); |
| 116 | |
| 117 | Q_SIGNALS: |
| 118 | void shadowQualityChanged(int quality); |
| 119 | |
| 120 | private: |
| 121 | QVector3D randVector(); |
| 122 | QScatter3DSeries *createAndAddSeries(); |
| 123 | void populateFlatSeries(QScatter3DSeries *series, int rows, int columns, float value); |
| 124 | void populateRisingSeries(QScatter3DSeries *series, int rows, int columns, float minValue, |
| 125 | float maxValue); |
| 126 | void deleteAxis(QValue3DAxis *axis); |
| 127 | |
| 128 | Q3DScatter *m_chart; |
| 129 | int m_fontSize; |
| 130 | QTimer m_timer; |
| 131 | int m_loopCounter; |
| 132 | int m_selectedItem; |
| 133 | QScatter3DSeries *m_targetSeries; |
| 134 | QScatterDataArray m_massiveTestCacheArray; |
| 135 | QLabel *m_fpsLabel; |
| 136 | QVector3D m_cameraTarget; |
| 137 | |
| 138 | }; |
| 139 | |
| 140 | #endif |
| 141 | |