| 1 | // Copyright (C) 2023 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QTGRAPHS_QHEIGHTMAPSURFACEDATAPROXY_H |
| 5 | #define QTGRAPHS_QHEIGHTMAPSURFACEDATAPROXY_H |
| 6 | |
| 7 | #include <QtCore/qstring.h> |
| 8 | #include <QtGraphs/qsurfacedataproxy.h> |
| 9 | #include <QtGui/qimage.h> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | class QHeightMapSurfaceDataProxyPrivate; |
| 14 | |
| 15 | class Q_GRAPHS_EXPORT QHeightMapSurfaceDataProxy : public QSurfaceDataProxy |
| 16 | { |
| 17 | Q_OBJECT |
| 18 | Q_DECLARE_PRIVATE(QHeightMapSurfaceDataProxy) |
| 19 | Q_PROPERTY(QImage heightMap READ heightMap WRITE setHeightMap NOTIFY heightMapChanged FINAL) |
| 20 | Q_PROPERTY(QString heightMapFile READ heightMapFile WRITE setHeightMapFile NOTIFY |
| 21 | heightMapFileChanged FINAL) |
| 22 | Q_PROPERTY(float minXValue READ minXValue WRITE setMinXValue NOTIFY minXValueChanged FINAL) |
| 23 | Q_PROPERTY(float maxXValue READ maxXValue WRITE setMaxXValue NOTIFY maxXValueChanged FINAL) |
| 24 | Q_PROPERTY(float minZValue READ minZValue WRITE setMinZValue NOTIFY minZValueChanged FINAL) |
| 25 | Q_PROPERTY(float maxZValue READ maxZValue WRITE setMaxZValue NOTIFY maxZValueChanged FINAL) |
| 26 | Q_PROPERTY(float minYValue READ minYValue WRITE setMinYValue NOTIFY minYValueChanged FINAL) |
| 27 | Q_PROPERTY(float maxYValue READ maxYValue WRITE setMaxYValue NOTIFY maxYValueChanged FINAL) |
| 28 | Q_PROPERTY(bool autoScaleY READ autoScaleY WRITE setAutoScaleY NOTIFY autoScaleYChanged FINAL) |
| 29 | |
| 30 | public: |
| 31 | explicit QHeightMapSurfaceDataProxy(QObject *parent = nullptr); |
| 32 | explicit QHeightMapSurfaceDataProxy(const QImage &image, QObject *parent = nullptr); |
| 33 | explicit QHeightMapSurfaceDataProxy(const QString &filename, QObject *parent = nullptr); |
| 34 | ~QHeightMapSurfaceDataProxy() override; |
| 35 | |
| 36 | void setHeightMap(const QImage &image); |
| 37 | QImage heightMap() const; |
| 38 | void setHeightMapFile(const QString &filename); |
| 39 | QString heightMapFile() const; |
| 40 | |
| 41 | void setValueRanges(float minX, float maxX, float minZ, float maxZ); |
| 42 | void setMinXValue(float min); |
| 43 | float minXValue() const; |
| 44 | void setMaxXValue(float max); |
| 45 | float maxXValue() const; |
| 46 | void setMinZValue(float min); |
| 47 | float minZValue() const; |
| 48 | void setMaxZValue(float max); |
| 49 | float maxZValue() const; |
| 50 | void setMinYValue(float min); |
| 51 | float minYValue() const; |
| 52 | void setMaxYValue(float max); |
| 53 | float maxYValue() const; |
| 54 | void setAutoScaleY(bool enabled); |
| 55 | bool autoScaleY() const; |
| 56 | |
| 57 | Q_SIGNALS: |
| 58 | void heightMapChanged(const QImage &image); |
| 59 | void heightMapFileChanged(const QString &filename); |
| 60 | void minXValueChanged(float value); |
| 61 | void maxXValueChanged(float value); |
| 62 | void minZValueChanged(float value); |
| 63 | void maxZValueChanged(float value); |
| 64 | void minYValueChanged(float value); |
| 65 | void maxYValueChanged(float value); |
| 66 | void autoScaleYChanged(bool enabled); |
| 67 | |
| 68 | protected: |
| 69 | explicit QHeightMapSurfaceDataProxy(QHeightMapSurfaceDataProxyPrivate &d, |
| 70 | QObject *parent = nullptr); |
| 71 | void handlePendingResolve(); |
| 72 | |
| 73 | private: |
| 74 | Q_DISABLE_COPY(QHeightMapSurfaceDataProxy) |
| 75 | }; |
| 76 | |
| 77 | QT_END_NAMESPACE |
| 78 | |
| 79 | #endif |
| 80 |
