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 QABSTRACT3DSERIES_H
31#define QABSTRACT3DSERIES_H
32
33#include <QtDataVisualization/q3dtheme.h>
34#include <QtCore/QObject>
35#include <QtCore/QScopedPointer>
36#include <QtCore/QString>
37#include <QtGui/QLinearGradient>
38#include <QtGui/QQuaternion>
39
40QT_BEGIN_NAMESPACE_DATAVISUALIZATION
41
42class QAbstract3DSeriesPrivate;
43
44class QT_DATAVISUALIZATION_EXPORT QAbstract3DSeries : public QObject
45{
46 Q_OBJECT
47 Q_ENUMS(SeriesType)
48 Q_ENUMS(Mesh)
49 Q_PROPERTY(SeriesType type READ type CONSTANT)
50 Q_PROPERTY(QString itemLabelFormat READ itemLabelFormat WRITE setItemLabelFormat NOTIFY itemLabelFormatChanged)
51 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibilityChanged)
52 Q_PROPERTY(Mesh mesh READ mesh WRITE setMesh NOTIFY meshChanged)
53 Q_PROPERTY(bool meshSmooth READ isMeshSmooth WRITE setMeshSmooth NOTIFY meshSmoothChanged)
54 Q_PROPERTY(QQuaternion meshRotation READ meshRotation WRITE setMeshRotation NOTIFY meshRotationChanged)
55 Q_PROPERTY(QString userDefinedMesh READ userDefinedMesh WRITE setUserDefinedMesh NOTIFY userDefinedMeshChanged)
56 Q_PROPERTY(QtDataVisualization::Q3DTheme::ColorStyle colorStyle READ colorStyle WRITE setColorStyle NOTIFY colorStyleChanged)
57 Q_PROPERTY(QColor baseColor READ baseColor WRITE setBaseColor NOTIFY baseColorChanged)
58 Q_PROPERTY(QLinearGradient baseGradient READ baseGradient WRITE setBaseGradient NOTIFY baseGradientChanged)
59 Q_PROPERTY(QColor singleHighlightColor READ singleHighlightColor WRITE setSingleHighlightColor NOTIFY singleHighlightColorChanged)
60 Q_PROPERTY(QLinearGradient singleHighlightGradient READ singleHighlightGradient WRITE setSingleHighlightGradient NOTIFY singleHighlightGradientChanged)
61 Q_PROPERTY(QColor multiHighlightColor READ multiHighlightColor WRITE setMultiHighlightColor NOTIFY multiHighlightColorChanged)
62 Q_PROPERTY(QLinearGradient multiHighlightGradient READ multiHighlightGradient WRITE setMultiHighlightGradient NOTIFY multiHighlightGradientChanged)
63 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
64 Q_PROPERTY(QString itemLabel READ itemLabel NOTIFY itemLabelChanged REVISION 1)
65 Q_PROPERTY(bool itemLabelVisible READ isItemLabelVisible WRITE setItemLabelVisible NOTIFY itemLabelVisibilityChanged REVISION 1)
66
67public:
68 enum SeriesType {
69 SeriesTypeNone = 0,
70 SeriesTypeBar = 1,
71 SeriesTypeScatter = 2,
72 SeriesTypeSurface = 4
73 };
74
75 enum Mesh {
76 MeshUserDefined = 0,
77 MeshBar,
78 MeshCube,
79 MeshPyramid,
80 MeshCone,
81 MeshCylinder,
82 MeshBevelBar,
83 MeshBevelCube,
84 MeshSphere,
85 MeshMinimal,
86 MeshArrow,
87 MeshPoint
88 };
89
90protected:
91 explicit QAbstract3DSeries(QAbstract3DSeriesPrivate *d, QObject *parent = nullptr);
92
93public:
94 virtual ~QAbstract3DSeries();
95
96 SeriesType type() const;
97
98 void setItemLabelFormat(const QString &format);
99 QString itemLabelFormat() const;
100
101 void setVisible(bool visible);
102 bool isVisible() const;
103
104 void setMesh(Mesh mesh);
105 Mesh mesh() const;
106
107 void setMeshSmooth(bool enable);
108 bool isMeshSmooth() const;
109
110 void setMeshRotation(const QQuaternion &rotation);
111 QQuaternion meshRotation() const;
112 Q_INVOKABLE void setMeshAxisAndAngle(const QVector3D &axis, float angle);
113
114 void setUserDefinedMesh(const QString &fileName);
115 QString userDefinedMesh() const;
116
117 void setColorStyle(Q3DTheme::ColorStyle style);
118 Q3DTheme::ColorStyle colorStyle() const;
119 void setBaseColor(const QColor &color);
120 QColor baseColor() const;
121 void setBaseGradient(const QLinearGradient &gradient);
122 QLinearGradient baseGradient() const;
123 void setSingleHighlightColor(const QColor &color);
124 QColor singleHighlightColor() const;
125 void setSingleHighlightGradient(const QLinearGradient &gradient);
126 QLinearGradient singleHighlightGradient() const;
127 void setMultiHighlightColor(const QColor &color);
128 QColor multiHighlightColor() const;
129 void setMultiHighlightGradient(const QLinearGradient &gradient);
130 QLinearGradient multiHighlightGradient() const;
131
132 void setName(const QString &name);
133 QString name() const;
134
135 QString itemLabel() const;
136 void setItemLabelVisible(bool visible);
137 bool isItemLabelVisible() const;
138
139Q_SIGNALS:
140 void itemLabelFormatChanged(const QString &format);
141 void visibilityChanged(bool visible);
142 void meshChanged(QAbstract3DSeries::Mesh mesh);
143 void meshSmoothChanged(bool enabled);
144 void meshRotationChanged(const QQuaternion &rotation);
145 void userDefinedMeshChanged(const QString &fileName);
146 void colorStyleChanged(Q3DTheme::ColorStyle style);
147 void baseColorChanged(const QColor &color);
148 void baseGradientChanged(const QLinearGradient &gradient);
149 void singleHighlightColorChanged(const QColor &color);
150 void singleHighlightGradientChanged(const QLinearGradient &gradient);
151 void multiHighlightColorChanged(const QColor &color);
152 void multiHighlightGradientChanged(const QLinearGradient &gradient);
153 void nameChanged(const QString &name);
154 Q_REVISION(1) void itemLabelChanged(const QString &label);
155 Q_REVISION(1) void itemLabelVisibilityChanged(bool visible);
156
157protected:
158 QScopedPointer<QAbstract3DSeriesPrivate> d_ptr;
159
160private:
161 Q_DISABLE_COPY(QAbstract3DSeries)
162
163 friend class Abstract3DController;
164 friend class Bars3DController;
165 friend class Surface3DController;
166 friend class Surface3DRenderer;
167 friend class Scatter3DRenderer;
168 friend class Scatter3DController;
169 friend class QBar3DSeries;
170 friend class SeriesRenderCache;
171 friend class Abstract3DRenderer;
172};
173
174QT_END_NAMESPACE_DATAVISUALIZATION
175
176#endif
177