Bootstrap

Cesium基础功能

根据事件获取经纬度等坐标数据

let position = window.map3D.viewer.scene.pickPosition(e.position); // 笛卡尔坐标系(e.postion,Cartesian2屏幕坐标 {x:,y:})
      let pickedFeature = window.map3D.viewer.scene.pick(e.position); // 点击获取的实体数据
      var cartographic = Cesium.Cartographic.fromCartesian(position); // 笛卡尔转经纬度
      (e.postion,Cartesian3坐标 {x:,y:,z:})
      var lon = Cesium.Math.toDegrees(cartographic.longitude);// 经度
      var lat = Cesium.Math.toDegrees(cartographic.latitude);// 纬度
      var h_=cartographic.height; // 高程

飞行

 viewer.scene.camera.flyTo({
 			// 经纬度转笛卡尔
            destination: Cesium.Cartesian3.fromDegrees(lon,lat,height),
            orientation: {
              heading:v_.heading,
              pitch:v_.pitch,
              roll: v_.roll
            },
            duration: 1
          });

绘制线

 console.log(linearr); // 坐标数组
    var zbarr = []
    for(var i=0;i<linearr.length;i++) {
      zbarr.push(linearr[i].lon,linearr[i].lat,linearr[i].alt)
    }
    var Cartesian3arr = Cesium.Cartesian3.fromDegreesArrayHeights(zbarr)
    this.viewer.entities.add({
        polyline: {
            positions: Cartesian3arr,
            width: 2,
            material: Cesium.Color.YELLOW,
        }
    })
;