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 GRAPHMODIFIER_H
31 #define GRAPHMODIFIER_H
32 
33 #include <QtDataVisualization/q3dbars.h>
34 #include <QtDataVisualization/qbardataproxy.h>
35 #include <QtDataVisualization/qabstract3dseries.h>
36 
37 #include <QtGui/QFont>
38 #include <QtCore/QDebug>
39 #include <QtCore/QStringList>
40 #include <QtCore/QPointer>
41 #include <QtCore/QPropertyAnimation>
42 
43 using namespace QtDataVisualization;
44 
45 class GraphModifier : public QObject
46 {
47     Q_OBJECT
48 public:
49     explicit GraphModifier(Q3DBars *bargraph);
50     ~GraphModifier();
51 
52     void resetTemperatureData();
53     void changePresetCamera();
54     void changeLabelBackground();
55     void changeFont(const QFont &font);
56     void changeFontSize(int fontsize);
57     void rotateX(int rotation);
58     void rotateY(int rotation);
59     void setBackgroundEnabled(int enabled);
60     void setGridEnabled(int enabled);
61     void setSmoothBars(int smooth);
62     void setSeriesVisibility(int enabled);
63     void setReverseValueAxis(int enabled);
64     void setReflection(bool enabled);
65 
66 public Q_SLOTS:
67     void changeRange(int range);
68     void changeStyle(int style);
69     void changeSelectionMode(int selectionMode);
70     void changeTheme(int theme);
71     void changeShadowQuality(int quality);
72     void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality);
73     void changeLabelRotation(int rotation);
74     void setAxisTitleVisibility(bool enabled);
75     void setAxisTitleFixed(bool enabled);
76     void zoomToSelectedBar();
77 
78 Q_SIGNALS:
79     void shadowQualityChanged(int quality);
80     void backgroundEnabledChanged(bool enabled);
81     void gridEnabledChanged(bool enabled);
82     void fontChanged(QFont font);
83     void fontSizeChanged(int size);
84 
85 private:
86     Q3DBars *m_graph;
87     float m_xRotation;
88     float m_yRotation;
89     int m_fontSize;
90     int m_segments;
91     int m_subSegments;
92     float m_minval;
93     float m_maxval;
94     QStringList m_months;
95     QStringList m_years;
96     QValue3DAxis *m_temperatureAxis;
97     QCategory3DAxis *m_yearAxis;
98     QCategory3DAxis *m_monthAxis;
99     QBar3DSeries *m_primarySeries;
100     QBar3DSeries *m_secondarySeries;
101     QAbstract3DSeries::Mesh m_barMesh;
102     bool m_smooth;
103     QPropertyAnimation m_animationCameraX;
104     QPropertyAnimation m_animationCameraY;
105     QPropertyAnimation m_animationCameraZoom;
106     QPropertyAnimation m_animationCameraTarget;
107     float m_defaultAngleX;
108     float m_defaultAngleY;
109     float m_defaultZoom;
110     QVector3D m_defaultTarget;
111 };
112 
113 #endif
114