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 C++ Classes for 3D 的一部分。
属性
|
公共功能
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
时,高度值将按比例缩放到minYValue 和maxYValue 之间的 Y 轴上。
访问功能:
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) 。最小值必须小于相应的最大值。否则,这些值将被调整为有效值。
© 2025 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.