基于北京SDK的方案预演功能
suerprisePlus
2024-06-13 28de79b44655118b1deffb5c9a8b06ec2904905b
src/assets/js/mapView.js
@@ -1,27 +1,46 @@
import mapClick from "./mapClick";
import store from "@/store";
import configTool from "@/assets/js/tool/configTool";
const mapView = {
  init() {
    window.earthCtrl = new SmartEarth.EarthCtrl("cesiumContainer", {
      printLog: false,
    });
    window.Viewer = earthCtrl._Viewer;
    window.Cesium = SmartEarth.Cesium;
    earthCtrl.camera.stop(); //取消飞行状态
    // 关闭深度检测
    Viewer.scene.globe.depthTestAgainstTerrain = false;
    // 飞行定位
    configTool.setMapFly({
      lon: 120.862482,
      lat: 44.7786221,
      alt: 300000,
      heading: 6.283185307179586,
      pitch: -1.5707963267948966,
      roll: 0,
    });
    // 120.923461, 44.232539
    mapClick.Init();
  },
};
export default mapView;
import mapClick from "./mapClick";
import store from "@/store";
import configTool from "@/assets/js/tool/configTool";
import mapPlan from "./tool/mapPlan";
const mapView = {
  init() {
    window.earthCtrl = new SmartEarth.EarthCtrl("cesiumContainer", {
      // printLog: false
    });
    window.Viewer = earthCtrl._Viewer;
    window.Cesium = SmartEarth.Cesium;
    earthCtrl.camera.stop(); //取消飞行状态
    // 关闭深度检测
    Viewer.scene.globe.depthTestAgainstTerrain = false;
    window.widget = Viewer.widget;
    earthCtrl.showFPS = true;
    // 飞行定位
    // configTool.setMapFly({
    //   lon: 120.862482,
    //   lat: 44.7786221,
    //   alt: 300000,
    //   heading: 6.283185307179586,
    //   pitch: -1.5707963267948966,
    //   roll: 0
    // });
    try {
      Viewer.scene.postRender.addEventListener(() => {
      });
    } catch (e) {
      if (window.widget._showRenderLoopErrors) {
        var title =
          "开始时间: " +
          mapPlan.startTime +
          "结束时间: " +
          mapPlan.formatDate();
        window.widget.showErrorPanel(title, undefined, e);
      }
    }
    mapClick.Init();
  }
};
export default mapView;