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

})

}

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

相关推荐
Csvn1 小时前
WASM
前端
FlightYe2 小时前
视界原理之3D视频(四):裸眼、眼镜和头显
android·linux·c++·3d·ffmpeg·音视频
修己xj2 小时前
我用 AI 给自己写了一个 Markdown 编辑器,然后把它开源了
前端
FRing033 小时前
vue2干货总结2(v-bind、v-for、v-model、指令修饰符、v-bind操作class和style)
开发语言·前端·vue.js·vue2
幸运小猿3 小时前
模拟慢上传-处理超时重试image 丢失线上问题
前端·javascript·html
moshuying4 小时前
网购能买Token了!
前端
h_65432105 小时前
echarts实现柱状图加一条横线
前端·echarts
风骏时光牛马5 小时前
生成一个后端标题,只需要一个标题,不需要其他的任何文本。
前端
子非鱼@Itfuture5 小时前
关于前后端联调中登录状态/登录信息失效?
java·前端
郭小李5 小时前
openFeign入门
java·开发语言·前端