import mapConfig from "./mapConfig"; const mapServer = { listData: [], sourceType: null, init() {}, addServer(res) { this.sourceType = res.sourceType; console.log(this.sourceType); switch (this.sourceType) { case "arcgis": this.addArcgisServer(res); break; case "geoserver": this.addGeoServer(res); break; case "tms": this.addTmsLayer(res); break; } }, addTmsLayer(res) { console.log(res.url); var layer = earthCtrl.factory.createImageryLayer({ sourceType: "tms", url: "http://test.smartearth.cn:9037/gisserver/tmsserver/SubicBayArea", }); this.listData.push({ layer: layer, type: this.sourceType }); mapConfig.flyToImageryLayer(layer) }, addArcgisServer(res) { const layer = earthCtrl.factory.createImageryLayer({ sourceType: "arcgis", url: res.url }); this.listData.push({ layer: layer, type: this.sourceType }); }, addGeoServer(res) { const layer = earthCtrl.factory.createWfsLayer("polygon", { urls: res.url, layer: res.layerF, color: "#de3", extrudedHeight: 30 // 拉伸高度,无拉伸高度则为贴地面 }); this.listData.push({ layer: layer, type: this.sourceType }); } }; export default mapServer;