1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSURFACE3DSERIES_H
5#define QSURFACE3DSERIES_H
6
7#include <QtGraphs/qabstract3dseries.h>
8#include <QtGraphs/qsurfacedataproxy.h>
9
10QT_BEGIN_NAMESPACE
11
12class QSurface3DSeriesPrivate;
13
14class Q_GRAPHS_EXPORT QSurface3DSeries : public QAbstract3DSeries
15{
16 Q_OBJECT
17 Q_DECLARE_PRIVATE(QSurface3DSeries)
18 Q_FLAGS(DrawFlag DrawFlags)
19 Q_PROPERTY(QSurfaceDataProxy *dataProxy READ dataProxy WRITE setDataProxy NOTIFY dataProxyChanged)
20 Q_PROPERTY(QPoint selectedPoint READ selectedPoint WRITE setSelectedPoint NOTIFY selectedPointChanged)
21 Q_PROPERTY(bool flatShadingEnabled READ isFlatShadingEnabled WRITE setFlatShadingEnabled NOTIFY flatShadingEnabledChanged)
22 Q_PROPERTY(bool flatShadingSupported READ isFlatShadingSupported NOTIFY flatShadingSupportedChanged)
23 Q_PROPERTY(QSurface3DSeries::DrawFlags drawMode READ drawMode WRITE setDrawMode NOTIFY drawModeChanged)
24 Q_PROPERTY(QImage texture READ texture WRITE setTexture NOTIFY textureChanged)
25 Q_PROPERTY(QString textureFile READ textureFile WRITE setTextureFile NOTIFY textureFileChanged)
26 Q_PROPERTY(QColor wireframeColor READ wireframeColor WRITE setWireframeColor NOTIFY wireframeColorChanged)
27
28public:
29 enum DrawFlag {
30 DrawWireframe = 1,
31 DrawSurface = 2,
32 DrawSurfaceAndWireframe = DrawWireframe | DrawSurface
33 };
34 Q_ENUM(DrawFlag)
35 Q_DECLARE_FLAGS(DrawFlags, DrawFlag)
36
37 explicit QSurface3DSeries(QObject *parent = nullptr);
38 explicit QSurface3DSeries(QSurfaceDataProxy *dataProxy, QObject *parent = nullptr);
39 virtual ~QSurface3DSeries();
40
41 void setDataProxy(QSurfaceDataProxy *proxy);
42 QSurfaceDataProxy *dataProxy() const;
43
44 void setSelectedPoint(const QPoint &position);
45 QPoint selectedPoint() const;
46 static QPoint invalidSelectionPosition();
47
48 void setFlatShadingEnabled(bool enabled);
49 bool isFlatShadingEnabled() const;
50
51 void setDrawMode(QSurface3DSeries::DrawFlags mode);
52 QSurface3DSeries::DrawFlags drawMode() const;
53
54 bool isFlatShadingSupported() const;
55
56 void setTexture(const QImage &texture);
57 QImage texture() const;
58 void setTextureFile(const QString &filename);
59 QString textureFile() const;
60
61 void setWireframeColor(const QColor &color);
62 QColor wireframeColor() const;
63
64Q_SIGNALS:
65 void dataProxyChanged(QSurfaceDataProxy *proxy);
66 void selectedPointChanged(const QPoint &position);
67 void flatShadingEnabledChanged(bool enable);
68 void flatShadingSupportedChanged(bool enable);
69 void drawModeChanged(QSurface3DSeries::DrawFlags mode);
70 void textureChanged(const QImage &image);
71 void textureFileChanged(const QString &filename);
72 void wireframeColorChanged(const QColor &color);
73
74protected:
75 explicit QSurface3DSeries(QSurface3DSeriesPrivate *d, QObject *parent = nullptr);
76
77private:
78 Q_DISABLE_COPY(QSurface3DSeries)
79
80 friend class Surface3DController;
81};
82Q_DECLARE_OPERATORS_FOR_FLAGS(QSurface3DSeries::DrawFlags)
83
84QT_END_NAMESPACE
85
86#endif
87

source code of qtgraphs/src/graphs/data/qsurface3dseries.h