xy-map 1.1.36 → 1.1.37

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.
package/xy-map.common.js CHANGED
@@ -287,7 +287,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, ".upload[data-v-57aca7b6]{position:rela
287
287
 
288
288
  /***/ }),
289
289
 
290
- /***/ 5547:
290
+ /***/ 5406:
291
291
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
292
292
 
293
293
  "use strict";
@@ -301,7 +301,7 @@ __webpack_require__.r(__webpack_exports__);
301
301
 
302
302
  var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
303
303
  // Module
304
- ___CSS_LOADER_EXPORT___.push([module.id, ".upload[data-v-3bd5e448]{position:relative}.upload input[data-v-3bd5e448]{position:absolute;width:100%;height:100%;left:0;top:0;opacity:0}", ""]);
304
+ ___CSS_LOADER_EXPORT___.push([module.id, ".upload[data-v-3b26555c]{position:relative}.upload input[data-v-3b26555c]{position:absolute;width:100%;height:100%;left:0;top:0;opacity:0}", ""]);
305
305
  // Exports
306
306
  /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
307
307
 
@@ -42960,19 +42960,19 @@ var update = add("f559c59c", content, true, {"sourceMap":false,"shadowMode":fals
42960
42960
 
42961
42961
  /***/ }),
42962
42962
 
42963
- /***/ 411:
42963
+ /***/ 4112:
42964
42964
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
42965
42965
 
42966
42966
  // style-loader: Adds some css to the DOM by adding a <style> tag
42967
42967
 
42968
42968
  // load the styles
42969
- var content = __webpack_require__(5547);
42969
+ var content = __webpack_require__(5406);
42970
42970
  if(content.__esModule) content = content.default;
42971
42971
  if(typeof content === 'string') content = [[module.id, content, '']];
42972
42972
  if(content.locals) module.exports = content.locals;
42973
42973
  // add the styles to the DOM
42974
42974
  var add = (__webpack_require__(7037)/* ["default"] */ .Z)
42975
- var update = add("f27a3ec2", content, true, {"sourceMap":false,"shadowMode":false});
42975
+ var update = add("81936f9e", content, true, {"sourceMap":false,"shadowMode":false});
42976
42976
 
42977
42977
  /***/ }),
42978
42978
 
@@ -43697,6 +43697,24 @@ __webpack_require__.d(__webpack_exports__, {
43697
43697
  "shpFile": function() { return /* reexport */ shpFile; }
43698
43698
  });
43699
43699
 
43700
+ // NAMESPACE OBJECT: ./src/package/util/mapTools.js
43701
+ var mapTools_namespaceObject = {};
43702
+ __webpack_require__.r(mapTools_namespaceObject);
43703
+ __webpack_require__.d(mapTools_namespaceObject, {
43704
+ "YK": function() { return clearDraw; },
43705
+ "TE": function() { return mapTools_distance; },
43706
+ "N5": function() { return drawArea; },
43707
+ "tL": function() { return geometryCollectionToFeatureCollection; },
43708
+ "yQ": function() { return getElevation; },
43709
+ "yJ": function() { return lineCenter; },
43710
+ "po": function() { return loadImage; },
43711
+ "bZ": function() { return pointToGeoJson; },
43712
+ "j_": function() { return polygonCenter; },
43713
+ "Do": function() { return ranging; },
43714
+ "b4": function() { return spArray; },
43715
+ "rg": function() { return toGeoJson; }
43716
+ });
43717
+
43700
43718
  // NAMESPACE OBJECT: ./node_modules/@loaders.gl/gltf/dist/esm/lib/extensions/EXT_meshopt_compression.js
43701
43719
  var EXT_meshopt_compression_namespaceObject = {};
43702
43720
  __webpack_require__.r(EXT_meshopt_compression_namespaceObject);
@@ -43829,6 +43847,127 @@ var style_map = __webpack_require__(7193);
43829
43847
  // EXTERNAL MODULE: ./node_modules/html2canvas/dist/html2canvas.js
43830
43848
  var html2canvas = __webpack_require__(2269);
43831
43849
  var html2canvas_default = /*#__PURE__*/__webpack_require__.n(html2canvas);
