1
suerprisePlus
2024-06-06 7acf7ad6948e3e952173a2551ea4a92a8ff56c35
src/assets/js/map/mapView.js
@@ -1,18 +1,31 @@
import mapServer from "./mapServer";
const mapViewer = {
  initMap() {
       var earthCtrl = new SmartEarth.EarthCtrl("cesiumContainer", {
            StaticFileBaseUrl: config.StaticFileBaseUrl,
    window.earthCtrl = new SmartEarth.EarthCtrl("sdkContainer", {
      // 隐藏默认底图
      defaultImagery: false,
      // 隐藏logo
      printLog: false
      // sceneMode: SmartEarth.Cesium.SceneMode.SCENE2D
        });
  },
  setMapLocaTion(res) {
    window.Cesium = SmartEarth.Cesium;
    window.Viewer = earthCtrl.viewer;
    Viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString("#A9A9A9"); //设置地球颜色
    // 清空默认底图
    Viewer.imageryLayers.removeAll();
    
  },
    mapServer.addServer({
      sourceType: "arcgis",
      url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
    });
    // mapServer.addServer({
    //   sourceType: "geoserver",
    //   url: "https://cim.smartearth.cn/geoserver/PolygonFeature/ows",
    //   layer: "PolygonFeature:GeoEntity"
    // });
}
};
export default mapViewer;