月球大数据地理空间分析展示平台-【前端】-月球2期前端
WX
2023-09-14 5d0ad67a45c25938c0ee890083ddb5aa4b97cd40
src/assets/js/Map/index.js
@@ -1,5 +1,5 @@
//配置文件地址
import config from "./config";
// import config from "../../../../public/config/config";
//服务加载配置文件
import server from "./server";
@@ -14,74 +14,40 @@
      1737400.0,
      1737400.0
    );
    //贴地线
    SmartEarth.Cesium.ExternalParameter.changeApproximateTerrainHeights = true;
    //页面初始化
    this.earthCtrl = new SmartEarth.EarthCtrl("cesiumContainer", {
      StaticFileBaseUrl: config.StaticFileBaseUrl,
      ellipsoidCoordinates: "MOON",
      timeline: true,
    });
    // this.earthCtrl.environment.disableAllEffect();
    this.Viewer = this.earthCtrl._Viewer;
    this.Viewer.scene.skyAtmosphere.show = false;
    this.Viewer.scene.globe.depthTestAgainstTerrain = false;
    window.earthCtrl = this.earthCtrl;
    window.Viewer = this.earthCtrl._Viewer;
    Viewer.scene.skyAtmosphere.show = false;
    window.Cesium = SmartEarth.Cesium;
    window.sgworld = earthCtrl;
    sgworld.Creator.SimpleGraphic.edit(true, { editProp: true });
    //=======================
    window.Viewer.imageryLayers.removeAll();
    Viewer.imageryLayers.removeAll();
    Viewer.scene.globe.depthTestAgainstTerrain = false; // 开启深度测试
    Viewer.animation.container.style.visibility = "hidden";
    Viewer.timeline.container.style.visibility = "hidden";
    //=======================
    //大气层
    Viewer.scene.globe.showGroundAtmosphere = false;
    // let colorAll = {
    //   point: Cesium.Color.fromCssColorString("#ff0000"),
    //   polyline: Cesium.Color.fromCssColorString("#ffff0050"),
    //   polygon: Cesium.Color.fromCssColorString("#ffff0050"),
    // };
    // this.earthCtrl.Analysis.spaceDistance(colorAll, () => {});
    var terrain = new SmartEarth.Cesium.CesiumTerrainProvider({
      url: config.moonTerrain,
      tilingScheme: new SmartEarth.Cesium.GeographicTilingScheme({
        ellipsoid: SmartEarth.Cesium.Ellipsoid.MOON,
      }),
    });
    Viewer.terrainProvider = terrain;
    Viewer.scene.globe.terrainExaggeration = 5;
    server.AddWmtesLayer(config.moonWmts);
    // server.AddTmsLayer(config.moonTms);
    // server.AddGeoWmsLayer();
    // var param = {
    //     name: labelName,
    //     id: earthCtrl.factory.createUUID(),
    //     text: "文字工具",
    //     font: '50pt monospace',
    //     outlineWidth: 2,
    //     fillColor: SmartEarth.Cesium.Color.RED,
    //     lon: 47.5087,
    //     lat: 23.6963,
    //     alt: 10
    // };
    // labelEntity = earthCtrl.factory.createLabel(param);
    // server.AddTmsLayer('http://localhost:8080/abc');
    // earthCtrl.camera.flyTo(47.5087, 23.6963, 300, 9.5, -45, 0.0, 5);
    // //添加鼠标左击事件
    // this.addMouseLeftClickEvents();
    // this.addMouseMouseMoveEvents();
    window.setLayer();
    sgworld.Navigate.Stop(); //取消飞行状态
    sgworld.Navigate.setPosition(-1093596.38, 5729026.12, 4136590.41);
  },
  //鼠标左键点击事件添加
  addMouseLeftClickEvents() {