基于北京SDK的方案预演功能
suerprisePlus
2024-06-13 28de79b44655118b1deffb5c9a8b06ec2904905b
src/assets/js/tool/configTool.js
@@ -15,8 +15,8 @@
        // 倾斜角度
        roll: res.roll,
        // 设置飞行持续时间,默认会根据距离来计算
        duration: that.time,
      },
        duration: that.time
      }
    });
  },
  getNewDateTime() {
@@ -35,7 +35,7 @@
      alt: cartographic.height,
      heading: Viewer.scene.camera.heading,
      pitch: Viewer.scene.camera.pitch,
      roll: Viewer.scene.camera.roll,
      roll: Viewer.scene.camera.roll
    };
  },
  //获取当前视角信息
@@ -44,10 +44,10 @@
    return {
      lon: Cesium.Math.toDegrees(position.longitude).toFixed(6),
      lat: Cesium.Math.toDegrees(position.latitude).toFixed(6),
      alt: position.height,
      heading: Viewer.scene.camera.heading,
      pitch: Viewer.scene.camera.pitch,
      roll: Viewer.scene.camera.roll,
      alt: position.height.toFixed(6),
      heading: Cesium.Math.toDegrees(Viewer.scene.camera.heading),
      pitch: Cesium.Math.toDegrees(Viewer.scene.camera.pitch),
      roll: Cesium.Math.toDegrees(Viewer.scene.camera.roll)
    };
  },
  getTreeDataCheck(res, std) {
@@ -62,5 +62,28 @@
    }
    return std;
  },
  generateID() {
    return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
      /[xy]/g,
      function (c) {
        var r = (Math.random() * 16) | 0,
          v = c === "x" ? r : (r & 0x3) | 0x8;
        return v.toString(16);
      }
    );
  },
  saveToJson(data, res) {
    let content = JSON.stringify(data);
    let blob = new Blob([content], { type: "" });
    var reader = new FileReader();
    reader.onloadend = () => {
      let url = reader.result;
      let triggerDownload = document.createElement("a");
      triggerDownload.download = (res) + ".json";
      triggerDownload.href = url;
      triggerDownload.click();
    };
    reader.readAsDataURL(blob);
  }
};
export default configTool;