QHeightMapSurfaceDataProxy Class
Q3DSurfaceWidgetItem 的基类代理类。更多内容...
| 头文件: | #include <QHeightMapSurfaceDataProxy> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
| qmake: | QT += graphs |
| 在 QML 中: | HeightMapSurfaceDataProxy |
| 继承自: | QSurfaceDataProxy |
- 所有成员列表(包括继承的成员)
- QHeightMapSurfaceDataProxy 属于Qt Graphs 的3D C++ 类库。
属性
|
公共函数
| QHeightMapSurfaceDataProxy(QObject *parent = nullptr) | |
| QHeightMapSurfaceDataProxy(const QImage &image, QObject *parent = nullptr) | |
| QHeightMapSurfaceDataProxy(const QString &filename, QObject *parent = nullptr) | |
| virtual | ~QHeightMapSurfaceDataProxy() override |
| bool | autoScaleY() const |
| QImage | heightMap() const |
| QString | heightMapFile() const |
| float | maxXValue() const |
| float | maxYValue() const |
| float | maxZValue() const |
| float | minXValue() const |
| float | minYValue() const |
| float | minZValue() const |
| void | setAutoScaleY(bool enabled) |
| void | setHeightMap(const QImage &image) |
| void | setHeightMapFile(const QString &filename) |
| void | setMaxXValue(float max) |
| void | setMaxYValue(float max) |
| void | setMaxZValue(float max) |
| void | setMinXValue(float min) |
| void | setMinYValue(float min) |
| void | setMinZValue(float min) |
| void | setValueRanges(float minX, float maxX, float minZ, float maxZ) |
信号
| void | autoScaleYChanged(bool enabled) |
| void | heightMapChanged(const QImage &image) |
| void | heightMapFileChanged(const QString &filename) |
| void | maxXValueChanged(float value) |
| void | maxYValueChanged(float value) |
| void | maxZValueChanged(float value) |
| void | minXValueChanged(float value) |
| void | minYValueChanged(float value) |
| void | minZValueChanged(float value) |
详细说明
QHeightMapSurfaceDataProxy 负责处理与曲面相关的高度图数据。它将高度图以曲面图的形式进行可视化展示。
由于高度图不包含 X 轴或 Z 轴的数值,因此需要通过minXValue 、maxXValue 、minZValue 和maxZValue 属性分别指定这些数值。X 值对应图像的水平方向,Z 值对应垂直方向。设置其中任何一个属性都会触发对现有高度图的异步重新采样。
另请参阅 QSurfaceDataProxy 和Qt Graphs 中的“3D 数据处理”。
属性文档
autoScaleY : bool
将高度值按Y轴比例缩放。
默认值为false 。
当此属性设置为true 时,高度值将按比例缩放,以适应Y轴上minYValue 至maxYValue 之间的范围。
访问函数:
| bool | autoScaleY() const |
| void | setAutoScaleY(bool enabled) |
通知信号:
| void | autoScaleYChanged(bool enabled) |
heightMap : QImage
该属性存储待可视化的高度图图像。
访问函数:
| QImage | heightMap() const |
| void | setHeightMap(const QImage &image) |
通知信号:
| void | heightMapChanged(const QImage &image) |
heightMapFile : QString
该属性存储待可视化的高度图图像文件的名称。
访问函数:
| QString | heightMapFile() const |
| void | setHeightMapFile(const QString &filename) |
通知信号:
| void | heightMapFileChanged(const QString &filename) |
maxXValue : float
该属性存储生成的曲面点的最大 X 值。
默认值为10.0 。
设置此属性时,系统会根据需要调整相应的最小值,以确保范围保持有效。
访问函数:
| float | maxXValue() const |
| void | setMaxXValue(float max) |
通知信号:
| void | maxXValueChanged(float value) |
maxYValue : float
该属性保存生成的曲面点的最大Y值。
默认值为10.0 。
设置此属性时,系统会根据需要调整相应的最小值,以确保范围保持有效。
访问函数:
| float | maxYValue() const |
| void | setMaxYValue(float max) |
通知信号:
| void | maxYValueChanged(float value) |
另请参阅 autoScaleY 。
maxZValue : float
该属性存储生成的曲面点的最大Z值。
默认值为10.0 。
设置此属性时,系统会在必要时调整相应的最小值,以确保范围保持有效。
访问函数:
| float | maxZValue() const |
| void | setMaxZValue(float max) |
通知信号:
| void | maxZValueChanged(float value) |
minXValue : float
该属性存储生成的曲面点的最小 X 值。
默认值为0.0 。
设置此属性时,系统会在必要时调整相应的最大值,以确保范围保持有效。
访问函数:
| float | minXValue() const |
| void | setMinXValue(float min) |
通知信号:
| void | minXValueChanged(float value) |
minYValue : float
该属性存储生成的曲面点的最小 Y 值。
默认值为0.0 。
设置此属性时,系统会根据需要调整相应的最大值,以确保范围保持有效。
访问函数:
| float | minYValue() const |
| void | setMinYValue(float min) |
通知信号:
| void | minYValueChanged(float value) |
另请参阅 autoScaleY 。
minZValue : float
该属性存储生成的曲面点的最小Z值。
默认值为0.0 。
设置此属性时,系统会根据需要调整相应的最大值,以确保范围保持有效。
访问函数:
| float | minZValue() const |
| void | setMinZValue(float min) |
通知信号:
| void | minZValueChanged(float value) |
成员函数文档
[explicit] QHeightMapSurfaceDataProxy::QHeightMapSurfaceDataProxy(QObject *parent = nullptr)
使用给定的parent 实例化QHeightMapSurfaceDataProxy。
[explicit] QHeightMapSurfaceDataProxy::QHeightMapSurfaceDataProxy(const QImage &image, QObject *parent = nullptr)
使用给定的image 和parent 构建QHeightMapSurfaceDataProxy。通过调用setHeightMap()并传入image 来设置高度图。
另请参阅 heightMap 。
[explicit] QHeightMapSurfaceDataProxy::QHeightMapSurfaceDataProxy(const QString &filename, QObject *parent = nullptr)
根据给定的图像filename 和parent 构建QHeightMapSurfaceDataProxy。通过调用setHeightMapFile()并传入filename 来设置高度图。
另请参阅 heightMapFile 。
[override virtual noexcept] QHeightMapSurfaceDataProxy::~QHeightMapSurfaceDataProxy()
销毁QHeightMapSurfaceDataProxy 。
void QHeightMapSurfaceDataProxy::setHeightMap(const QImage &image)
用image 指定的高程图数据替换当前数据。
image 可以采用多种格式,但如果其格式无法直接使用,系统会进行转换。
注意:如果 结果看起来有误,说明自动转换失败,您应在设置前尝试自行转换该image 。首选格式为灰度模式下的QImage::Format_RGB32 。
如果image 为灰度图像,则从像素的红色分量中读取image 的高度;否则,该高度是根据像素的红、绿、蓝分量计算得出的平均值。对于大尺寸图像,使用灰度图像可能提高数据转换速度。
不推荐的格式:所有单色格式(例如QImage::Format_Mono )。
高度图的解析是异步进行的。当数据解析完成时,会触发QSurfaceDataProxy::arrayReset() 事件。
注意: 这是属性heightMap 的设置 函数。
另请参阅 heightMap()。
void QHeightMapSurfaceDataProxy::setHeightMapFile(const QString &filename)
用filename 指定的文件中的高程图数据替换当前数据。
注意: 这是属性heightMapFile 的设置 函数。
另请参阅 heightMapFile() 和heightMap 。
void QHeightMapSurfaceDataProxy::setValueRanges(float minX, float maxX, float minZ, float maxZ)
一个便捷函数,用于同时设置所有最小值(minX 和minZ )和最大值(maxX 和maxZ )。最小值必须小于相应的最大值。否则,系统会调整这些值,以确保其有效性。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.