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 CHARTMODIFIER_H |
31 | #define CHARTMODIFIER_H |
32 | |
33 | #include <QtDataVisualization/q3dbars.h> |
34 | #include <QtDataVisualization/q3dinputhandler.h> |
35 | #include <QtDataVisualization/qbar3dseries.h> |
36 | #include <QtDataVisualization/q3dtheme.h> |
37 | #include <QFont> |
38 | #include <QDebug> |
39 | #include <QStringList> |
40 | #include <QPointer> |
41 | #include <QColorDialog> |
42 | #include <QTimer> |
43 | #include <QLabel> |
44 | |
45 | using namespace QtDataVisualization; |
46 | |
47 | class GraphModifier : public QObject |
48 | { |
49 | Q_OBJECT |
50 | public: |
51 | explicit GraphModifier(Q3DBars *barchart, QColorDialog *colorDialog); |
52 | ~GraphModifier(); |
53 | |
54 | void resetTemperatureData(); |
55 | void addRow(); |
56 | void addRows(); |
57 | void insertRow(); |
58 | void insertRows(); |
59 | void changeItem(); |
60 | void changeRow(); |
61 | void changeRows(); |
62 | void removeRow(); |
63 | void removeRows(); |
64 | void changeStyle(); |
65 | void changePresetCamera(); |
66 | void changeTheme(); |
67 | void changeLabelStyle(); |
68 | void changeSelectionMode(); |
69 | void changeFont(const QFont &font); |
70 | void changeFontSize(int fontsize); |
71 | void rotateX(int rotation); |
72 | void rotateY(int rotation); |
73 | void setFpsMeasurement(bool enable); |
74 | void setBackgroundEnabled(int enabled); |
75 | void setGridEnabled(int enabled); |
76 | void setSpecsRatio(int barwidth); |
77 | void setSpecsZ(int bardepth); |
78 | void setSpacingSpecsX(int spacing); |
79 | void setSpacingSpecsZ(int spacing); |
80 | void setSampleCountX(int samples); |
81 | void setSampleCountZ(int samples); |
82 | void setMinX(int min); |
83 | void setMinZ(int min); |
84 | void setMinY(int min); |
85 | void setMaxY(int max); |
86 | void start(); |
87 | void restart(bool dynamicData); |
88 | void selectBar(); |
89 | void swapAxis(); |
90 | void releaseAxes(); |
91 | void releaseSeries(); |
92 | void createMassiveArray(); |
93 | void useOwnTheme(); |
94 | void changeBaseColor(const QColor &color); |
95 | void changeColorStyle(); |
96 | void showFiveSeries(); |
97 | QBarDataArray *makeDummyData(); |
98 | void primarySeriesTest(); |
99 | void insertRemoveTestToggle(); |
100 | void toggleRotation(); |
101 | void useLogAxis(); |
102 | void changeValueAxisFormat(const QString & text); |
103 | void changeLogBase(const QString & text); |
104 | void setFpsLabel(QLabel *fpsLabel) { m_fpsLabel = fpsLabel; } |
105 | void addRemoveSeries(); |
106 | void testItemAndRowChanges(); |
107 | void reverseValueAxis(int enabled); |
108 | void setInputHandlerRotationEnabled(int enabled); |
109 | void setInputHandlerZoomEnabled(int enabled); |
110 | void setInputHandlerSelectionEnabled(int enabled); |
111 | void setInputHandlerZoomAtTargetEnabled(int enabled); |
112 | void setReflection(bool enabled); |
113 | void setReflectivity(int value); |
114 | void toggleCustomItem(); |
115 | |
116 | public Q_SLOTS: |
117 | void flipViews(); |
118 | void setGradient(); |
119 | void toggleMultiseriesScaling(); |
120 | void changeShadowQuality(int quality); |
121 | void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality); |
122 | void handleSelectionChange(const QPoint &position); |
123 | void setUseNullInputHandler(bool useNull); |
124 | void changeValueAxisSegments(int value); |
125 | |
126 | void handleRowAxisChanged(QCategory3DAxis *axis); |
127 | void handleColumnAxisChanged(QCategory3DAxis *axis); |
128 | void handleValueAxisChanged(QValue3DAxis *axis); |
129 | void handlePrimarySeriesChanged(QBar3DSeries *series); |
130 | |
131 | void insertRemoveTimerTimeout(); |
132 | void triggerSelection(); |
133 | void triggerRotation(); |
134 | void handleValueAxisLabelsChanged(); |
135 | void handleFpsChange(qreal fps); |
136 | void setCameraTargetX(int value); |
137 | void setCameraTargetY(int value); |
138 | void setCameraTargetZ(int value); |
139 | void setFloorLevel(int value); |
140 | void setGraphMargin(int value); |
141 | |
142 | Q_SIGNALS: |
143 | void shadowQualityChanged(int quality); |
144 | |
145 | private: |
146 | void populateFlatSeries(QBar3DSeries *series, int rows, int columns, float value); |
147 | QBarDataRow *createFlatRow(int columns, float value); |
148 | |
149 | Q3DBars *m_graph; |
150 | QColorDialog *m_colorDialog; |
151 | int m_columnCount; |
152 | int m_rowCount; |
153 | float m_xRotation; |
154 | float m_yRotation; |
155 | bool m_static; |
156 | float m_barSpacingX; |
157 | float m_barSpacingZ; |
158 | int m_fontSize; |
159 | int m_segments; |
160 | int m_subSegments; |
161 | float m_minval; |
162 | float m_maxval; |
163 | QStringList m_months; |
164 | QStringList m_years; |
165 | QPoint m_selectedBar; |
166 | QBar3DSeries *m_selectedSeries; |
167 | QValue3DAxis *m_autoAdjustingAxis; |
168 | QValue3DAxis *m_fixedRangeAxis; |
169 | QValue3DAxis *m_temperatureAxis; |
170 | QCategory3DAxis *m_yearAxis; |
171 | QCategory3DAxis *m_monthAxis; |
172 | QCategory3DAxis *m_genericRowAxis; |
173 | QCategory3DAxis *m_genericColumnAxis; |
174 | QBar3DSeries *m_temperatureData; |
175 | QBar3DSeries *m_temperatureData2; |
176 | QBar3DSeries *m_genericData; |
177 | QBar3DSeries *m_dummyData; |
178 | QBar3DSeries *m_dummyData2; |
179 | QBar3DSeries *m_dummyData3; |
180 | QBar3DSeries *m_dummyData4; |
181 | QBar3DSeries *m_dummyData5; |
182 | QValue3DAxis *m_currentAxis; |
183 | bool m_negativeValuesOn; |
184 | bool m_useNullInputHandler; |
185 | Q3DInputHandler *m_defaultInputHandler; |
186 | Q3DTheme *m_ownTheme; |
187 | Q3DTheme *m_builtinTheme; |
188 | QTimer m_insertRemoveTimer; |
189 | int m_insertRemoveStep; |
190 | QAbstract3DInputHandler *m_customInputHandler; |
191 | QTimer m_selectionTimer; |
192 | QTimer m_rotationTimer; |
193 | QLabel *m_fpsLabel; |
194 | QBar3DSeries *m_extraSeries; |
195 | QVector3D m_cameraTarget; |
196 | }; |
197 | |
198 | #endif |
199 |