suerprisePlus
2024-12-17 5dfcbd19cd041e1f8a5fb7ed9ab694bf4de00352
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
 
var _mapConfig = _interopRequireDefault(require("./mapConfig"));
 
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
 
var tileset;
var mapServer = {
  listData: [],
  sourceType: null,
  tileContent: null,
  init: function init() {},
  addServer: function addServer(res) {
    this.sourceType = res.sourceType;
 
    switch (this.sourceType) {
      case "arcgis":
        this.addArcgisServer(res);
        break;
 
      case "geoserver":
        this.addGeoServer(res);
        break;
 
      case "tms":
        this.addTmsLayer(res);
        break;
 
      case "wfs":
        this.addWfsLayer(res);
        break;
 
      case "Tileset":
        this.addTileSetLayer(res);
        break;
 
      case "PointWfs":
        this.addPointWfsLayer(res);
        break;
 
      case "PolylineWfs":
        this.addPolylineWfsLayer(res);
        break;
 
      case "PolylineWfs2":
        this.addPolylineWfsLayer(res);
        break;
 
      case "PolygonWfs":
        this.addpolygonWfsLayer(res);
        break;
    }
  },
  addpolygonWfsLayer: function addpolygonWfsLayer(res) {
    var layer = earthCtrl.factory.createWfsLayer("polygon", {
      urls: res.url,
      layer: res.layer,
      width: 1,
      outlineColor: "#FF0000",
      alpha: 0.2,
      height: 500,
      color: "#FF0000"
    });
    this.listData.push({
      layer: layer,
      type: this.sourceType,
      layerId: res.id ? res.id : earthCtrl.factory.createUUID()
    });
  },
  addPolylineWfsLayer: function addPolylineWfsLayer(res) {
    var layer = earthCtrl.factory.createWfsLayer("polyline", {
      urls: res.url,
      layer: res.layer,
      width: 2,
      color: res.color,
      classificationType: false
    });
    this.listData.push({
      layer: layer,
      type: this.sourceType,
      layerId: res.id ? res.id : earthCtrl.factory.createUUID()
    });
  },
  addPointWfsLayer: function addPointWfsLayer(res) {
    var layer = earthCtrl.factory.createWfsLayer("point", {
      urls: res.url,
      layer: res.layer,
      text: res.text,
      color: res.color,
      scale: 2,
      blod: true,
      disableDepthTestDistance: Infinity
    });
    this.listData.push({
      layer: layer,
      type: this.sourceType,
      layerId: res.id ? res.id : earthCtrl.factory.createUUID()
    });
  },
  remoServer: function remoServer(res) {
    for (var i = 0; i < this.listData.length; i++) {
      var obj = this.listData[i];
 
      if (obj.type == res.sourceType) {
        if (obj.type == "PointWfs" || obj.type == "PolylineWfs" || obj.type == "PolylineWfs2" || obj.type == "PolygonWfs") {
          obj.layer.destroy();
        } else {
          obj.layer.removeFromMap();
        }
 
        this.listData.splice(i, 1);
        i = i - 1;
      }
    }
  },
  addTileSetLayer: function addTileSetLayer(res) {
    //   const tileset =  earthCtrl.factory.create3DTilesets({
    //     url: res.url
    // });
    var tileset = Viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
      url: res.url
    }));
    tileset.name = res.name; // const tileset = new Cesium.Cesium3DTileset({
    //   url: res.url
    // });
    // earthCtrl.primitives.add(tileset);
 
    this.listData.push({
      layer: tileset,
      type: this.sourceType,
      layerId: res.id,
      name: res.name
    });
  },
  traverseVisibleTiles: function traverseVisibleTiles() {
    tileset.readyPromise.then(function (tileset) {
      tileset.tileVisibility.forEachTile(function (tile) {});
    });
  },
  addWfsLayer: function addWfsLayer(res) {
    var layer = earthCtrl.factory.createWfsLayer("polygon", {
      urls: res.url,
      layer: res.layer,
      outlineColor: res.outlineColor,
      alpha: res.alpha
    });
    this.listData.push({
      layer: layer,
      type: this.sourceType
    });
  },
  addTmsLayer: function addTmsLayer(res) {
    var layer = earthCtrl.factory.createImageryLayer({
      sourceType: "tms",
      url: res.url
    });
    this.listData.push({
      layer: layer,
      type: this.sourceType
    });
  },
  addArcgisServer: function addArcgisServer(res) {
    var layer = earthCtrl.factory.createImageryLayer({
      sourceType: "arcgis",
      url: res.url
    });
    this.listData.push({
      layer: layer,
      type: this.sourceType
    });
  },
  addGeoServer: function addGeoServer(res) {
    var layer = earthCtrl.factory.createWfsLayer("polygon", {
      urls: res.url,
      layer: res.layerF,
      color: "#de3",
      extrudedHeight: 30 // 拉伸高度,无拉伸高度则为贴地面
 
    });
    this.listData.push({
      layer: layer,
      type: this.sourceType
    });
  }
};
var _default = mapServer;
exports["default"] = _default;