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

144 篇文章 2 订阅
128 篇文章 0 订阅

问题:

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

2.

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

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

 

3.

可以加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)

    })

}

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

  • 10
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值