1
suerprisePlus
2024-06-06 7acf7ad6948e3e952173a2551ea4a92a8ff56c35
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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;