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