• vue中cesium设置视角,添加删除广告牌


    设置视角:

    this.viewer.camera.setView({
        destination: Cesium.Rectangle.fromDegrees(
           this.position.west,
           this.position.south,
           this.position.east,
           this.position.north
         ),
         orientation: {
            heading: Cesium.Math.toRadians(0),
            pitch: Cesium.Math.toRadians(-90),
            roll: Cesium.Math.toRadians(0)
         }
     })

    entity添加广告牌:

    let model = {
          id: 'model',
          position: Cesium.Cartesian3.fromDegrees(longitude, latitude),
          billboard: {
            image: this.boostImg,
             40,
            height: 40
          }
        }
        this.viewer.entities.add(model)
    primitives添加广告牌
    let billboards = viewer.scene.primitives.add(new Cesium.BillboardCollection())
    
    billboards.add({
              id: `billboard-${data[i].id}`,
              position: Cesium.Cartesian3.fromDegrees(position[0], position[1]),
              image: require('/assets/map/dot.png'),
              horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
              verticalOrigin: Cesium.VerticalOrigin.CENTER,
              scaleByDistance: new Cesium.NearFarScalar(50000, 1, 6000000, 0.1),
              distanceDisplayCondition: new Cesium.DistanceDisplayCondition(50000, 6000000)
            })

    移除添加的广告牌

    if(billboards.length) {
        billboards.removeAll()
    }
    
    if(viewer.entities.getById(`model`)) {
      viewer.entities.remove({id: 'model'})  
    }
  • 相关阅读:
    jquery文本折叠
    物理小词典
    程序员的十层楼
    各种语言的hello world
    读书遇到的一些概念
    银行业务一些概念
    mysql 基本操作
    oracle 基本操作
    maven 基本操作
    ubuntu JavaWeb环境搭建
  • 原文地址:https://www.cnblogs.com/hlweng-0207/p/11911959.html
Copyright © 2020-2023  润新知