当前位置: 首页 > news >正文

QML 3D曲面图(Surface3D)技术

3D曲面图是科学计算和工程可视化中常用的图表类型,它通过起伏的曲面展示二维数据的变化趋势。Qt Data Visualization 模块中的 Surface3D 类型提供了强大的曲面可视化能力。

Surface3D 核心属性与方法

表:Surface3D主要属性与方法

属性/方法类型描述示例
widthreal曲面图宽度width: parent.width
heightreal曲面图高度height: parent.height
selectionModeenum选择模式(无/单项/行/列/行与列/切片)AbstractGraph3D.SelectionItem
shadowQualityenum阴影质量(无/低/中/高/软低/软中/软高)AbstractGraph3D.ShadowQualityHigh
scene.activeCameraQ3DCamera控制场景相机scene.activeCamera.xRotation: 60.0
themeTheme3D设置图表主题theme: Theme3D { type: Theme3D.ThemeArmyBlue }
axisXValue3DAxisX轴配置axisX: Value3DAxis { title: "经度"; min: -180; max: 180 }
axisYValue3DAxisY轴配置axisY: Value3DAxis { title: "高度"; min: 0; max: 10000 }
axisZValue3DAxisZ轴配置axisZ: Value3DAxis { title: "纬度"; min: -90; max: 90 }
flipHorizontalGridbool是否翻转水平网格flipHorizontalGrid: true
surfaceSerieslist曲面系列列表surfaceSeries: [heightMapSeries, temperatureSeries]
addSeries()method添加曲面系列surface3D.addSeries(newSeries)
removeSeries()method移除曲面系列surface3D.removeSeries(oldSeries)
release()method释放资源Component.onDestruction: surface3D.release()

基本曲面图实现

以下是一个完整的地形高度图示例,展示了如何使用Surface3D显示地理高程数据:

import QtQuick
import QtQuick.Controls
import QtDataVisualizationWindow {width: 640height: 480visible: truetitle: qsTr("Hello World")Surface3D {id: surfaceGraphanchors.fill: parenttheme: Theme3D { type: Theme3D.ThemeArmyBlue }// 设置坐标轴axisX: ValueAxis3D {title: "东西方向 (km)"}axisY: ValueAxis3D {title: "高度 (m)"min: 30max: 200}axisZ: ValueAxis3D {title: "南北方向 (km)"}// 添加曲面系列Surface3DSeries {id: terrainSeriesitemLabelFormat: "(@xLabel km, @zLabel km): @yLabel m"drawMode: Surface3DSeries.DrawSurfaceAndWireframeflatShadingEnabled: false// 使用高度图数据代理HeightMapSurfaceDataProxy {id: heightMapProxyheightMapFile: ":/layer_1.png"}// 自定义渐变颜色baseGradient: ColorGradient {ColorGradientStop { position: 0.0; color: "#0000ff" }  // 深水区ColorGradientStop { position: 0.2; color: "#00ffff" }  // 浅水区ColorGradientStop { position: 0.25; color: "#00aa00" } // 海滩ColorGradientStop { position: 0.5; color: "#ffff00" }  // 平原ColorGradientStop { position: 0.75; color: "#aa5500" } // 山地ColorGradientStop { position: 1.0; color: "#ffffff" } // 雪山}// 网格线样式wireframeColor: "#555555"}// 相机初始位置scene.activeCamera.xRotation: 20.0scene.activeCamera.yRotation: 45.0}// 控制面板Row {anchors.top: parent.topanchors.right: parent.rightspacing: 10padding: 10Button {text: "俯视图"onClicked: {surfaceGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetFrontHigh}}Button {text: "侧视图"onClicked: {surfaceGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetRightLow}}Button {text: "等轴测"onClicked: {surfaceGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetIsometricRight}}ComboBox {id: drawModeCombomodel: ["Surface", "Wireframe", "Both"]onCurrentIndexChanged: {switch(currentIndex) {case 0: terrainSeries.drawMode = Surface3DSeries.DrawSurface; break;case 1: terrainSeries.drawMode = Surface3DSeries.DrawWireframe; break;case 2: terrainSeries.drawMode = Surface3DSeries.DrawSurfaceAndWireframe; break;}}}}
}

 

http://www.dtcms.com/a/303860.html

相关文章:

  • p5.js 从零开始创建 3D 模型,createModel入门指南
  • Adv. Sci. 前沿:非零高斯曲率3D结构可逆转换!液晶弹性体多级形变新策略
  • VSCode使用Code Runner运行C/C++输出[Done] exited with code=0 in xxx seconds
  • Marin说PCB之POC电路layout设计仿真案例---10
  • 机械学习--线性回归---三个小案例
  • p5.js 矩形rect绘制教程
  • Ubuntu环境下搭建CUDA编程环境
  • Charles中文版使用指南:如何利用抓包工具优化API调试与网络性能
  • Ubuntu20.04安装和配置Samba实现Win11下共享文件夹
  • 「源力觉醒 创作者计划」 百度AI的战略“惊蛰”,一场重塑格局的“破壁行动”
  • 深度学习篇---百度AI Studio模型
  • 2411.按位或最大的最小子数组长度
  • 服务器中涉及节流(Throttle)的硬件组件及其应用注意事项
  • 服务器分布式的作用都有什么?
  • 《Java 程序设计》第 9 章 - 内部类、枚举和注解
  • ClickHouse MergeTree引擎:从核心架构到三级索引实战
  • C++实现黑板模式操作
  • 怎么提升服务器的防攻击能力!
  • 异地协同新玩法!Docker+Neko+cpolar打造云端共享浏览器
  • Sea AI Lab万信逸博士:大模型训练流水线并行四部曲:吞吐、内存、负载均衡与线性扩展
  • 专业Python爬虫实战教程:逆向加密接口与验证码突破完整案例
  • C 语言指针深度解析:从数组指针到指针函数的实战指南
  • 【21】C# 窗体应用WinForm ——图片框PictureBox属性、方法、实例应用
  • 重生之我在暑假学习微服务第四天《Docker-下篇》
  • Intellij Idea--解决Cannot download “https://start.spring.io‘: Connect timedout
  • React面试题目和答案大全
  • 队列算法之【用队列实现栈】
  • 系统重启过程和启动目标
  • Note3: CNN(卷积神经网络)
  • java每日精进 7.29【框架数据权限详解】