@mapgis/webclient-vue-cesium 10.5.5-1 → 10.5.5-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +46 -49
  2. package/dist-libs/webclient-vue-cesium.common.js +191087 -0
  3. package/dist-libs/webclient-vue-cesium.css +1 -1
  4. package/dist-libs/webclient-vue-cesium.umd.js +191097 -0
  5. package/dist-libs/webclient-vue-cesium.umd.min.js +204 -194
  6. package/docs/.vuepress/config.js +47 -46
  7. package/docs/README.md +5 -4
  8. package/docs/api/analysis/Aspect.md +236 -0
  9. package/docs/api/analysis/Contour.md +240 -0
  10. package/docs/api/analysis/CutFill.md +306 -0
  11. package/docs/api/analysis/DynamicSection.md +336 -0
  12. package/docs/api/analysis/Excavate.md +3 -11
  13. package/docs/api/analysis/Flood.md +177 -200
  14. package/docs/api/analysis/HeightLimited.md +7 -4
  15. package/docs/api/analysis/ParticleEffects.md +549 -0
  16. package/docs/api/analysis/Profile.md +464 -0
  17. package/docs/api/analysis/Shadow.md +76 -13
  18. package/docs/api/analysis/Sightline.md +66 -13
  19. package/docs/api/analysis/Skyline.md +144 -29
  20. package/docs/api/analysis/Slope.md +236 -0
  21. package/docs/api/analysis/Viewshed.md +100 -21
  22. package/docs/api/layer/IGServer/IgsDocLayer.md +10 -0
  23. package/docs/api/layer/IGServer/IgsFeatureLayer.md +253 -0
  24. package/docs/api/layer/IGServer/IgsTileLayer.md +11 -0
  25. package/docs/api/layer/OGC/CesiumOgcWmsLayer.md +20 -19
  26. package/docs/api/layer/OGC/Wms.png +0 -0
  27. package/docs/api/layer/marker/DynamicMarker.md +81 -0
  28. package/docs/api/layer/marker/dynamicmarker.png +0 -0
  29. package/docs/api/layer/marker/selects.png +0 -0
  30. package/docs/api/layer/vectortile/vectortile.md +10 -0
  31. package/docs/api/m3d/image/layer_control_1.png +0 -0
  32. package/docs/api/m3d/image/layer_control_2.png +0 -0
  33. package/docs/api/m3d/image/layer_control_3.png +0 -0
  34. package/docs/api/m3d/m3d.md +13 -2
  35. package/docs/api/service/comprehensiveQuery/comprehensiveQuery.md +946 -0
  36. package/docs/api/ui/draw.md +68 -40
  37. package/docs/api/ui/link.md +8 -1
  38. package/docs/api/ui/marker.md +19 -1
  39. package/docs/api/ui/measure.md +82 -10
  40. package/docs/api/ui/table.md +6 -6
  41. package/docs/guide/README.md +26 -23
  42. package/docs/guide/basemap.md +35 -33
  43. package/docs/guide/markers&popups.md +46 -53
  44. package/docs/plugin_components/create_storybook.md +241 -0
  45. package/docs/plugin_components/img.png +0 -0
  46. package/docs/plugin_components/img_1.png +0 -0
  47. package/docs/plugin_components/img_10.png +0 -0
  48. package/docs/plugin_components/img_2.png +0 -0
  49. package/docs/plugin_components/img_3.png +0 -0
  50. package/docs/plugin_components/img_4.png +0 -0
  51. package/docs/plugin_components/img_5.png +0 -0
  52. package/docs/plugin_components/img_6.png +0 -0
  53. package/docs/plugin_components/img_7.png +0 -0
  54. package/docs/plugin_components/img_8.png +0 -0
  55. package/docs/version/diff.md +4 -4
  56. package/docs/version/version.md +81 -0
  57. package/package.json +5 -5
  58. package/src/cdn/cdn_component.js +62 -0
  59. package/src/component.js +20 -2
  60. package/src/components/Analysis/Aspect.vue +318 -0
  61. package/src/components/Analysis/Contour.vue +257 -0
  62. package/src/components/Analysis/CutFill.vue +581 -0
  63. package/src/components/Analysis/DynamicCutting.vue +98 -59
  64. package/src/components/Analysis/DynamicSection.vue +494 -0
  65. package/src/components/Analysis/Excavate.vue +133 -87
  66. package/src/components/Analysis/Flood.vue +395 -487
  67. package/src/components/Analysis/Flood.vue-- +630 -0
  68. package/src/components/Analysis/HeightLimited.vue +66 -47
  69. package/src/components/Analysis/ModelFlatten.vue +2 -2
  70. package/src/components/Analysis/Profile.vue +503 -0
  71. package/src/components/Analysis/Shadow.vue +220 -309
  72. package/src/components/Analysis/Sightline.vue +393 -375
  73. package/src/components/Analysis/SkyLine.vue +283 -93
  74. package/src/components/Analysis/Slope.vue +317 -0
  75. package/src/components/Analysis/Viewshed.vue +806 -373
  76. package/src/components/Analysis/skyline2dChartOptions.js +66 -0
  77. package/src/components/DataSource/Geojson/GeoJsonDataSource.vue +201 -3
  78. package/src/components/Layer/GeoJSON/GeoJsonLayer.vue +345 -0
  79. package/src/components/Layer/IGServer/IgsFeatureLayer.vue +227 -0
  80. package/src/components/Layer/Marker/DynamicMarkerLayer.vue +487 -0
  81. package/src/components/Layer/Marker/Marker3dPro.vue +196 -0
  82. package/src/components/Layer/Marker/Marker3dSetPro.vue +67 -0
  83. package/src/components/Layer/VectorTile/VectorTileLayer.vue +117 -33
  84. package/src/components/Layer/VectorTile/VectorTileOptions.js +1 -1
  85. package/src/components/M3D/3DTilesetOptions.js +23 -1
  86. package/src/components/M3D/G3D.vue +150 -0
  87. package/src/components/M3D/M3d.vue +142 -32
  88. package/src/components/M3D/M3dSet.vue +118 -0
  89. package/src/components/M3D/M3dType.js +24 -0
  90. package/src/components/Overlay/Mapv3dLayer.vue +2 -0
  91. package/src/components/Overlay/ParticleEffects.vue +545 -0
  92. package/src/components/Overlay/mapv/MapvBaseLayer.js +351 -172
  93. package/src/components/Overlay/mapv/MapvLayer.js +372 -324
  94. package/src/components/Overlay/mapv/SuperCluster.js +611 -0
  95. package/src/components/Overlay/themeLayer/heater/CesiumHeater.vue +152 -0
  96. package/src/components/Overlay/themeLayer/heater/MapvHeater.vue +161 -0
  97. package/src/components/UI/Controls/Draw/Draw.vue +320 -92
  98. package/src/components/UI/Controls/Legend/Legend.vue +55 -51
  99. package/src/components/UI/Controls/Link/Link.vue +59 -37
  100. package/src/components/UI/Controls/Measure/Measure.vue +75 -33
  101. package/src/components/UI/Controls/Measure/components/MeasureResult.vue +71 -0
  102. package/src/components/UI/Controls/Measure/components/MeasureSetting.vue +63 -0
  103. package/src/components/UI/Controls/Measure/components/MeasureTool.vue +155 -0
  104. package/src/components/UI/Geojson/Popup.vue +101 -0
  105. package/src/components/UI/Marker/Marker.vue +185 -48
  106. package/src/components/UI/Popup/Popup.vue +21 -64
  107. package/src/components/Utils/common/color-util.js +159 -0
  108. package/src/components/Utils/util.js +311 -231
  109. package/src/components/WebGlobe/manager.js +81 -3
  110. package/src/components/WebGlobe/mixins/withPrivateMethods.js +4 -2
  111. package/src/components/WebGlobe/util.js +173 -0
  112. package/src/components/service/comprehensive-query/ComprehensiveQuery.vue +156 -0
  113. package/src/components/service/comprehensive-query/PlaceNameCesium.vue +102 -0
  114. package/src/components/service/comprehensive-query/util/catalog/document.js +626 -0
  115. package/src/components/service/comprehensive-query/util/feature/arcgis-feature-query.js +448 -0
  116. package/src/components/service/comprehensive-query/util/feature/feature-convert.js +408 -0
  117. package/src/components/service/comprehensive-query/util/feature/feature-edit.js +50 -0
  118. package/src/components/service/comprehensive-query/util/feature/feature-geojson.js +100 -0
  119. package/src/components/service/comprehensive-query/util/feature/feature-query.js +723 -0
  120. package/src/components/service/comprehensive-query/util/feature/feature.js +1 -0
  121. package/src/components/service/comprehensive-query/util/feature/index.js +9 -0
  122. package/src/components/service/comprehensive-query/util/objects/geometry.js +58 -0
  123. package/src/components/Overlay/Mapv.vue +0 -142
  124. package/src/components/Overlay/MapvHeater.vue +0 -98
