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

})

}

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

相关推荐
恋猫de小郭6 小时前
AGENTS.md 真的对 AI Coding 有用吗?或许在此之前你没用对?
前端·人工智能·ai编程
sunny_7 小时前
构建工具的第三次革命:从 Rollup 到 Rust Bundler,我是如何设计 robuild 的
前端·rust·前端工程化
rfidunion8 小时前
springboot+VUE+部署(12。Nginx和前端配置遇到的问题)
前端·vue.js·spring boot
珹洺8 小时前
Java-servlet(五)手把手教你利用Servlet配置HTML请求与相应
java·运维·服务器·前端·servlet·html·maven
FYKJ_20108 小时前
springboot大学校园论坛管理系统--附源码42669
java·javascript·spring boot·python·spark·django·php
QQ24391978 小时前
语言在线考试与学习交流网页平台信息管理系统源码-SpringBoot后端+Vue前端+MySQL【可直接运行】
前端·spring boot·sql·学习·java-ee
范特西.i9 小时前
QT聊天项目(6)
前端
a1117769 小时前
水体渲染系统(html开源)
前端·开源·threejs·水体渲染
程序员小李白10 小时前
CSS 盒子模型
前端·css·html
Zzz不能停10 小时前
单行 / 多行文本显示省略号(CSS 实现)
前端·css