【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)

})

}

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

相关推荐
excel20 分钟前
为什么 super 中能接收到 resolve 和 reject?
前端
Flynt2 小时前
AI 生成的界面,能放心点吗?我把 Google A2UI 的三层防线拆开测了一遍
前端·google·agent
前端混子3 小时前
我用 AI 做了个「禾月小历」,一套代码跑微信小程序和 H5
前端
IT_陈寒3 小时前
Java实战技巧总结:当你的finally块没有执行时会发生什么?
前端·人工智能·后端
小帅不太帅4 小时前
一年一次黑五,为了买软件真省钱,我做了个开源小站
前端·人工智能·github
JavaGuide5 小时前
刚刚,阿里版 Codex 上线了匿名模型 HungerG,无限 Token!
前端·后端
zhanlang02176 小时前
HTML 零基础入门到企业实战全套教程【第九章 9.3】移动端 HTML 基础适配入门
前端·html
用户69371750013846 小时前
AI 帮我写了大半年的代码,我却越来越不会写代码了
前端·后端·github
skywalk81636 小时前
把「假成功」赶出工具层:lightharness 两天升级复盘(4×5 模式矩阵 + 工具层 5 个缺陷)
开发语言·前端·人工智能·lightharness
彭亚川Allen6 小时前
从零手搓 RAG:用 Elasticsearch 存储与检索向量
前端·后端·面试