@@ -0,0 +1,626 @@
1
+ // @ts-nocheck
2
+ import * as Zondy from "@mapgis/webclient-es6-service";
3
+ import axios from "axios";
4
+ export default class DocumentCatalog {
5
+ /**
6
+ * 获取瓦片列表
7
+ * @param {Object} param
8
+ * @param {string} param.ip 服务器IP
9
+ * @param {Number} param.port 服务端口
10
+ */
11
+ static getTiles({ ip, port }) {
12
+ const url = `http://${ip}:${port}/igs/rest/mrcs/tiles?version=2&f=json`;
13
+ const promise = new Promise((resolve, reject) => {
14
+ axios.get(url).then(
15
+ res => {
16
+ const { data } = res;
17
+ if (!data) {
18
+ resolve(undefined);
19
+ } else {
20
+ resolve(data);
21
+ }
22
+ },
23
+ error => {
24
+ reject(error);
25
+ }
26
+ );
27
+ });
28
+ return promise.then(data => {
29
+ return data;
30
+ });
31
+ }
32
+ /**
33
+ * 获取地图列表
34
+ * @param {Object} param
35
+ * @param {string} param.ip 服务器IP
36
+ * @param {Number} param.port 服务端口
37
+ */
38
+ static getDocs({ ip, port }) {
39
+ const url = `http://${ip}:${port}/igs/rest/mrcs/docs?version=2&f=json`;
40
+ const promise = new Promise((resolve, reject) => {
41
+ axios.get(url).then(
42
+ res => {
43
+ const { data } = res;
44
+ if (!data) {
45
+ resolve(undefined);
46
+ } else {
47
+ resolve(data);
48
+ }
49
+ },
50
+ error => {
51
+ reject(error);
52
+ }
53
+ );
54
+ });
55
+ return promise.then(data => {
56
+ return data;
57
+ });
58
+ }
59
+ static getDocInfo(option) {
60
+ if (!option.serverName) {
61
+ return null;
62
+ }
63
+ if (this.globalDocInfo[option.serverName]) {
64
+ return this.globalDocInfo[option.serverName];
65
+ }
66
+ let domain = option.domain || null;
67
+ if (!domain) {
68
+ const protocol = option.protocol || "http";
69
+ const ip = option.ip;
70
+ const port = option.port;
71
+ domain = `${protocol}://${ip}:${port}`;
72
+ }
73
+ const url = `${domain}/igs/rest/mrcs/docs/${
74
+ option.serverName
75
+ }?dataService=${option.serverName}&f=json&tree=true&guid=${option.guid ||
76
+ "__readonly_user__"}`;
77
+ const self = this;
78
+ const promise = new Promise((resolve, reject) => {
79
+ axios.get(url).then(
80
+ res => {
81
+ const { data } = res;
82
+ if (!data) {
83
+ resolve(undefined);
84
+ } else {
85
+ for (let i = 0; i < data.MapInfos.length; i += 1) {
86
+ const { CatalogLayer } = data.MapInfos[i];
87
+ if (CatalogLayer) {
88
+ data.MapInfos[i].CatalogLayer = self.disposeDocInfo(
89
+ CatalogLayer
90
+ );
91
+ }
92
+ }
93
+ self.globalDocInfo[option.serverName] = data;
94
+ resolve(data);
95
+ }
96
+ },
97
+ error => {
98
+ reject(error);
99
+ }
100
+ );
101
+ });
102
+ return promise.then(data => {
103
+ return data;
104
+ });
105
+ }
106
+ static get3dDocInfo(option) {
107
+ if (!option.serverName) {
108
+ return null;
109
+ }
110
+ if (this.globalDocInfo[option.serverName]) {
111
+ return this.globalDocInfo[option.serverName];
112
+ }
113
+ let domain = option.domain || null;
114
+ if (!domain) {
115
+ const protocol = option.protocol || "http";
116
+ const ip = option.ip;
117
+ const port = option.port;
118
+ domain = `${protocol}://${ip}:${port}`;
119
+ }
120
+ const url = `${domain}/igs/rest/g3d/${option.serverName}/GetDocInfo`;
121
+ const self = this;
122
+ const promise = new Promise((resolve, reject) => {
123
+ axios.get(url).then(
124
+ res => {
125
+ const { data } = res;
126
+ if (!data) {
127
+ resolve(undefined);
128
+ } else {
129
+ self.globalDocInfo[option.serverName] = data;
130
+ resolve(data);
131
+ }
132
+ },
133
+ error => {
134
+ reject(error);
135
+ }
136
+ );
137
+ });
138
+ return promise.then(data => {
139
+ return data;
140
+ });
141
+ }
142
+ /**
143
+ * 获取矢量地图或瓦片数据信息
144
+ * @param {Object} param
145
+ * @param {string} param.ip 服务器IP
146
+ * @param {Number} param.port 服务端口
147
+ * @param {string} param.name 服务名
148
+ */
149
+ static getMapInfoService({ ip, port, name }) {
150
+ const url = `http://${ip}:${port}/igs/rest/mrms/info/${name}?guid=`;
151
+ const promise = new Promise((resolve, reject) => {
152
+ axios.get(url).then(
153
+ res => {
154
+ const { data } = res;
155
+ if (!data) {
156
+ resolve(undefined);
157
+ } else {
158
+ resolve(data);
159
+ }
160
+ },
161
+ error => {
162
+ reject(error);
163
+ }
164
+ );
165
+ });
166
+ return promise.then(data => {
167
+ return data;
168
+ });
169
+ }
170
+ /**
171
+ * 递归给地图文档的图层赋值layerIndex
172
+ * @param vectorInfo
173
+ * @param layerIndex // 图层组的layerIndex赋值采用多级:上级layerIndex-i
174
+ */
175
+ static disposeDocInfo(vectorInfo, layerIndex) {
176
+ if (!vectorInfo) {
177
+ return [];
178
+ }
179
+ for (let i = 0; i < vectorInfo.length; i += 1) {
180
+ const tip =
181
+ layerIndex && layerIndex !== "" ? `${layerIndex}-${i}` : String(i);
182
+ if (vectorInfo[i].Type === "Layer") {
183
+ vectorInfo[i].layerIndex = tip;
184
+ } else if (vectorInfo[i].Type === "Group") {
185
+ const groupMapLayerInfo = vectorInfo[i].GroupMapLayerInfo;
186
+ if (groupMapLayerInfo) {
187
+ vectorInfo[i].GroupMapLayerInfo = this.disposeDocInfo(
188
+ groupMapLayerInfo,
189
+ tip
190
+ );
191
+ }
192
+ }
193
+ }
194
+ return vectorInfo;
195
+ }
196
+ /**
197
+ * 获取图层索引列表,匹配图层URL,支持按名称列表和行政区划代码列表
198
+ * @param data [in] MapInfoCatalogLayer类型的数组
199
+ * @param layerName [in] 图层名称列表:以逗号分隔,匹配图层URL
200
+ * @param code [in] 行政区代码列表:以逗号分隔,匹配图层URL
201
+ * @param array [out] 图层索引列表
202
+ * @param urlArray [int out] 图层URL列表
203
+ * @returns 图层索引列表
204
+ */
205
+ static getLayerIndexesByNamesOrCodes(
206
+ data,
207
+ layerName = "",
208
+ code = "",
209
+ array = [],
210
+ urlArray = []
211
+ ) {
212
+ array = array || [];
213
+ urlArray = urlArray || [];
214
+ if (layerName !== "" || code !== "") {
215
+ for (let i = 0; i < data.length; i += 1) {
216
+ const { URL, layerIndex, GroupMapLayerInfo } = data[i];
217
+ if (data[i].Type === "Layer") {
218
+ if (code === "") {
219
+ let layerNames = [];
220
+ if (layerName.includes(",")) {
221
+ layerNames = layerName.split(",");
222
+ } else {
223
+ layerNames = [layerName];
224
+ }
225
+ for (let j = 0; j < layerNames.length; j += 1) {
226
+ if (
227
+ URL &&
228
+ URL.indexOf(layerNames[j]) === URL.length - layerNames[j].length
229
+ ) {
230
+ if (!urlArray.includes(URL)) {
231
+ urlArray.push(URL);
232
+ if (layerIndex) {
233
+ array.push(layerIndex);
234
+ }
235
+ }
236
+ }
237
+ }
238
+ } else if (layerName === "") {
239
+ let codes = [];
240
+ if (code.includes(",")) {
241
+ codes = code.split(",");
242
+ } else {
243
+ codes = [code];
244
+ }
245
+ for (let j = 0; j < codes.length; j += 1) {
246
+ if (URL && URL.includes(codes[j])) {
247
+ if (!urlArray.includes(URL)) {
248
+ urlArray.push(URL);
249
+ if (layerIndex) {
250
+ array.push(layerIndex);
251
+ }
252
+ }
253
+ }
254
+ }
255
+ } else if (
256
+ URL &&
257
+ URL.indexOf(layerName) === URL.length - layerName.length &&
258
+ URL.includes(code)
259
+ ) {
260
+ if (!urlArray.includes(URL)) {
261
+ urlArray.push(URL);
262
+ if (layerIndex) {
263
+ array.push(layerIndex);
264
+ }
265
+ }
266
+ }
267
+ } else if (GroupMapLayerInfo && GroupMapLayerInfo.length > 0) {
268
+ array = this.getLayerIndexesByNamesOrCodes(
269
+ GroupMapLayerInfo,
270
+ layerName,
271
+ code,
272
+ array,
273
+ urlArray
274
+ );
275
+ }
276
+ }
277
+ } else {
278
+ for (let i = 0; i < data.length; i += 1) {
279
+ const { layerIndex, GroupMapLayerInfo } = data[i];
280
+ if (data[i].Type === "Layer") {
281
+ if (layerIndex) {
282
+ array.push(layerIndex);
283
+ }
284
+ } else if (GroupMapLayerInfo && GroupMapLayerInfo.length > 0) {
285
+ array = this.getLayerIndexesByNamesOrCodes(
286
+ GroupMapLayerInfo,
287
+ layerName,
288
+ code,
289
+ array,
290
+ urlArray
291
+ );
292
+ }
293
+ }
294
+ }
295
+ return array;
296
+ }
297
+ /**
298
+ * 获取图层URL列表,匹配URL,支持按图层名和行政区划代码
299
+ * @param data [in] MapInfoCatalogLayer类型的数组
300
+ * @param layerName [in] 图层名称列表:以逗号分隔,匹配图层URL
301
+ * @param code [in] 行政区代码列表:以逗号分隔,匹配图层URL
302
+ * @param urlArray [int out] 图层URL(GDBP)列表
303
+ * @returns 图层URL(GDBP)列表
304
+ */
305
+ static getLayerUrlsByNamesOrCodes(data, layerName, code, urlArray) {
306
+ urlArray = urlArray || [];
307
+ if (layerName !== "" || code !== "") {
308
+ for (let i = 0; i < data.length; i += 1) {
309
+ const { URL, GroupMapLayerInfo } = data[i];
310
+ if (data[i].Type === "Layer") {
311
+ if (code === "") {
312
+ let layerNames = [];
313
+ if (layerName.includes(",")) {
314
+ layerNames = layerName.split(",");
315
+ } else {
316
+ layerNames = [layerName];
317
+ }
318
+ for (let j = 0; j < layerNames.length; j += 1) {
319
+ if (
320
+ URL &&
321
+ URL.indexOf(layerNames[j]) === URL.length - layerNames[j].length
322
+ ) {
323
+ if (!urlArray.includes(URL)) {
324
+ urlArray.push(URL);
325
+ }
326
+ }
327
+ }
328
+ } else if (layerName === "") {
329
+ let codes = [];
330
+ if (code.includes(",")) {
331
+ codes = code.split(",");
332
+ } else {
333
+ codes = [code];
334
+ }
335
+ for (let j = 0; j < codes.length; j += 1) {
336
+ if (URL && URL.includes(codes[j])) {
337
+ if (!urlArray.includes(URL)) {
338
+ urlArray.push(URL);
339
+ }
340
+ }
341
+ }
342
+ } else if (
343
+ URL &&
344
+ URL.indexOf(layerName) === URL.length - layerName.length &&
345
+ URL.includes(code)
346
+ ) {
347
+ if (!urlArray.includes(URL)) {
348
+ urlArray.push(URL);
349
+ }
350
+ }
351
+ } else if (GroupMapLayerInfo && GroupMapLayerInfo.length > 0) {
352
+ urlArray = this.getLayerUrlsByNamesOrCodes(
353
+ GroupMapLayerInfo,
354
+ layerName,
355
+ code,
356
+ urlArray
357
+ );
358
+ }
359
+ }
360
+ } else {
361
+ for (let i = 0; i < data.length; i += 1) {
362
+ const { URL, GroupMapLayerInfo } = data[i];
363
+ if (data[i].Type === "Layer") {
364
+ if (URL) {
365
+ urlArray.push(URL);
366
+ }
367
+ } else if (GroupMapLayerInfo && GroupMapLayerInfo.length > 0) {
368
+ urlArray = this.getLayerUrlsByNamesOrCodes(
369
+ GroupMapLayerInfo,
370
+ layerName,
371
+ code,
372
+ urlArray
373
+ );
374
+ }
375
+ }
376
+ }
377
+ return urlArray;
378
+ }
379
+ /**
380
+ * 根据图层索引列表获取图层列表
381
+ * @param layerIdxs [in] 图层索引列表,以逗号分隔.图层索引为igs返回的DocInfo中定义的索引,
382
+ * 对图层进行查询、编辑时,通过该索引指定图层。
383
+ * @param sourceLayerInfoArray [in] 源图层信息列表,待过滤的图层
384
+ * @param destLayerInfoArray [in out] 目标图层列表,与layerIdxs对应的图层列表。
385
+ * @returns 目标图层列表,与layerIdxs对应的图层列表。
386
+ */
387
+ static getLayersByIndexes(
388
+ layerIdxs,
389
+ sourceLayerInfoArray,
390
+ destLayerInfoArray = []
391
+ ) {
392
+ // 图层索引号数组
393
+ if (!layerIdxs || layerIdxs === "" || !sourceLayerInfoArray) {
394
+ return [];
395
+ }
396
+ if (!destLayerInfoArray) {
397
+ destLayerInfoArray = [];
398
+ }
399
+ let layerIdxsArr = [];
400
+ if (layerIdxs.includes(",")) {
401
+ layerIdxsArr = layerIdxs.split(",");
402
+ } else {
403
+ layerIdxsArr = [layerIdxs];
404
+ }
405
+ for (let i = 0; i < sourceLayerInfoArray.length; i += 1) {
406
+ for (let m = 0; m < layerIdxsArr.length; m += 1) {
407
+ if (layerIdxsArr[m] === sourceLayerInfoArray[i].layerIndex) {
408
+ destLayerInfoArray.push(sourceLayerInfoArray[i]);
409
+ }
410
+ }
411
+ if (sourceLayerInfoArray[i].Type === "Group") {
412
+ const { GroupMapLayerInfo } = sourceLayerInfoArray[i];
413
+ if (GroupMapLayerInfo) {
414
+ destLayerInfoArray = this.getLayersByIndexes(
415
+ layerIdxs,
416
+ GroupMapLayerInfo,
417
+ destLayerInfoArray
418
+ );
419
+ }
420
+ }
421
+ }
422
+ return destLayerInfoArray;
423
+ }
424
+ /**
425
+ * 获取图层URL列表,匹配URL,支持按图层名
426
+ * @param data [in] MapInfoCatalogLayer类型的数组
427
+ * @param names [in] 图层名称列表:以逗号分隔,匹配图层URL
428
+ * @param urlArray [int out] 图层URL(GDBP)列表
429
+ * @returns 图层URL(GDBP)列表
430
+ */
431
+ static getLayerIndexesByNames(data, names, urlArray) {
432
+ if (names === "") {
433
+ return [];
434
+ }
435
+ urlArray = urlArray || [];
436
+ let tempNames;
437
+ if (names.includes(",")) {
438
+ tempNames = names.split(",");
439
+ } else {
440
+ tempNames = [names];
441
+ }
442
+ for (let i = 0; i < data.length; i += 1) {
443
+ if (data[i].Type === "Layer") {
444
+ for (let j = 0; j < tempNames.length; j += 1) {
445
+ const { URL } = data[i];
446
+ if (URL && URL.indexOf(tempNames[j]) > 0) {
447
+ if (!urlArray.includes(URL)) {
448
+ urlArray.push(URL);
449
+ }
450
+ }
451
+ }
452
+ } else {
453
+ const { GroupMapLayerInfo } = data[i];
454
+ if (GroupMapLayerInfo) {
455
+ urlArray = this.getLayerIndexesByNames(
456
+ GroupMapLayerInfo,
457
+ names,
458
+ urlArray
459
+ );
460
+ }
461
+ }
462
+ }
463
+ return urlArray;
464
+ }
465
+ /**
466
+ * 根据范围或图层名列表筛选图层
467
+ * @param {Array} data MapInfoCatalogLayer类型的数组
468
+ * @param {Array|null} extent 范围
469
+ * @param {Array|null} [layerNames] 图层名数组
470
+ * @param {Array} [array] 递归使用,可不传
471
+ * @param {Array} [gdbps] 递归使用,可不传
472
+ * @returns 图层列表
473
+ */
474
+ static getLayersByExtentOrName(data, extent, layerNames, array, gdbps) {
475
+ if (!array) {
476
+ array = [];
477
+ }
478
+ gdbps = gdbps || [];
479
+ for (let i = 0; i < data.length; i++) {
480
+ if (data[i].Type === "Layer") {
481
+ const range = data[i].ProjTransRange;
482
+ if (range && extent) {
483
+ if (
484
+ range.xmax < extent[0] ||
485
+ range.xmin > extent[2] ||
486
+ range.ymax < extent[1] ||
487
+ range.ymin > extent[3]
488
+ ) {
489
+ // eslint-disable-next-line no-continue
490
+ continue;
491
+ }
492
+ }
493
+ if (layerNames) {
494
+ for (let j = 0; j < layerNames.length; j++) {
495
+ if (
496
+ data[j].URL.indexOf(layerNames[j]) ===
497
+ data[j].URL.length - layerNames[j].length
498
+ ) {
499
+ if (gdbps.indexOf(data[j].URL) < 0) {
500
+ array.push(data[j]);
501
+ gdbps.push(data[j].URL);
502
+ }
503
+ }
504
+ }
505
+ } else if (gdbps.indexOf(data[i].URL) < 0) {
506
+ array.push(data[i]);
507
+ gdbps.push(data[i].URL);
508
+ }
509
+ } else if (data[i].GroupMapLayerInfo) {
510
+ array = this.getLayersByExtentOrName(
511
+ data[i].GroupMapLayerInfo,
512
+ extent,
513
+ layerNames,
514
+ array,
515
+ gdbps
516
+ );
517
+ }
518
+ }
519
+ return array;
520
+ }
521
+ /**
522
+ * 获取图层信息
523
+ * @param queryParam
524
+ */
525
+ static getLayerInfo(queryParam) {
526
+ let { domain } = queryParam;
527
+ if (!domain) {
528
+ const protocol = queryParam.protocol;
529
+ const ip = queryParam.ip;
530
+ const port = queryParam.port;
531
+ domain = `${protocol}://${ip}:${port}`;
532
+ }
533
+ const { layerType } = queryParam;
534
+ let promise;
535
+ if (layerType === "layer") {
536
+ const vectorLayer = new Zondy.MRCS.VectorLayer({ domain });
537
+ const { gdbp } = queryParam;
538
+ promise = new Promise(resolve => {
539
+ vectorLayer.getLayerInfo(gdbp, res => {
540
+ if (!res || !res.Range) {
541
+ resolve(null);
542
+ } else {
543
+ const obj = {
544
+ layerType,
545
+ proName: res.SrName,
546
+ extent: res.Range,
547
+ FieldAtt: res.FieldAtt
548
+ };
549
+ resolve(obj);
550
+ }
551
+ });
552
+ });
553
+ } else if (layerType === "vector") {
554
+ const { serverName } = queryParam;
555
+ const mapdoc = new Zondy.MRCS.MapDoc({
556
+ domain,
557
+ docName: serverName
558
+ });
559
+ promise = new Promise(resolve => {
560
+ mapdoc.getMapInfo(res => {
561
+ if (!res || !res.range) {
562
+ resolve(null);
563
+ } else {
564
+ const r = res.range.split(",");
565
+ const extent = {
566
+ xmin: Number(r[0]),
567
+ ymin: Number(r[1]),
568
+ xmax: Number(r[2]),
569
+ ymax: Number(r[3])
570
+ };
571
+ const obj = {
572
+ layerType,
573
+ proName: res.projtransName,
574
+ extent
575
+ };
576
+ resolve(obj);
577
+ }
578
+ });
579
+ });
580
+ } else if (layerType === "tile") {
581
+ const { serverName } = queryParam;
582
+ const tileLayer = new Zondy.MRCS.TileLayer({
583
+ domain,
584
+ tileName: serverName
585
+ });
586
+ promise = new Promise(resolve => {
587
+ tileLayer.getTileInfo(res => {
588
+ if (!res || !res.TileInfo2) {
589
+ resolve(null);
590
+ } else {
591
+ const { fullExtent } = res.TileInfo2;
592
+ if (fullExtent) {
593
+ const extent = {
594
+ xmin: fullExtent.xmin,
595
+ ymin: fullExtent.ymin,
596
+ xmax: fullExtent.xmax,
597
+ ymax: fullExtent.ymax
598
+ };
599
+ const proName =
600
+ res.TileInfo2.tileInfo.spatialReference.tileSRefInfo.Name;
601
+ const tileSize =
602
+ res.TileInfo2.tileInfo.cols || res.TileInfo2.tileInfo.rows;
603
+ const { origin } = res.TileInfo2.tileInfo;
604
+ const obj = {
605
+ layerType,
606
+ proName,
607
+ extent,
608
+ tileSize,
609
+ origin
610
+ };
611
+ resolve(obj);
612
+ }
613
+ }
614
+ });
615
+ });
616
+ }
617
+ if (promise) {
618
+ return promise.then(Range => {
619
+ return Range;
620
+ });
621
+ }
622
+ return null;
623
+ }
624
+ }
625
+ // 地图文档图层信息
626
+ DocumentCatalog.globalDocInfo = {};