43850
+ ;// CONCATENATED MODULE: ./src/package/layers/index.js
43851
+ // import mapBoxGl from 'mapbox-gl'
43852
+
43853
+
43854
+ // 更新数据
43855
+ const setSource = (id, data) => {
43856
+ let {
43857
+ map
43858
+ } = package_map;
43859
+ let hasSource = map.getSource(id);
43860
+ if (hasSource) {
43861
+ map.getSource(id).setData(data);
43862
+ }
43863
+ };
43864
+ // 判断图层是否存在
43865
+ const hasLayer = id => {
43866
+ let {
43867
+ map
43868
+ } = package_map;
43869
+ return map.getLayer(id);
43870
+ };
43871
+
43872
+ // 判断数据是否存在
43873
+ const hasSource = id => {
43874
+ let {
43875
+ map
43876
+ } = package_map;
43877
+ return map.getSource(id);
43878
+ };
43879
+
43880
+ // 删除图层
43881
+ const removeLayer = id => {
43882
+ let {
43883
+ map
43884
+ } = package_map;
43885
+ map.removeLayer(id);
43886
+ let arr = getLayerAll();
43887
+ let layers = arr.filter(item => item.id.includes(id + '-'));
43888
+ layers.forEach(item => {
43889
+ if (hasLayer(item.id)) {
43890
+ map.removeLayer(item.id);
43891
+ }
43892
+ });
43893
+ };
43894
+
43895
+ /**
43896
+ * 获取所有图层
43897
+ */
43898
+ const getLayerAll = () => {
43899
+ let {
43900
+ map
43901
+ } = package_map;
43902
+ let data = map.getStyle().layers;
43903
+ // console.log(data)
43904
+ return data;
43905
+ };
43906
+
43907
+ // 显示隐藏图层
43908
+ const showLayer = (id, show = false) => {
43909
+ let {
43910
+ map
43911
+ } = package_map;
43912
+ show = show ? 'visible' : 'none';
43913
+ map.setLayoutProperty(id, 'visibility', show);
43914
+ let arr = getLayerAll();
43915
+ let layers = arr.filter(item => item.id.includes(id + '-'));
43916
+ layers.forEach(item => {
43917
+ if (hasLayer(item.id)) {
43918
+ map.setLayoutProperty(item.id, 'visibility', show);
43919
+ }
43920
+ });
43921
+ };
43922
+
43923
+ // 显隐文字
43924
+ const showLayerText = (show, id = '') => {
43925
+ let {
43926
+ map
43927
+ } = package_map;
43928
+ if (id) {
43929
+ setPaint(id, 'text-opacity', show ? 1 : 0);
43930
+ } else {
43931
+ let textLayer = map.getStyle().layers;
43932
+ textLayer.forEach(layer => {
43933
+ if (layer.type === 'symbol') {
43934
+ setPaint(layer.id, 'text-opacity', show ? 1 : 0);
43935
+ }
43936
+ });
43937
+ }
43938
+ };
43939
+
43940
+ // 修改Layout
43941
+ const setLayout = (id, key, value) => {
43942
+ let {
43943
+ map
43944
+ } = package_map;
43945
+ map.setLayoutProperty(id, key, value);
43946
+ };
43947
+
43948
+ // 修改Paint
43949
+ const setPaint = (id, key, value) => {
43950
+ let {
43951
+ map
43952
+ } = package_map;
43953
+ map.setPaintProperty(id, key, value);
43954
+ };
43955
+
43956
+ // 修改Filter
43957
+ const setFilter = (key, filter) => {
43958
+ let {
43959
+ map
43960
+ } = package_map;
43961
+ map.setFilter(key, filter);
43962
+ };
43963
+
43964
+ // 设置高亮
43965
+ const setHigh = (id, filter) => {
43966
+ let {
43967
+ map
43968
+ } = package_map;
43969
+ map.setFilter(id + '-high', filter);
43970
+ };
43832
43971
  ;// CONCATENATED MODULE: ./src/package/map.js
43833
43972
  // 天地图token
43834
43973
  const tdtToken = (/* unused pure expression or super */ null && (['150bad890e9d004885a4b2a94062a46e', '337996a733e1ea41cd73124f67f4795d', '48282c15cce091a1154a674512372eec', 'f3c2ca3a170f5712abd7b6858e038f18']));
@@ -43908,6 +44047,7 @@ var defaultOptions = {
43908
44047
 
43909
44048
 
43910
44049
 
44050
+
43911
44051
  // import { Message } from 'element-ui'
43912
44052
 
43913
44053
  var popup = null;
@@ -44049,6 +44189,7 @@ class mapSdk {
44049
44189
  'star-intensity': 0.1
44050
44190
  });
