基于北京SDK的方案预演功能
surprise
2024-05-07 087510aa88b0a6b6b5c648907e9dd52394621d47
src/assets/js/tool/configTool.js
ÎļþÃû´Ó src/assets/js/configTool.js ÐÞ¸Ä
@@ -2,11 +2,11 @@
  time: 5,
  setMapFly(res) {
    var that = this;
    const alt = res.alt == 0 ? 100 : res.alt;
    //设置初始视图位置
    Viewer.camera.flyTo({
      // fromDegrees()方法,将经纬度和高程转换为世界坐标
      destination: Cesium.Cartesian3.fromDegrees(res.lon, res.lat, res.alt),
      destination: Cesium.Cartesian3.fromDegrees(res.lon, res.lat, alt),
      orientation: {
        // æ–¹å‘
        heading: res.heading,
@@ -22,6 +22,23 @@
  getNewDateTime() {
    return new Date().getTime();
  },
  getEndDateTime() {
    return this.getNewDateTime() + 3600 * 2;
  },
  //点击获取经纬度
  getViewerPosition(res) {
    const cartesain = Viewer.camera.pickEllipsoid(res.position);
    var cartographic = Cesium.Cartographic.fromCartesian(cartesain);
    return {
      lon: parseFloat(Cesium.Math.toDegrees(cartographic.longitude)).toFixed(6),
      lat: parseFloat(Cesium.Math.toDegrees(cartographic.latitude)).toFixed(6),
      alt: cartographic.height,
      heading: Viewer.scene.camera.heading,
      pitch: Viewer.scene.camera.pitch,
      roll: Viewer.scene.camera.roll,
    };
  },
  //获取当前视角信息
  getViewerCamera() {
    var position = Viewer.scene.camera.positionCartographic;
    return {