【Mars3d】进行水平测量measure.area({的时候,会被模型遮挡的处理方法

问题:

1.thing/analysis/measure 水平面积 measure.area({ 在模型上测量的时候会被遮挡

通过 addHeight:10000,增加高度也不可以实现这种被遮挡的效果,都增加到10000了,还是会被遮挡

export function measureArea() {

measure.area({

style: {

color: '#00fff2',

opacity: 0.4,

outline: true,

outlineColor: '#fafa5a',

outlineWidth: 1,

addHeight:10000,

clampToGround: false //贴地

}

})

}

可以加clampToGround: true ,只是贴地效果,不影响结果值的时候,在

测量的是斜面,虽然数值不会错,但是视觉效果看起来就跟贴模型面积一样,容易产生误解。

就如同这个

复制代码
export function measureArea() {
    measure.area({
        style: {
            color: '#00fff2',
            opacity: 0.4,
            outline: true,
            outlineColor: '#fafa5a',
            outlineWidth: 1, 
            clampToGround: true //贴地
        }
    })
}

解决方案:

1.给测量的水平面积坐标(或坐标数组)赋值修改为 指定的海拔高度值

2.api文档地址:

PointUtil - V3.7.5 - Mars3D API文档

3.相关代码:

export function measureArea() {

measure.area({

// style: {

// color: '#00fff2',

// opacity: 0.4,

// outline: true,

// outlineColor: '#fafa5a',

// outlineWidth: 1,

// clampToGround: false //贴地

// }

})

.then(async (graphic) => {

const oldPositions = graphic.positionsShow

const rang = await mars3d.PolyUtil.getHeightRangeByDepth(oldPositions, map.scene)

graphic.positions = mars3d.PointUtil.setPositionsHeight(oldPositions, rang.maxHeight)

})

}

可以实现水平面积不被模型遮挡的方法。

相关推荐
xyz59910 分钟前
Astyle对应.clang-format
vscode
AI_零食16 分钟前
鸿蒙PC Electron跨平台应用开发:24时区时间表应用详解
前端·华为·electron·开源·harmonyos·鸿蒙
维度攻城狮1 小时前
在Vscode连接的Docker容器中使用codex,并配置DeepSeek模型
vscode·docker·codex
Electrolux1 小时前
[onlyoffice-v9]纯前端怎么实现编辑预览office
前端·javascript·github
VidDown1 小时前
Webhook 调试器:让第三方回调“原形毕露”
java·开发语言·javascript·编辑器·postman
CG_MAGIC1 小时前
从光影到物理渲染:Substance Sampler 照片转材质
3d·材质·贴图·uv·建模教程·渲云渲染
码云之上1 小时前
聊聊如何设计一个高效、稳定的 Node.js 接入层
前端·后端·node.js
kyriewen2 小时前
我读了一遍 Babel 编译后的 async/await,终于搞懂了它的原理(附 20 行手写实现)
前端·javascript·面试
IT_陈寒2 小时前
Vite项目build后路由404了?你可能漏了这个小配置
前端·人工智能·后端
lichenyang4532 小时前
AI 聊天从纯文本到结构化卡片:SSE done 帧携带 card + 历史记录卡片恢复实战
前端