月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-06-06 b035823c711d43902a06838065598f4f805ab408
src/assets/js/Map/index.js
@@ -2,33 +2,62 @@
import config from "./config";
//服务加载配置文件
import server from "./server";
const InitMap = {
    sgworld: null,
    earthCtrl: null,
    Viewer: null,
    //地图初始化
    init3DMap() {
        //设置月球坐标系
        Cesium.Ellipsoid.WGS84 = new Cesium.Ellipsoid(
        SmartEarth.Cesium.Ellipsoid.WGS84 = new SmartEarth.Cesium.Ellipsoid(
            1737400.0,
            1737400.0,
            1737400.0
        );
        //页面初始化
        this.sgworld = new SmartEarth.SGWorld("cesiumContainer", {
            url: SmartEarthRootUrl + config.imgUrl,
            licenseServer: config.licenseServer,
            infoBox: false,
        this.earthCtrl = new SmartEarth.EarthCtrl("cesiumContainer", {
            licenseServer: "https://cim.smartearth.cn/",
            StaticFileBaseUrl: "/CIMSDK/"
        });
        this.Viewer = this.sgworld._Viewer;
        window.sgworld = this.sgworld;
        window.Viewer = this.Viewer;
        //显示fps
        sgworld._Viewer.scene.debugShowFramesPerSecond = false;
        //添加月球初始化切片服务
        this.Viewer = this.earthCtrl._Viewer;
        window.earthCtrl = this.earthCtrl;
        window.Viewer = this.earthCtrl._Viewer;
        Viewer.imageryLayers.removeAll();
        Viewer.scene.globe.showGroundAtmosphere = false;
        // 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);
        // 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(config.moonTms);
        //添加鼠标左击事件
        this.addMouseLeftClickEvents();
        this.addMouseMouseMoveEvents();
        // server.AddTmsLayer('http://localhost:8080/abc');
        // earthCtrl.camera.flyTo(47.5087, 23.6963, 300, 9.5, -45, 0.0, 5);
        // //添加鼠标左击事件
        // this.addMouseLeftClickEvents();
        // this.addMouseMouseMoveEvents();
    },
    //鼠标左键点击事件添加
    addMouseLeftClickEvents() {