44051
44191
  } else {
44192
+ if (hasLayer('sky')) return;
44052
44193
  // 天空
44053
44194
  map.addLayer({
44054
44195
  'id': 'sky',
@@ -44358,127 +44499,6 @@ class mapSdk {
44358
44499
  }
44359
44500
  }
44360
44501
  /* harmony default export */ var package_map = (new mapSdk());
44361
- ;// CONCATENATED MODULE: ./src/package/layers/index.js
44362
- // import mapBoxGl from 'mapbox-gl'
44363
-
44364
-
44365
- // 更新数据
44366
- const setSource = (id, data) => {
44367
- let {
44368
- map
44369
- } = package_map;
44370
- let hasSource = map.getSource(id);
44371
- if (hasSource) {
44372
- map.getSource(id).setData(data);
44373
- }
44374
- };
44375
- // 判断图层是否存在
44376
- const hasLayer = id => {
44377
- let {
44378
- map
44379
- } = package_map;
44380
- return map.getLayer(id);
44381
- };
44382
-
44383
- // 判断数据是否存在
44384
- const hasSource = id => {
44385
- let {
44386
- map
44387
- } = package_map;
44388
- return map.getSource(id);
44389
- };
44390
-
44391
- // 删除图层
44392
- const removeLayer = id => {
44393
- let {
44394
- map
44395
- } = package_map;
44396
- map.removeLayer(id);
44397
- let arr = getLayerAll();
44398
- let layers = arr.filter(item => item.id.includes(id + '-'));
44399
- layers.forEach(item => {
44400
- if (hasLayer(item.id)) {
44401
- map.removeLayer(item.id);
44402
- }
44403
- });
44404
- };
44405
-
44406
- /**
44407
- * 获取所有图层
44408
- */
44409
- const getLayerAll = () => {
44410
- let {
44411
- map
44412
- } = package_map;
44413
- let data = map.getStyle().layers;
44414
- // console.log(data)
44415
- return data;
44416
- };
44417
-
44418
- // 显示隐藏图层
44419
- const showLayer = (id, show = false) => {
44420
- let {
44421
- map
44422
- } = package_map;
44423
- show = show ? 'visible' : 'none';
44424
- map.setLayoutProperty(id, 'visibility', show);
44425
- let arr = getLayerAll();
44426
- let layers = arr.filter(item => item.id.includes(id + '-'));
44427
- layers.forEach(item => {
44428
- if (hasLayer(item.id)) {
44429
- map.setLayoutProperty(item.id, 'visibility', show);
44430
- }
44431
- });
44432
- };
44433
-
44434
- // 显隐文字
44435
- const showLayerText = (show, id = '') => {
44436
- let {
44437
- map
44438
- } = package_map;
44439
- if (id) {
44440
- setPaint(id, 'text-opacity', show ? 1 : 0);
44441
- } else {
44442
- let textLayer = map.getStyle().layers;
44443
- textLayer.forEach(layer => {
44444
- if (layer.type === 'symbol') {
44445
- setPaint(layer.id, 'text-opacity', show ? 1 : 0);
44446
- }
44447
- });
44448
- }
44449
- };
44450
-
44451
- // 修改Layout
44452
- const setLayout = (id, key, value) => {
44453
- let {
44454
- map
44455
- } = package_map;
44456
- map.setLayoutProperty(id, key, value);
44457
- };
44458
-
44459
- // 修改Paint
44460
- const setPaint = (id, key, value) => {
44461
- let {
44462
- map
44463
- } = package_map;
44464
- map.setPaintProperty(id, key, value);
44465
- };
44466
-
44467
- // 修改Filter
44468
- const setFilter = (key, filter) => {
44469
- let {
44470
- map
44471
- } = package_map;
44472
- map.setFilter(key, filter);
44473
- };
44474
-
44475
- // 设置高亮
44476
- const setHigh = (id, filter) => {
44477
- let {
44478
- map
44479
- } = package_map;
44480
- map.setFilter(id + '-high', filter);
44481
- };
44482
44502
  ;// CONCATENATED MODULE: ./src/package/layers/Text.js
44483
44503
 
44484
44504
 
@@ -66803,8 +66823,8 @@ const Line_defaultOptions = {
66803
66823
  click: null
66804
66824
  };
66805
66825
 
66806
- /**
66807
- * 添加线图层
66826
+ /**
66827
+ * 添加线图层
66808
66828
  */
66809
66829
  const addLayerLine = (option, layerId) => {
66810
66830
  let {
@@ -66873,9 +66893,9 @@ const addLayerLine = (option, layerId) => {
66873
66893
  }
66874
66894
  };
66875
66895
 
66876
- /**
66877
- * 添加动画线图层
66878
- * addLayerLine配置图层
66896
+ /**
66897
+ * 添加动画线图层
66898
+ * addLayerLine配置图层
66879
66899
  */
66880
66900
  const addLayerLineAnimation = (option, layerId) => {
66881
66901
  let {
@@ -69766,9 +69786,9 @@ let after = null;
69766
69786
  let textColor = '#fff';
69767
69787
  let lineColor = '#f00';
69768
69788
 
69769
- /**
69770
- * 测距
69771
- * @param mapObject
69789
+ /**
69790
+ * 测距
69791
+ * @param mapObject
69772
69792
  */
69773
69793
  function measureLineLength(mapObject) {
69774
69794
  const currentMapContainerId = mapObject._container.getAttribute('id');
@@ -69886,9 +69906,9 @@ function measureLineLength(mapObject) {
69886
69906
  deleteTips.remove();
69887
69907
  }
69888
69908
  });
69889
- /**
69890
- * 点击测距点位触发
69891
- * @param event
69909
+ /**
69910
+ * 点击测距点位触发
69911
+ * @param event
69892
69912
  * */
69893
69913
  // eslint-disable-next-line no-undef,no-inner-declarations
69894
69914
  function clickMeasurePointsHandler(event) {
@@ -69972,8 +69992,8 @@ function measureLineLength(mapObject) {
69972
69992
  resultData.map.on('dblclick', dblclickHandler);
69973
69993
  }
69974
69994
 
69975
- /**
69976
- * 清除测距相关
69995
+ /**
69996
+ * 清除测距相关
69977
69997
  */
69978
69998
  function clearMeasureLine(mapObject) {
69979
69999
  const resultData = getBeforeOrAfterDataByMapContainerIdHandler(mapObject);
@@ -69995,9 +70015,9 @@ function clearMeasureLine(mapObject) {
69995
70015
  }
69996
70016
  }
69997
70017
 
69998
- /**
69999
- * 创建label marker
70000
- * @returns {*} 返回marker对象
70018
+ /**
70019
+ * 创建label marker
70020
+ * @returns {*} 返回marker对象
70001
70021
  */
70002
70022
  function createMeasurLineLabelMarkerHandler(mapObject) {
70003
70023
  const resultData = getBeforeOrAfterDataByMapContainerIdHandler(mapObject);
@@ -70020,11 +70040,11 @@ function createMeasurLineLabelMarkerHandler(mapObject) {
70020
70040
  };
70021
70041
  }
70022
70042
 
70023
- /**
70024
- * 创建测距需要的layers,points、line、measure-line-move
70025
- * @param jsonPoint
70026
- * @param jsonLine
70027
- * @param mapObject
70043
+ /**
70044
+ * 创建测距需要的layers,points、line、measure-line-move
70045
+ * @param jsonPoint
70046
+ * @param jsonLine
70047
+ * @param mapObject
70028
70048
  */
70029
70049
  function createMeasureLinePLLHandler(jsonPoint, jsonLine, mapObject) {
70030
70050
  const resultData = getBeforeOrAfterDataByMapContainerIdHandler(mapObject);
@@ -70085,8 +70105,8 @@ function createMeasureLinePLLHandler(jsonPoint, jsonLine, mapObject) {
70085
70105
  moveLayerHandler(resultData.map);
70086
70106
  }
70087
70107
 
70088
- /**
70089
- * 将测距的三个图层移到最上层级
70108
+ /**
70109
+ * 将测距的三个图层移到最上层级
70090
70110
  */
70091
70111
  function moveLayerHandler(mapObject) {
70092
70112
  const {
@@ -70104,12 +70124,12 @@ function moveLayerHandler(mapObject) {
70104
70124
  }
70105
70125
  }
70106
70126
 
70107
- /**
70108
- * 添加点位layer
70109
- * @param jsonPoint
70110
- * @param jsonLine
70111
- * @param coords
70112
- * @param mapObject
70127
+ /**
70128
+ * 添加点位layer
70129
+ * @param jsonPoint
70130
+ * @param jsonLine
70131
+ * @param coords
70132
+ * @param mapObject
70113
70133
  */
70114
70134
  function addMeasureLinePoint(jsonPoint, jsonLine, coords, mapObject) {
70115
70135
  const {
@@ -70152,11 +70172,11 @@ function addMeasureLinePoint(jsonPoint, jsonLine, coords, mapObject) {
70152
70172
  map.getSource('measure-line-points').setData(jsonPoint);
70153
70173
  }
70154
70174
 
70155
- /**
70156
- * 获取两坐标点之间的距离
70157
- * @param points
70158
- * @param coords
70159
- * @returns {string}
70175
+ /**
70176
+ * 获取两坐标点之间的距离
70177
+ * @param points
70178
+ * @param coords
70179
+ * @returns {string}
70160
70180
  */
70161
70181
  function getMeasureLineLength(points, coords) {
70162
70182
  const _points = points.concat([coords]);
@@ -70172,12 +70192,12 @@ function getMeasureLineLength(points, coords) {
70172
70192
  return len;
70173
70193
  }
70174
70194
 
70175
- /**
70176
- * 点击地图添加点位触发给当前点位绑定测距结果的labelMarker
70177
- * @param points
70178
- * @param jsonPoint
70179
- * @param coords
70180
- * @param mapObject
70195
+ /**
70196
+ * 点击地图添加点位触发给当前点位绑定测距结果的labelMarker
70197
+ * @param points
70198
+ * @param jsonPoint
70199
+ * @param coords
70200
+ * @param mapObject
70181
70201
  * */
70182
70202
  function addMeasureLineRes(points, jsonPoint, coords, mapObject) {
70183
70203
  const {
@@ -70205,11 +70225,11 @@ function addMeasureLineRes(points, jsonPoint, coords, mapObject) {
70205
70225
  new (mapbox_gl_default()).Marker(option).setLngLat(coords).addTo(map);
70206
70226
  }
70207
70227
 
70208
- /**
70209
- * 点击测距点位重新触发计算两点位之间的距离
70210
- * @param resultPoints
70211
- * @param coords
70212
- * @returns {string}
70228
+ /**
70229
+ * 点击测距点位重新触发计算两点位之间的距离
70230
+ * @param resultPoints
70231
+ * @param coords
70232
+ * @returns {string}
70213
70233
  */
70214
70234
  function getMetersHandler(resultPoints, coords) {
70215
70235
  if (resultPoints.length > 1) {
@@ -70227,13 +70247,13 @@ function getMetersHandler(resultPoints, coords) {
70227
70247
  }
70228
70248
  }
70229
70249
 
70230
- /**
70231
- * 获取两点位之间的角度
70232
- * @param lng1
70233
- * @param lat1
70234
- * @param lng2
70235
- * @param lat2
70236
- * @returns {number}
70250
+ /**
70251
+ * 获取两点位之间的角度
70252
+ * @param lng1
70253
+ * @param lat1
70254
+ * @param lng2
70255
+ * @param lat2
70256
+ * @returns {number}
70237
70257
  */
70238
70258
  function getAngleHandle(lng1, lat1, lng2, lat2) {
70239
70259
  const a = (90 - lat2) * Math.PI / 180;
@@ -70264,11 +70284,11 @@ function getAngleHandle(lng1, lat1, lng2, lat2) {
70264
70284
  return res;
70265
70285
  }
70266
70286
 
70267
- /**
70268
- * 创建关闭按钮
70269
- * @param clickMeasurePointsHandler
70270
- * @param coords
70271
- * @param mapObject
70287
+ /**
70288
+ * 创建关闭按钮
70289
+ * @param clickMeasurePointsHandler
70290
+ * @param coords
70291
+ * @param mapObject
70272
70292
  */
70273
70293
  function createCloseMarkerHandler(clickMeasurePointsHandler, coords, mapObject) {
70274
70294
  const resultData = getBeforeOrAfterDataByMapContainerIdHandler(mapObject);
@@ -70291,8 +70311,8 @@ function createCloseMarkerHandler(clickMeasurePointsHandler, coords, mapObject)
70291
70311
  };
70292
70312
  }
70293
70313
 
70294
- /**
70295
- * 关闭触发
70314
+ /**
70315
+ * 关闭触发
70296
70316
  */
70297
70317
  function closeMeasureLine(mapObject) {
70298
70318
  if (!mapObject) return;
@@ -70585,20 +70605,19 @@ const pointToGeoJson = (position = [0, 0]) => {
70585
70605
  return data;
70586
70606
  };
70587
70607
 
70588
- // arcGis坐标转geoJson
70589
- const arcGisToGeoJson = Json => {
70590
- let data = {
70591
- type: 'FeatureCollection',
70592
- features: []
70593
- };
70594
- Json.geometries.forEach(item => {
70595
- data.features.push({
70596
- type: 'Feature',
70597
- geometry: item,
70598
- properties: {}
70599
- });
70608
+ // geoJson 格式 GeometryCollection 转 FeatureCollection
70609
+ const geometryCollectionToFeatureCollection = geometryCollection => {
70610
+ const features = [];
70611
+
70612
+ // 遍历 GeometryCollection 中的每个几何对象
70613
+ geometryCollection.geometries.forEach(geometry => {
70614
+ const feature = es_feature(geometry);
70615
+ features.push(feature);
70600
70616
  });
70601
- return data;
70617
+
70618
+ // 创建 FeatureCollection
70619
+ const featureCollection = es_featureCollection(features);
70620
+ return featureCollection;
70602
70621
  };
70603
70622
 
70604
70623
  // 3857墨卡托坐标系转换为4326 (WGS84)经纬度坐标
@@ -71266,8 +71285,8 @@ const Polygon_defaultOptions = {
71266
71285
  click: null
71267
71286
  };
71268
71287
 
71269
- /**
71270
- * 添加面图层
71288
+ /**
71289
+ * 添加面图层
71271
71290
  */
71272
71291
  const addLayerPolygon = (option, layerId) => {
71273
71292
  let {
@@ -71369,8 +71388,8 @@ const circle_defaultOptions = {
71369
71388
  click: null
71370
71389
  };
71371
71390
 
71372
- /**
71373
- * 添加面图层
71391
+ /**
71392
+ * 添加面图层
71374
71393
  */
71375
71394
  const addLayerCircle = (option, layerId) => {
71376
71395
  let {
@@ -71500,8 +71519,8 @@ const circleAnimate_defaultOptions = {
71500
71519
  click: null
71501
71520
  };
71502
71521
 
71503
- /**
71504
- * 添加圆图层
71522
+ /**
71523
+ * 添加圆图层
71505
71524
  */
71506
71525
  const addCircleAnimate = (option, layerId) => {
71507
71526
  let {
@@ -77313,6 +77332,168 @@ const addLayerModel = (option, layerId = '') => {
77313
77332
  }
77314
77333
  });
77315
77334
  };
77335
+ ;// CONCATENATED MODULE: ./src/package/layers/pipe.js
77336
+
77337
+
77338
+
77339
+
77340
+
77341
+
77342
+
77343
+
77344
+
77345
+
77346
+ const pipe_defaultOptions = {
77347
+ id: 'pipe',
77348
+ position: [103.353557, 23.362395],
77349
+ // 位置
77350
+ hight: 0,
77351
+ // 高度
77352
+ edit: false
77353
+ };
77354
+
77355
+ /**
77356
+ * 添加管道
77357
+ */
77358
+ const addLayerPipe = (option, layerId = '') => {
77359
+ return new Promise(resolve => {
77360
+ let {
77361
+ map
77362
+ } = package_map;
77363
+ let opt = Object.assign({}, pipe_defaultOptions, option);
77364
+ let camera = '';
77365
+ let scene = '';
77366
+ let group = '';
77367
+ let renderer = '';
77368
+ let customLayer = '';
77369
+ let pipeMesh = '';
77370
+ if (hasLayer(opt.id)) {
77371
+ removeLayer(opt.id);
77372
+ }
77373
+ addPipe();
77374
+ map.addLayer(customLayer, layerId);
77375
+ resolve(group);
77376
+ function addPipe() {
77377
+ const modelOrigin = opt.position; // 中心点
77378
+ const modelAltitude = opt.elevation; // 海拔高度
77379
+ const modelRotate = [Math.PI / 2, 0, 0];
77380
+ const modelAsMercatorCoordinate = mapbox_gl_default().MercatorCoordinate.fromLngLat(modelOrigin, modelAltitude);
77381
+ const modelTransform = {
77382
+ translateX: modelAsMercatorCoordinate.x,
77383
+ translateY: modelAsMercatorCoordinate.y,
77384
+ translateZ: modelAsMercatorCoordinate.z,
77385
+ rotateX: modelRotate[0],
77386
+ rotateY: modelRotate[1],
77387
+ rotateZ: modelRotate[2],
77388
+ scale: modelAsMercatorCoordinate.meterInMercatorCoordinateUnits()
77389
+ };
77390
+
77391
+ // 根据CustomLayerInterface为三维模型配置自定义层
77392
+ customLayer = {
77393
+ id: opt.id,
77394
+ type: 'custom',
77395
+ renderingMode: '3d',
77396
+ onAdd: (map, gl) => {
77397
+ const container = map.getCanvas();
77398
+
77399
+ // 摄像机
77400
+ camera = new PerspectiveCamera(50, container.clientWidth / container.clientHeight, 1, 5000);
77401
+
77402
+ // 场景
77403
+ scene = new Scene();
77404
+ group = new Group();
77405
+ group.name = 'pipe';
77406
+ scene.add(group);
77407
+
77408
+ // 管道
77409
+ let geometry = getPipeGeometry(modelAsMercatorCoordinate, opt);
77410
+ const bottomMat = new MeshBasicMaterial({
77411
+ color: opt.color || 0x7597dc,
77412
+ side: DoubleSide,
77413
+ transparent: true,
77414
+ opacity: 0.5
77415
+ });
77416
+ pipeMesh = new Mesh(geometry, bottomMat);
77417
+ scene.position.y = opt.hight;
77418
+ group.add(pipeMesh);
77419
+ group.rotation.x = -Math.PI / 2;
77420
+
77421
+ // 渲染器
77422
+ renderer = new WebGLRenderer({
77423
+ canvas: map.getCanvas(),
77424
+ context: gl,
77425
+ logarithmicDepthBuffer: true,
77426
+ antialias: true
77427
+ });
77428
+ renderer.autoClear = false;
77429
+ renderer.physicallyCorrectLights = true;
77430
+ // renderer.outputEncoding = THREE.sRGBEncoding
77431
+ renderer.setSize(container.clientWidth, container.clientHeight);
77432
+
77433
+ // 调试工具
77434
+ const gui = opt.edit ? new GUI$1() : null;
77435
+ if (gui) {
77436
+ gui.add(group.position, 'y').step(0.1).name('高度(米)');
77437
+ gui.add(group.rotation, 'x').step(0.1).name('旋转x');
77438
+ gui.add(group.rotation, 'y').step(0.1).name('旋转y');
77439
+ gui.add(group.rotation, 'z').step(0.1).name('旋转z');
77440
+ }
77441
+ },
77442
+ render: (gl, matrix) => {
77443
+ const rotationX = new three_module_Matrix4().makeRotationAxis(new three_module_Vector3(1, 0, 0), modelTransform.rotateX);
77444
+ const rotationY = new three_module_Matrix4().makeRotationAxis(new three_module_Vector3(0, 1, 0), modelTransform.rotateY);
77445
+ const rotationZ = new three_module_Matrix4().makeRotationAxis(new three_module_Vector3(0, 0, 1), modelTransform.rotateZ);
77446
+ const m = new three_module_Matrix4().fromArray(matrix);
77447
+ const l = new three_module_Matrix4().makeTranslation(modelTransform.translateX, modelTransform.translateY, modelTransform.translateZ).scale(new three_module_Vector3(modelTransform.scale, -modelTransform.scale, modelTransform.scale)).multiply(rotationX).multiply(rotationY).multiply(rotationZ);
77448
+ camera.projectionMatrix.elements = matrix;
77449
+ camera.projectionMatrix = m.multiply(l);
77450
+ renderer.resetState();
77451
+ renderer.render(scene, camera);
77452
+ map.triggerRepaint();
77453
+ }
77454
+ };
77455
+ return customLayer;
77456
+
77457
+ //获取管道
77458
+ function getPipeGeometry(center, opt) {
77459
+ if (opt.data) {
77460
+ let points = [];
77461
+ opt.data.features.forEach(geo => {
77462
+ geo.geometry.coordinates.forEach(item => {
77463
+ let mercatorCoordinate = mapbox_gl_default().MercatorCoordinate.fromLngLat(item, 0);
77464
+ let units = mercatorCoordinate.meterInMercatorCoordinateUnits();
77465
+ points.push(new three_module_Vector2((mercatorCoordinate.x - center.x) / units, -1 * (mercatorCoordinate.y - center.y) / units));
77466
+ });
77467
+ });
77468
+ let mesh = '';
77469
+ if (points.length > 1) {
77470
+ // const shape = new THREE.Shape(points)
77471
+ points = points.map(vector => {
77472
+ return new three_module_Vector3(vector.x, vector.y, 0);
77473
+ });
77474
+ mesh = transition3d(points); // 创建管道
77475
+ }
77476
+
77477
+ return mesh;
77478
+ } else {
77479
+ const curve = new CatmullRomCurve3([new three_module_Vector3(-10, 0, 0), new three_module_Vector3(0, 10, 0), new three_module_Vector3(10, 0, 0)]);
77480
+ return new TubeGeometry(curve, 4, 2, 8, false);
77481
+ }
77482
+ }
77483
+
77484
+ // 将shape转换为ExtrudeGeometry
77485
+ function transition3d(points) {
77486
+ // console.log(points, 'points')
77487
+ // 创建一条曲线
77488
+ const curve = new CatmullRomCurve3(points, false, 'catmullrom', 0.5);
77489
+
77490
+ // 创建管道
77491
+ const geometry = new TubeGeometry(curve, 4, 1, 8, false);
77492
+ return geometry;
77493
+ }
77494
+ }
77495
+ });
77496
+ };
77316
77497
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
77317
77498
  var defineProperty = __webpack_require__(2482);
77318
77499
  ;// CONCATENATED MODULE: ./node_modules/@luma.gl/engine/dist/esm/animation/timeline.js
@@ -119224,7 +119405,7 @@ var jsonFilevue_type_template_id_57aca7b6_scoped_true_staticRenderFns = [];
119224
119405
  if (json) {
119225
119406
  json = JSON.parse(json);
119226
119407
  if (!json.features) {
119227
- json = arcGisToGeoJson(json);
119408
+ json = (0,mapTools_namespaceObject.arcGisToGeoJson)(json);
119228
119409
  }
119229
119410
  const bbox = es(json);
119230
119411
  if (bbox.length > 0 && bbox[0] > 180) {
@@ -119265,8 +119446,8 @@ var jsonFile_component = normalizeComponent(
119265
119446
  )
119266
119447
 
119267
119448
  /* harmony default export */ var jsonFile = (jsonFile_component.exports);
119268
- ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/shpFile.vue?vue&type=template&id=3bd5e448&scoped=true&
119269
- var shpFilevue_type_template_id_3bd5e448_scoped_true_render = function render() {
119449
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/shpFile.vue?vue&type=template&id=3b26555c&scoped=true&
119450
+ var shpFilevue_type_template_id_3b26555c_scoped_true_render = function render() {
119270
119451
  var _vm = this,
119271
119452
  _c = _vm._self._c;
119272
119453
  return _c('el-button', {
@@ -119286,7 +119467,7 @@ var shpFilevue_type_template_id_3bd5e448_scoped_true_render = function render()
119286
119467
  }
119287
119468
  })]);
119288
119469
  };
119289
- var shpFilevue_type_template_id_3bd5e448_scoped_true_staticRenderFns = [];
119470
+ var shpFilevue_type_template_id_3b26555c_scoped_true_staticRenderFns = [];
119290
119471
 
119291
119472
  ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/shpFile.vue?vue&type=script&lang=js&
119292
119473
 
@@ -119309,7 +119490,7 @@ const shapeFile = __webpack_require__(1393); // 导入shpfile.js
119309
119490
  shapeFile.read(result).then(json => {
119310
119491
  const bbox = es(json);
119311
119492
  if (!json.features) {
119312
- json = arcGisToGeoJson(json);
119493
+ json = geometryCollectionToFeatureCollection(json);
119313
119494
  }
119314
119495
  if (bbox.length > 0 && bbox[0] > 180) {
119315
119496
  // 墨卡托坐标需要转换
@@ -119327,9 +119508,9 @@ const shapeFile = __webpack_require__(1393); // 导入shpfile.js
119327
119508
  });
119328
119509
  ;// CONCATENATED MODULE: ./src/package/draw/shpFile.vue?vue&type=script&lang=js&
119329
119510
  /* harmony default export */ var draw_shpFilevue_type_script_lang_js_ = (shpFilevue_type_script_lang_js_);
119330
- // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[4]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/shpFile.vue?vue&type=style&index=0&id=3bd5e448&prod&lang=scss&scoped=true&
119331
- var shpFilevue_type_style_index_0_id_3bd5e448_prod_lang_scss_scoped_true_ = __webpack_require__(411);
119332
- ;// CONCATENATED MODULE: ./src/package/draw/shpFile.vue?vue&type=style&index=0&id=3bd5e448&prod&lang=scss&scoped=true&
119511
+ // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[4]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/shpFile.vue?vue&type=style&index=0&id=3b26555c&prod&lang=scss&scoped=true&
119512
+ var shpFilevue_type_style_index_0_id_3b26555c_prod_lang_scss_scoped_true_ = __webpack_require__(4112);
119513
+ ;// CONCATENATED MODULE: ./src/package/draw/shpFile.vue?vue&type=style&index=0&id=3b26555c&prod&lang=scss&scoped=true&
119333
119514
 
119334
119515
  ;// CONCATENATED MODULE: ./src/package/draw/shpFile.vue
119335
119516
 
@@ -119342,11 +119523,11 @@ var shpFilevue_type_style_index_0_id_3bd5e448_prod_lang_scss_scoped_true_ = __we
119342
119523
 
119343
119524
  var shpFile_component = normalizeComponent(
119344
119525
  draw_shpFilevue_type_script_lang_js_,
119345
- shpFilevue_type_template_id_3bd5e448_scoped_true_render,
119346
- shpFilevue_type_template_id_3bd5e448_scoped_true_staticRenderFns,
119526
+ shpFilevue_type_template_id_3b26555c_scoped_true_render,
119527
+ shpFilevue_type_template_id_3b26555c_scoped_true_staticRenderFns,
119347
119528
  false,
119348
119529
  null,
119349
- "3bd5e448",
119530
+ "3b26555c",
119350
119531
  null
119351
119532
 
119352
119533
  )
@@ -120331,6 +120512,7 @@ var polygon_component = normalizeComponent(
120331
120512
 
120332
120513
 
120333
120514
 
120515
+
120334
120516
  // 图层操作
120335
120517
  const mapLayers = {
120336
120518
  showLayerText: showLayerText,
@@ -120359,6 +120541,7 @@ const mapDraw = {
120359
120541
  addLayerCircle: addLayerCircle,
120360
120542
  addCircleAnimate: addCircleAnimate,
120361
120543
  addLayerModel: addLayerModel,
120544
+ addLayerPipe: addLayerPipe,
120362
120545
  addLayerWater: addLayerWater,
120363
120546
  load3DTiles: load3DTiles
120364
120547
  };
@@ -120376,7 +120559,8 @@ const mapTools = {
120376
120559
  polygonCenter: polygonCenter,
120377
120560
  GeoAddress: GeoAddress,
120378
120561
  Geolocation: Geolocation,
120379
- getElevation: getElevation
120562
+ getElevation: getElevation,
120563
+ geometryCollectionToFeatureCollection: geometryCollectionToFeatureCollection
120380
120564
  };
120381
120565
 
120382
120566
  // 地图事件