nnnjjj123
2020-11-17 1b2c1edb61190eeb19f465ff031eaa3b2a1b8dbc
jimu.js/MapManager.js
@@ -21,6 +21,7 @@
            appConfig: null,
            mapDivId: '',
            map: null,
            baseLayer: null,
            constructor: function ( /*Object*/ options, mapDivId) {
                this.appConfig = options.appConfig;
@@ -78,7 +79,6 @@
            _createMap: function (mode, appConfig) {
                // define(["../libs/Cesium1.68/CesiumNavigation.umd "], function () { });
                Cesium.Ion.defaultAccessToken = appConfig.cesiumToken;
                //加载底图和地形配置
                appConfig.map.mapOptions["imageryProviderViewModels"] = this._getImageryProviderArr(appConfig);
@@ -86,10 +86,11 @@
                //创建地图
                var dcViewer = new DC.Viewer(this.mapDivId, appConfig.map.mapOptions);
                this.map = dcViewer.delegate;
                this.baseLayer = "nihao";
                // this.map.extend(Cesium.viewerDragDropMixin);
                this.map.scene.globe.depthTestAgainstTerrain = false;
                this.map.scene.logarithmicDepthBuffer = false;
                this.map.scene.globe.baseColor = Cesium.Color.WHITESMOKE ;
                this.map.scene.globe.baseColor = Cesium.Color.BLACK;
                window.viewer = this.map;
                window.dcViewer = dcViewer;
                var imageryLayers = this.map.imageryLayers;
@@ -126,7 +127,6 @@
                $(".cesium-baseLayerPicker-sectionTitle").eq(0).html("底图");
                $(".cesium-baseLayerPicker-sectionTitle").eq(1).html("地形");
                //对外暴露的公共接口
                topic.subscribe("gis/map/setCenter", lang.hitch(this, this.centerAt));
                //对外暴露的公共接口
@@ -153,6 +153,34 @@
                        }
                        else if (layerConfig.type == "wmts") {
                            layer = new Cesium.WebMapTileServiceImageryProvider(layerConfig);
                        }
                        else if (layerConfig.type == "gg") {
                            layer = DC.ImageryLayerFactory.createGoogleImageryLayer()
                        }
                        else if (layerConfig.type == "baidu") {
                            layer = DC.ImageryLayerFactory.createBaiduImageryLayer()
                        }
                        else if (layerConfig.type == "gaod") {
                            layer = DC.ImageryLayerFactory.createAmapImageryLayer()
                        }
                        else if (layerConfig.type == "tenx") {
                            layer = DC.ImageryLayerFactory.createTencentImageryLayer()
                        }
                        else if (layerConfig.type == "gis") {
                            layer = DC.ImageryLayerFactory.createArcGisImageryLayer({
                                url:
                                    'http://cache1.arcgisonline.cn/arcgis/rest/services/SimpleFeature/ChinaBoundaryLine/MapServer'
                            })
                        }
                        else if (layerConfig.type == "mapbox") {
                            layer = new Cesium.MapboxImageryProvider({
                                mapId: 'mapbox.country-boundaries-v1',
                                accessToken:'pk.eyJ1Ijoibm5uampqMTIzNDU2IiwiYSI6ImNraDV3YzJlYTFtdnEycmxxaXZpem1tM3cifQ.qaBhT3T_VTxXbeoRAVTkwg'
                            })
                        }
                        layerArr.push(layer);
                    }
@@ -316,9 +344,9 @@
                    //     });
                    // }), 100);
                    //无动画的
                    setTimeout(lang.hitch(this,function(){
                        this.map.camera.setView({destination:Cesium.Rectangle.fromDegrees(west, south, east, north)});
                    }),100);
                    setTimeout(lang.hitch(this, function () {
                        this.map.camera.setView({ destination: Cesium.Rectangle.fromDegrees(west, south, east, north) });
                    }), 100);
                    //修改全局的homebutton定位
                    Cesium.Camera.DEFAULT_VIEW_RECTANGLE = Cesium.Rectangle.fromDegrees(west, south, east, north);