@kq_npm/client3d_webgl_vue 4.5.55 → 4.5.57

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 (82) hide show
  1. package/adddata/index.js +189 -21
  2. package/airspacegridoccupancyquery/index.js +1977 -0
  3. package/airspacegridoccupancyquery/style/airspacegridoccupancyquery.css +1 -0
  4. package/airspacegridoccupancyquery/style/index.js +3 -0
  5. package/airspaceprofileanalysis/index.js +1870 -0
  6. package/airspaceprofileanalysis/style/airspaceprofileanalysis.css +1 -0
  7. package/airspaceprofileanalysis/style/index.js +3 -0
  8. package/aspectanalysis/index.js +25 -7
  9. package/baseterraingallery/index.js +16 -4
  10. package/boxclip/index.js +58 -16
  11. package/buildpointmodel/index.js +3207 -230
  12. package/buildpointmodel/style/buildpointmodel.css +1 -1
  13. package/buildpolygonmodel/index.js +205 -81
  14. package/buildpolylinemodel/index.js +346 -70
  15. package/clientPrint/index.js +32440 -2337
  16. package/comparemap/index.js +132 -60
  17. package/compass/index.js +16 -6
  18. package/excavatefillanalysis/index.js +51 -7
  19. package/fixedzoomin/index.js +24 -7
  20. package/fixedzoomout/index.js +25 -7
  21. package/flight/index.js +113 -26
  22. package/floodanalysis/index.js +79 -14
  23. package/geologicalbodyanalysis/index.js +41 -5
  24. package/gpuspatialquery/index.js +127 -19
  25. package/gridoccupancyquery/index.js +627 -0
  26. package/gridoccupancyquery/style/gridoccupancyquery.css +1 -0
  27. package/gridoccupancyquery/style/index.js +3 -0
  28. package/hawkeye/index.js +20 -2
  29. package/headertemp/index.js +7 -2
  30. package/heatmap3d/index.js +282 -158
  31. package/index.js +32440 -2337
  32. package/isolineanalysis/index.js +113 -38
  33. package/light/index.js +80 -22
  34. package/limitheightanalysis/index.js +30 -10
  35. package/lowaltitudefeature/index.js +5027 -0
  36. package/lowaltitudefeature/style/index.js +3 -0
  37. package/lowaltitudefeature/style/lowaltitudefeature.css +1 -0
  38. package/measure/index.js +60 -19
  39. package/modelFlat/index.js +48 -8
  40. package/modeledit/index.js +38 -4
  41. package/modelexcavate/index.js +48 -7
  42. package/modelfilter/index.js +51 -8
  43. package/modelmaterialedit/index.js +127 -25
  44. package/modelprofileanalysis/index.js +51 -14
  45. package/modelselect/index.js +34 -3
  46. package/modelstyleedit/index.js +39 -3
  47. package/modeltransform/index.js +79 -14
  48. package/package.json +1 -1
  49. package/particleeffect/index.js +83 -17
  50. package/planeclip/index.js +66 -17
  51. package/pointcloudrender/index.js +134 -15
  52. package/radarscananalysis/index.js +35 -3
  53. package/resetview/index.js +14 -6
  54. package/roller/index.js +55 -18
  55. package/scaneffect/index.js +98 -29
  56. package/sceneadvancedtoimage/index.js +32 -6
  57. package/sceneapp/index.js +32440 -2337
  58. package/sceneset/index.js +141 -71
  59. package/scenetohdimage/index.js +23 -3
  60. package/sceneview/index.js +32440 -2337
  61. package/sceneview/style/sceneview.css +1 -1
  62. package/screenshot/index.js +44 -11
  63. package/shadowanalysis/index.js +79 -19
  64. package/sightlineanalysis/index.js +66 -15
  65. package/skylineanalysis/index.js +20 -4
  66. package/slopeanalysis/index.js +75 -16
  67. package/slopeaspectanalysis/index.js +128 -26
  68. package/statusbar/index.js +80 -67
  69. package/style.css +1 -1
  70. package/terrainoperation/index.js +39 -7
  71. package/terrainprofileanalysis/index.js +43 -5
  72. package/toolbarapp/index.js +32440 -2337
  73. package/toolboxapp/index.js +32440 -2337
  74. package/typhoontrac/index.js +134 -16
  75. package/underground/index.js +8 -2
  76. package/videofusion/index.js +164 -79
  77. package/videoproject/index.js +77 -23
  78. package/viewshedanalysis/index.js +61 -14
  79. package/weathereffect/index.js +73 -18
  80. package/webgl.es.js +866 -16
  81. package/windyslicing/index.js +258 -54
  82. package/wireframesketch/index.js +25 -8
package/adddata/index.js CHANGED
@@ -489,12 +489,32 @@ var _useGlobalConfig = __webpack_require__(22686);
489
489
  * All rights reserved.
490
490
  */
491
491
 
492
- //添加数据逻辑类
492
+ /**
493
+ * @class AddDataViewModel
494
+ * @classdesc 添加数据逻辑类,负责本地文件与 URL 数据源的解析加载、图层树节点管理与服务分发
495
+ * @param {Object} scenceView 三维场景视图对象,需包含 _viewer 与 _layerManager
496
+ * @param {Object} options 初始化选项
497
+ * @param {String} options.geometryServerUrl 几何服务地址前缀
498
+ * @param {String} options.geometryServerToken 几何服务 ua_token
499
+ * @param {Object} [options.geojsonStyle] 自定义 geojson 渲染样式,会与默认样式合并
500
+ */
493
501
  class AddDataViewModel {
502
+ /**
503
+ * @description 构造函数,初始化场景视图、图层管理器、几何服务地址与 token、geojson 样式
504
+ * @param {Object} scenceView 三维场景视图对象,需包含 _viewer 与 _layerManager
505
+ * @param {Object} options 初始化选项
506
+ * @param {String} options.geometryServerUrl 几何服务地址前缀
507
+ * @param {String} options.geometryServerToken 几何服务 ua_token
508
+ * @param {Object} [options.geojsonStyle] 自定义 geojson 渲染样式,会与默认样式合并
509
+ */
494
510
  constructor(scenceView, options) {
511
+ // 三维场景视图实例
495
512
  this._viewer = null;
513
+ // 图层管理器,负责临时图层节点、图层列表的维护
496
514
  this._layerManager = null;
515
+ // 当前语言环境与语言包
497
516
  this._language = null;
517
+ // geojson 数据默认渲染样式:包含 label/billboard/polyline/polygon 四类要素样式
498
518
  this._geojsonStyle = {
499
519
  label: {
500
520
  express: "name",
@@ -539,17 +559,26 @@ class AddDataViewModel {
539
559
  this._layerManager = scenceView._layerManager;
540
560
  this._geometryServerUrl = options.geometryServerUrl;
541
561
  this._geometryServerToken = options.geometryServerToken;
562
+ // 自定义样式与默认样式合并,未传入时保持默认
542
563
  if (options.geojsonStyle) this._geojsonStyle = Object.assign({}, this._geojsonStyle, options.geojsonStyle);
564
+ // 兼容网格编码相关异步模块挂载
543
565
  if (window.Module) window.mapGridAsync = window.Module;
544
566
  }
545
567
 
546
- //解析文件
568
+ /**
569
+ * @description 解析本地文件并加载到三维场景:根据扩展名分流处理 zip/txt/csv/xls/xlsx/dwg/dxf
570
+ * 及 json/geojson/kml/kmz/czml/kqgeobody 等格式,加载成功后添加临时图层节点
571
+ * @param {File} file 待解析的文件对象,依据 file.name 的扩展名决定解析方式
572
+ * @param {Function} [cb] 加载完成回调,参数为图层节点信息(失败时传 "error")
573
+ * @returns {Promise} 解析结果的 Promise,成功 resolve("success"),失败 reject 错误信息
574
+ */
547
575
  parseFile(file, cb) {
548
576
  var that = this;
549
577
  return new Promise((resolve, reject) => {
550
578
  var ext = file.name.replace(/.+\./, "").toLowerCase(); //文件扩展名
551
579
  var name = file.name.replace(/(.*\/)*([^.]+).*/gi, "$2"); //文件名
552
580
  if (ext === "zip") {
581
+ // zip 压缩包:通过几何服务解析为 SHP 后转为 geojson 数据源加载
553
582
  (0, _util.uploadSHP)(file, function (res) {
554
583
  if (res) {
555
584
  var ds = new Cesium.Kq3dGeoJsonDataSource(name);
@@ -587,6 +616,7 @@ class AddDataViewModel {
587
616
  }
588
617
  });
589
618
  } else if (ext === "txt") {
619
+ // txt 文本:调用几何服务解析坐标文本后转为 geojson 数据源加载
590
620
  let dataUrl = that._geometryServerUrl + (that._geometryServerToken ? "?ua_token=" + that._geometryServerToken : "");
591
621
  (0, _util.readTxT)(file, dataUrl, "4326", this._language.value.common, res => {
592
622
  if (res) {
@@ -625,6 +655,7 @@ class AddDataViewModel {
625
655
  }
626
656
  });
627
657
  } else if (ext === "csv") {
658
+ // csv 表格:本地解析后按 LAT/LNG 或 X/Y 列提取坐标构造 FeatureCollection
628
659
  (0, _util.readFile)(file, res => {
629
660
  var features = _papaparse.default.parse(res, {
630
661
  skipEmptyLines: true,
@@ -700,6 +731,7 @@ class AddDataViewModel {
700
731
  }
701
732
  });
702
733
  } else if (ext === "xls" || ext === "xlsx") {
734
+ // xls/xlsx 表格:通过几何服务解析为 geojson 后加载
703
735
  (0, _util.readExcel)(file, this._language.value.common, res => {
704
736
  if (res) {
705
737
  var ds = new Cesium.Kq3dGeoJsonDataSource(name);
@@ -736,6 +768,7 @@ class AddDataViewModel {
736
768
  }
737
769
  });
738
770
  } else if (ext === "dwg" || ext === "dxf") {
771
+ // dwg/dxf CAD 文件:通过几何服务解析为 geojson 后加载,并清理 srs/crs 字段
739
772
  (0, _util.uploadCad)(this._geometryServerUrl, file, this._geometryServerToken, this._language.value.common, "4326", function (res) {
740
773
  // console.log(res);
741
774
  if (res) {
@@ -781,6 +814,7 @@ class AddDataViewModel {
781
814
  }
782
815
  });
783
816
  } else {
817
+ // 其余文本类格式(json/geojson/topojson/kml/kmz/czml/kqgeobody):以文本方式读取后按扩展名分流
784
818
  var reader = new FileReader();
785
819
  reader.readAsText(file); //文本
786
820
  //readAsDataURL(file); //base64 图片
@@ -793,6 +827,7 @@ class AddDataViewModel {
793
827
  case "json":
794
828
  case "geojson":
795
829
  case "topojson":
830
+ // geojson 类:解析为对象后加载,若含 geometryType 字段则按 ArcGIS EsriGeoJson 处理
796
831
  ret = ret.replace(/(^\s*)|(\s*$)/, "");
797
832
  ret = ret.substring(ret.indexOf("{"));
798
833
  try {
@@ -842,6 +877,7 @@ class AddDataViewModel {
842
877
  });
843
878
  break;
844
879
  case "kml":
880
+ // kml 文本:转为 Blob 后由 KmlDataSource 加载
845
881
  ret = ret.replace(/(^\s*)|(\s*$)/, "");
846
882
  var options = {
847
883
  name: name,
@@ -870,6 +906,7 @@ class AddDataViewModel {
870
906
  });
871
907
  break;
872
908
  case "kmz":
909
+ // kmz 二进制压缩包:直接以 File 对象交给 KmlDataSource 加载
873
910
  var options = {
874
911
  name: name,
875
912
  camera: that._viewer.scene.camera,
@@ -894,6 +931,7 @@ class AddDataViewModel {
894
931
  });
895
932
  break;
896
933
  case "czml":
934
+ // czml:解析为对象后加载,并显示时间轴与动画控件
897
935
  ret = ret.replace(/(^\s*)|(\s*$)/, "");
898
936
  try {
899
937
  var data = JSON.parse(ret);
@@ -901,6 +939,7 @@ class AddDataViewModel {
901
939
  ret = data;
902
940
  }
903
941
  } catch (e) {}
942
+ // 首次加载 czml 时显示时间轴/动画控件并启动时钟
904
943
  if (that._viewer.timeline.container.style.display != 'block') {
905
944
  that._viewer.bottomContainer.style.bottom = '15px';
906
945
  that._viewer.timeline.container.style.display = 'block';
@@ -927,6 +966,7 @@ class AddDataViewModel {
927
966
  });
928
967
  break;
929
968
  case "kqgeobody":
969
+ // kqgeobody 地质体:解析为数组后构造 Kq3dGeologyBody 并定位到包围球
930
970
  ret = ret.replace(/(^\s*)|(\s*$)/, "");
931
971
  try {
932
972
  let data = JSON.parse(ret);
@@ -940,9 +980,11 @@ class AddDataViewModel {
940
980
  geology.name = name;
941
981
  that._viewer.geologyBodyCollection.push(geology);
942
982
  geology.createGeology(ret).then(function (geobody) {
983
+ // 将地质体图元集合加入场景 primitives(若尚未加入)
943
984
  if (!geobody.viewer.scene.primitives.contains(geobody.geologyPrimitives)) {
944
985
  geobody.geologyPrimitives = geobody.viewer.scene.primitives.add(geobody.geologyPrimitiveCollection);
945
986
  }
987
+ // 汇总所有图元的包围球并飞行定位
946
988
  let boundingSpheres = [];
947
989
  geobody.geologyPrimitives._primitives.forEach(primitive => {
948
990
  if (primitive.geometryInstances.geometry.boundingSphere) {
@@ -981,11 +1023,21 @@ class AddDataViewModel {
981
1023
  });
982
1024
  }
983
1025
 
984
- //解析数据源
1026
+ /**
1027
+ * @description 解析 URL 数据源:校验 url 有效性后通过 fetch 探测服务可用性,
1028
+ * 再调用 parseService 按类型加载;stkterrain/kqgis3dserver 会自动拼接探测地址
1029
+ * @param {Object} options 数据源选项
1030
+ * @param {String} options.type 数据源类型(如 kqgis3dserver/wms/wmts/3dtiles/geojson 等)
1031
+ * @param {String} options.url 服务地址
1032
+ * @param {String} [options.name] 节点名称
1033
+ * @param {Function} [cb] 加载完成回调,参数为图层节点信息
1034
+ * @param {Function} [loadCustom] 自定义加载函数(仅 KQGIS 地图服务生效,earthstudio 使用)
1035
+ */
985
1036
  parseDataSource(options, cb, loadCustom) {
986
1037
  options = options || {};
987
1038
  if (options.url && options.url !== "") {
988
1039
  let url = options.url;
1040
+ // stkterrain 地形服务:自动拼接 layer.json 用于可用性探测
989
1041
  if (options.type === "stkterrain") {
990
1042
  if (url.indexOf("?") > 0) {
991
1043
  url = url.replace("?", "layer.json?");
@@ -993,6 +1045,7 @@ class AddDataViewModel {
993
1045
  url += "layer.json";
994
1046
  }
995
1047
  } else if (options.type === "kqgis3dserver") {
1048
+ // KQGIS 三维服务:自动拼接 /tilesets 用于可用性探测
996
1049
  if (url.indexOf("?") > 0) {
997
1050
  url = url.replace("?", "/tilesets?");
998
1051
  } else {
@@ -1039,13 +1092,23 @@ class AddDataViewModel {
1039
1092
  }
1040
1093
  }
1041
1094
 
1042
- //解析服务
1095
+ /**
1096
+ * @description 解析服务:按 options.type 分发到各类型服务的加载逻辑,
1097
+ * 加载完成后构造图层节点并调用 _layerManager.addTempLayerNode 注册
1098
+ * @param {Object} options 数据源选项
1099
+ * @param {String} options.type 数据源类型(小写匹配 switch 分支)
1100
+ * @param {String} options.url 服务地址
1101
+ * @param {String} [options.name] 节点名称,为空时按 url 自动推断
1102
+ * @param {Function} [cb] 加载完成回调,参数为图层节点信息
1103
+ * @param {Function} [loadCustom] 自定义加载函数(仅 KQGIS 地图服务生效)
1104
+ */
1043
1105
  parseService(options, cb, loadCustom) {
1044
1106
  let that = this;
1045
1107
  let url = options.url;
1046
1108
  let type = options.type || "";
1047
1109
  type = type.toLowerCase();
1048
1110
  let name = options.name;
1111
+ // 名称缺省时:文件型服务取 url 末段,其余服务取 url 倒数第二段作为名称
1049
1112
  if (!name || name === "") {
1050
1113
  let ext;
1051
1114
  if (url.lastIndexOf(".") > url.lastIndexOf("/")) {
@@ -1127,6 +1190,7 @@ class AddDataViewModel {
1127
1190
  cb && cb(node);
1128
1191
  break;
1129
1192
  case "3dtiles":
1193
+ // 3DTiles 瓦片集:作为 primitive 加入场景
1130
1194
  var tileset = this._viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
1131
1195
  name: name,
1132
1196
  url: url
@@ -1165,6 +1229,7 @@ class AddDataViewModel {
1165
1229
  var addType = "";
1166
1230
  let promiseList = [];
1167
1231
  for (var i = 0; i < layers.length; i++) {
1232
+ // 按图元类型识别 KQGIS 三维服务子图层,并归类 serverType/addType
1168
1233
  if (layers[i] instanceof Cesium.Cesium3DTileset) {
1169
1234
  serverType = "3dtiles";
1170
1235
  addType = "3dtiles";
@@ -1184,6 +1249,7 @@ class AddDataViewModel {
1184
1249
  url = layers[i]._originUrl;
1185
1250
  this._layerManager._terrainProviders.push(layers[i]);
1186
1251
  } else if (layers[i] instanceof Cesium.Kq3dGeoJsonDataSource) {
1252
+ // geojson 数据源:监听 loadingEvent 完成后构造子节点(含点线面类型判断)
1187
1253
  serverType = "datasource";
1188
1254
  addType = "geojson";
1189
1255
  url = layers[i]._url;
@@ -1271,6 +1337,7 @@ class AddDataViewModel {
1271
1337
  let list = service.collectionInfoList;
1272
1338
  if (list && list.length > 0) {
1273
1339
  list.forEach(item => {
1340
+ // 多维气象数据走 windy 气象渲染通道
1274
1341
  if (item.type === 'Image' && item.hasMultidimension && item.additionInfo) {
1275
1342
  let params = that._layerManager._windyViewModel.getWeatherDataOptions(item);
1276
1343
  let layerConfig = {
@@ -1338,6 +1405,7 @@ class AddDataViewModel {
1338
1405
 
1339
1406
  window.KqGIS.getVectorStyleForDataService(url, 'EPSG:3857').then(data => {
1340
1407
  let style = data.style;
1408
+ // 将带图标的 symbol 图层替换为圆点文本样式,规避图标缺失导致的渲染问题
1341
1409
  style.layers.forEach(item => {
1342
1410
  if (item.type == "symbol") {
1343
1411
  if (item.layout["icon-image"]) {
@@ -1562,6 +1630,7 @@ class AddDataViewModel {
1562
1630
  });
1563
1631
  break;
1564
1632
  case "wms":
1633
+ // OGC WMS 服务:加载图层组并补充 KQGIS 服务信息用于查询分析
1565
1634
  this._viewer.addWMSLayerGroup(url).then(group => {
1566
1635
  node = {
1567
1636
  guid: group.guid,
@@ -1590,6 +1659,7 @@ class AddDataViewModel {
1590
1659
  // this._layerManager.addTempLayerNode(node);
1591
1660
  // cb && cb(node);
1592
1661
 
1662
+ // wms 节点先以深拷贝形式回调,再异步补充 KQGIS 图层信息后注册到图层树
1593
1663
  cb && cb(JSON.parse(JSON.stringify(node)));
1594
1664
  this._addKQGISInfo(url, node);
1595
1665
  });
@@ -1598,6 +1668,7 @@ class AddDataViewModel {
1598
1668
  case "kqgistileserver": // KQGIS 瓦片服务
1599
1669
  case "kqgisaggregationserver":
1600
1670
  // KQGIS 聚合服务
1671
+ // KQGIS 瓦片服务需拼接 /wmts 后再按 WMTS 流程解析
1601
1672
  if (type === "kqgistileserver") {
1602
1673
  if (url.indexOf("?") > 0) {
1603
1674
  url = url.replace("?", "/wmts?");
@@ -1621,6 +1692,7 @@ class AddDataViewModel {
1621
1692
  if (tileMatrix.length > 0) {
1622
1693
  let scale = Number(tileMatrix[0].ScaleDenominator);
1623
1694
  let precision = scale * 0.001;
1695
+ // 校验顶层比例尺是否符合标准 WMTS(0 层或 1 层比例尺),符合才加载
1624
1696
  if (Math.abs(scale - 559082264.028716) < precision || Math.abs(scale - 279541132.014358) < precision) {
1625
1697
  this._viewer.addWMTSLayerGroup(url).then(group => {
1626
1698
  // if(type === "kqgistileserver") defaultName = name;
@@ -1652,6 +1724,7 @@ class AddDataViewModel {
1652
1724
  });
1653
1725
  }
1654
1726
  }
1727
+ // wmts 走 KQGIS 信息补充流程;瓦片/聚合服务直接注册图层树
1655
1728
  if (type === "wmts") {
1656
1729
  cb && cb(JSON.parse(JSON.stringify(node)));
1657
1730
  this._addKQGISInfo(url, node);
@@ -1670,6 +1743,7 @@ class AddDataViewModel {
1670
1743
  });
1671
1744
  break;
1672
1745
  case "wfs":
1746
+ // OGC WFS 服务:先 GetCapabilities 获取所有 typeName,再逐个 GetFeature 转 geojson 加载
1673
1747
  let serverInfo = new KqGIS.Data.WFSInfoService(url);
1674
1748
  serverInfo.dataWFSInfo({
1675
1749
  request: 'GetCapabilities'
@@ -1750,6 +1824,7 @@ class AddDataViewModel {
1750
1824
  });
1751
1825
  break;
1752
1826
  case "geojson":
1827
+ // geojson URL:直接加载为 Kq3dGeoJsonDataSource,并为面要素补充边框线
1753
1828
  var ds = new Cesium.Kq3dGeoJsonDataSource(name);
1754
1829
  ds.load(url, this._geojsonStyle).then(ds => {
1755
1830
  ds.entities.values.forEach(entity => {
@@ -1780,6 +1855,7 @@ class AddDataViewModel {
1780
1855
  });
1781
1856
  break;
1782
1857
  case "arcjson":
1858
+ // ArcGIS JSON URL:使用 EsriGeoJsonDataSource 加载,label 字段固定为 NAME
1783
1859
  var ds = new Cesium.Kq3dEsriGeoJsonDataSource(name);
1784
1860
  var geojsonStyle = {
1785
1861
  ...this._geojsonStyle
@@ -1813,6 +1889,7 @@ class AddDataViewModel {
1813
1889
  });
1814
1890
  break;
1815
1891
  case "kml":
1892
+ // kml URL:通过 KmlDataSource 加载,需传入 camera 与 canvas
1816
1893
  var ds = new Cesium.KmlDataSource({
1817
1894
  name: name,
1818
1895
  camera: this._viewer.camera,
@@ -1835,6 +1912,7 @@ class AddDataViewModel {
1835
1912
  });
1836
1913
  break;
1837
1914
  case "czml":
1915
+ // czml URL:通过 CzmlDataSource 加载
1838
1916
  var ds = new Cesium.CzmlDataSource(name);
1839
1917
  ds.load(url).then(ds => {
1840
1918
  this._viewer.dataSources.add(ds);
@@ -1853,6 +1931,7 @@ class AddDataViewModel {
1853
1931
  });
1854
1932
  break;
1855
1933
  case "s3m":
1934
+ // S3M 模型服务:作为 Kq3dS3MTilesLayer 图元加入场景
1856
1935
  layer = this._viewer.scene.primitives.add(new Cesium.Kq3dS3MTilesLayer({
1857
1936
  context: this._viewer.scene._context,
1858
1937
  url: url,
@@ -1878,7 +1957,11 @@ class AddDataViewModel {
1878
1957
  }
1879
1958
  }
1880
1959
 
1881
- // KQGIS地图服务wms或者wmts方式加载, 添加KQGIS服务图层信息用于查询和分析
1960
+ /**
1961
+ * @description KQGIS 地图服务以 wms/wmts 方式加载时,补充 KQGIS 服务图层信息用于查询和分析
1962
+ * @param {String} url 服务地址,需包含 /kqgis/ 与 /map/wmts 或 /map/wms 才走补充流程
1963
+ * @param {Object} node 已构造的图层树节点,children 会被 layerInfo 合并增强
1964
+ */
1882
1965
  _addKQGISInfo(url, node) {
1883
1966
  if (url.indexOf("/kqgis/") > -1 && (url.indexOf("/map/wmts") > -1 || url.indexOf("/map/wms") > -1)) {
1884
1967
  let serverName = url.split("services/")[1].split("/")[0];
@@ -1919,6 +2002,12 @@ class AddDataViewModel {
1919
2002
  this._layerManager.addTempLayerNode(node);
1920
2003
  }
1921
2004
  }
2005
+
2006
+ /**
2007
+ * @description 加载 KQGIS 数据服务下所有数据源与数据集,构建图层树子节点数组
2008
+ * @param {String} url 数据服务地址
2009
+ * @returns {Promise} resolve 为子节点数组;失败时 reject([])
2010
+ */
1922
2011
  addDataServer(url) {
1923
2012
  return new Promise((resolve, reject) => {
1924
2013
  Cesium.Kq3dService.datasourceService(url).getDatasources(async e => {
@@ -1945,6 +2034,13 @@ class AddDataViewModel {
1945
2034
  });
1946
2035
  });
1947
2036
  }
2037
+
2038
+ /**
2039
+ * @description 获取指定数据源下的数据集列表
2040
+ * @param {String} url 数据服务地址
2041
+ * @param {String} datasourceName 数据源名称
2042
+ * @returns {Promise} resolve 为数据集数组;失败时 reject([])
2043
+ */
1948
2044
  _getDatasetList(url, datasourceName) {
1949
2045
  let params = new window.KqGIS.Data.GetDatasetsInfoParams({
1950
2046
  datasourceName: datasourceName
@@ -1964,7 +2060,13 @@ class AddDataViewModel {
1964
2060
  });
1965
2061
  }
1966
2062
 
1967
- // 加载数据集
2063
+ /**
2064
+ * @description 加载数据集:按 isParentDataset 区分父子层级,递归构建数据源节点树
2065
+ * @param {String} url 数据服务地址
2066
+ * @param {String} datasourceName 数据源名称
2067
+ * @param {Array} datasetList 数据集列表
2068
+ * @param {Array} nodes 输出参数,构建完成的数据源节点会被 push 进该数组
2069
+ */
1968
2070
  async _addDataSets(url, datasourceName, datasetList, nodes) {
1969
2071
  let dataSourceNode = {
1970
2072
  guid: window.Cesium.createGuid(),
@@ -1975,8 +2077,10 @@ class AddDataViewModel {
1975
2077
  // 获取数据集类型数据
1976
2078
  const datasetArr = datasetList.filter(o => o['isParentDataset'] === true);
1977
2079
  if (datasetArr.length === 0) {
2080
+ // 无父数据集:直接将所有数据集作为要素加载
1978
2081
  await this._addFeatures(url, datasourceName, datasetList, dataSourceNode);
1979
2082
  } else {
2083
+ // 存在父子层级:先建立父节点,再按 parentDatasetName 分组加载子数据集
1980
2084
  datasetArr.forEach(dataset => {
1981
2085
  dataSourceNode.children.unshift({
1982
2086
  guid: window.Cesium.createGuid(),
@@ -1993,7 +2097,14 @@ class AddDataViewModel {
1993
2097
  nodes.push(dataSourceNode);
1994
2098
  }
1995
2099
 
1996
- // 加载要素
2100
+ /**
2101
+ * @description 加载要素:遍历数据集,逐个获取要素并转为 geojson 数据源,挂到父节点下
2102
+ * @param {String} url 数据服务地址
2103
+ * @param {String} datasourceName 数据源名称
2104
+ * @param {Array} datasetList 数据集列表
2105
+ * @param {Object} parentNode 父节点,加载完成的子节点会 push 到其 children
2106
+ * @returns {Promise} 所有数据集加载完成后 resolve
2107
+ */
1997
2108
  async _addFeatures(url, datasourceName, datasetList, parentNode) {
1998
2109
  let promises = [];
1999
2110
  for (let i = 0; i < datasetList.length; i++) {
@@ -2034,6 +2145,14 @@ class AddDataViewModel {
2034
2145
  });
2035
2146
  });
2036
2147
  }
2148
+
2149
+ /**
2150
+ * @description 获取指定数据集的要素列表(带几何、输出 EPSG:4326)
2151
+ * @param {String} url 数据服务地址
2152
+ * @param {String} datasourceName 数据源名称
2153
+ * @param {String} datasetName 数据集名称
2154
+ * @returns {Promise} resolve 为要素结果(附加 datasetName 字段);失败时 reject(null)
2155
+ */
2037
2156
  _getFeatureList(url, datasourceName, datasetName) {
2038
2157
  let params = new window.KqGIS.Data.GetFeaturesParamsBase({
2039
2158
  datasourceName: datasourceName,
@@ -2057,34 +2176,46 @@ class AddDataViewModel {
2057
2176
  });
2058
2177
  });
2059
2178
  }
2179
+
2180
+ /**
2181
+ * @description 飞行定位到指定图层:按图层类型分别采用 getViewableRectangle、
2182
+ * boundingSphere、rectangle 或 flyTo 等方式定位
2183
+ * @param {Object} layer 目标图层,支持 ImageryLayer/Cesium3DTileset/S3MTilesLayer/GeoJsonDataSource/KmlDataSource/CzmlDataSource/地形 Provider/I3SDataProvider 等
2184
+ */
2060
2185
  flyToLayer(layer) {
2061
2186
  let viewer = this._viewer;
2062
2187
  if (layer instanceof Cesium.ImageryLayer) {
2188
+ // 影像图层:飞到可视矩形
2063
2189
  layer.getViewableRectangle().then(function (rectangle) {
2064
2190
  viewer.camera.flyTo({
2065
2191
  destination: rectangle
2066
2192
  });
2067
2193
  });
2068
2194
  } else if (layer instanceof Cesium.Cesium3DTileset) {
2195
+ // 3DTiles:飞到包围球
2069
2196
  layer.readyPromise.then(function () {
2070
2197
  viewer.camera.flyToBoundingSphere(layer.boundingSphere, {
2071
2198
  offset: new Cesium.HeadingPitchRange(0.0, Cesium.Math.toRadians(-90.0), layer.boundingSphere.radius * 2)
2072
2199
  });
2073
2200
  });
2074
2201
  } else if (layer instanceof Cesium.Kq3dS3MTilesLayer) {
2202
+ // S3M 模型:飞到图层 rectangle
2075
2203
  layer.readyPromise.then(function (tileset) {
2076
2204
  viewer.camera.flyTo({
2077
2205
  destination: tileset.rectangle
2078
2206
  });
2079
2207
  });
2080
2208
  } else if (layer instanceof Cesium.GeoJsonDataSource || layer instanceof Cesium.Kq3dGeoJsonDataSource || layer instanceof Cesium.Kq3dEsriGeoJsonDataSource) {
2209
+ // GeoJson 数据源:俯视定位
2081
2210
  let offset = new Cesium.HeadingPitchRange(0, Cesium.Math.toRadians(-90), 0);
2082
2211
  viewer.flyTo(layer, {
2083
2212
  offset
2084
2213
  });
2085
2214
  } else if (layer instanceof Cesium.KmlDataSource || layer instanceof Cesium.CzmlDataSource) {
2215
+ // KML/CZML:直接 flyTo
2086
2216
  viewer.flyTo(layer);
2087
2217
  } else if (layer instanceof Cesium.Kq3dKQGISServerTerrainProvider || layer instanceof Cesium.Kq3dFileTerrainProvider || layer instanceof Cesium.CesiumTerrainProvider) {
2218
+ // 地形 Provider:优先用 ExtentSource 范围,否则用可视矩形
2088
2219
  layer.getViewableRectangle().then(function (rectangle) {
2089
2220
  if (layer.ExtentSource) {
2090
2221
  var rectangle = Cesium.Rectangle.fromDegrees(layer.ExtentSource.left, layer.ExtentSource.bottom, layer.ExtentSource.right, layer.ExtentSource.top);
@@ -2098,7 +2229,7 @@ class AddDataViewModel {
2098
2229
  }
2099
2230
  });
2100
2231
  } else if (Cesium.I3SDataProvider) {
2101
- // i3s图层定位
2232
+ // i3s 图层定位
2102
2233
  if (layer instanceof Cesium.I3SDataProvider) {
2103
2234
  viewer.camera.flyTo({
2104
2235
  destination: layer.extent
@@ -2108,7 +2239,11 @@ class AddDataViewModel {
2108
2239
  }
2109
2240
  }
2110
2241
 
2111
- // 设置子节点addType属性
2242
+ /**
2243
+ * @description 递归设置节点树叶子节点的 addType 属性
2244
+ * @param {Array} nodeList 图层节点数组
2245
+ * @param {String} addType 待设置的 addType 值
2246
+ */
2112
2247
  exports["default"] = AddDataViewModel;
2113
2248
  function setChildrenAddType(nodeList, addType) {
2114
2249
  for (let i = 0; i < nodeList.length; i++) {
@@ -2623,6 +2758,8 @@ const _hoisted_11 = {
2623
2758
  const _hoisted_12 = {
2624
2759
  class: "btns_box"
2625
2760
  };
2761
+ // 允许上传的文件扩展名清单
2762
+
2626
2763
  const __default__ = {
2627
2764
  name: "Kq3dAddData"
2628
2765
  };
@@ -2712,31 +2849,42 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
2712
2849
  expose: __expose
2713
2850
  }) {
2714
2851
  let accept = ".zip,.geojson,.topojson,.json,.kml,.kmz,.czml,.csv,.xls,.xlsx,.txt,.dwg,.dxf,.kqgeobody";
2852
+ // 当前语言环境与语言包
2715
2853
  const {
2716
2854
  lang,
2717
2855
  locale
2718
2856
  } = (0, _useGlobalConfig.useLocale)();
2857
+ // 监听语言切换,重新生成数据源类型列表并同步当前选中的类型
2719
2858
  (0, _vue.watch)(() => lang.value, (newVal, oldVal) => {
2720
2859
  dataSourceTypeList.value = setDataSourceType();
2721
2860
  dataSourceType.value = dataSourceTypeList.value[selectTypeIndex.value];
2722
2861
  });
2862
+ // 当前选中的数据源类型索引
2723
2863
  let selectTypeIndex = (0, _vue.ref)(0);
2724
2864
  //选择的数据源类型
2725
2865
  let dataSourceType = (0, _vue.ref)({});
2866
+ // URL 加载表单数据:服务地址与节点名称
2726
2867
  let dataSource = (0, _vue.reactive)({
2727
2868
  url: "",
2728
2869
  name: ""
2729
2870
  });
2871
+
2872
+ // 拖拽上传组件的 ref 引用
2730
2873
  let upload_ref = (0, _vue.ref)(null);
2874
+ // 点击选择文件按钮对应的上传组件 ref 引用
2731
2875
  let upload_btn_ref = (0, _vue.ref)(null);
2876
+ // 待加载的本地文件列表
2732
2877
  let fileList = (0, _vue.ref)([]);
2878
+ // 本地文件加载中状态标识
2733
2879
  let loadingFile = (0, _vue.ref)(false);
2734
2880
 
2735
2881
  // 获取组件传参
2736
2882
  const props = __props;
2737
2883
  //URL服务支持的数据源类型
2738
2884
  let dataSourceTypeList = (0, _vue.ref)(setDataSourceType());
2885
+ // 初始化当前选中的数据源类型
2739
2886
  dataSourceType.value = dataSourceTypeList.value[selectTypeIndex.value];
2887
+ // 将文件列表按每行 3 个分组,用于在界面上以栅格形式展示
2740
2888
  let operatorArray = (0, _vue.computed)(() => {
2741
2889
  let array = [];
2742
2890
  let list = [...fileList.value];
@@ -2746,6 +2894,8 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
2746
2894
  }
2747
2895
  return array;
2748
2896
  });
2897
+
2898
+ // 加载按钮禁用状态:当文件列表为空时禁用
2749
2899
  let disabled = (0, _vue.computed)(() => {
2750
2900
  let flag = true;
2751
2901
  if (fileList.value.length > 0) {
@@ -2759,8 +2909,12 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
2759
2909
 
2760
2910
  // 生成组件默认header
2761
2911
  let headerTemp = (0, _vue.ref)();
2912
+ // 头部模板组件实例引用
2762
2913
  let headerTempRef = (0, _vue.ref)();
2914
+ // 业务逻辑类实例
2763
2915
  let viewModel = null;
2916
+
2917
+ /** @description 构造 URL 服务支持的数据源类型列表(依据 isShowKQGISKey 与 hideServiceTypes 进行过滤和文本替换) */
2764
2918
  function setDataSourceType() {
2765
2919
  let types = [
2766
2920
  // {
@@ -2909,6 +3063,8 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
2909
3063
  }
2910
3064
  return types;
2911
3065
  }
3066
+
3067
+ /** @description 组件挂载钩子:定位容器、监听 position 与 showHeaderTemp 变化、实例化 AddDataViewModel */
2912
3068
  (0, _vue.onMounted)(() => {
2913
3069
  (0, _util.updatePosition)(boxRef.value, props);
2914
3070
  (0, _vue.watch)(() => props.position, (newVal, oldVal) => {
@@ -2942,22 +3098,34 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
2942
3098
  }
2943
3099
  };
2944
3100
 
2945
- // 切换tab页
3101
+ /**
3102
+ * @description 切换tab页
3103
+ * @param {Object} pane 切换后的 tab pane 对象
3104
+ */
2946
3105
  function handleChange(pane) {}
2947
3106
 
2948
- // 切换类型
3107
+ /**
3108
+ * @description 切换类型,重置当前数据源类型对象与表单输入
3109
+ * @param {Number} index 新选中的数据源类型在 dataSourceTypeList 中的索引
3110
+ */
2949
3111
  function changeType(index) {
2950
3112
  dataSourceType.value = dataSourceTypeList.value[index];
2951
3113
  dataSource.url = "";
2952
3114
  dataSource.name = "";
2953
3115
  }
2954
3116
 
2955
- //选择文件
3117
+ /**
3118
+ * @description 选择文件回调,将新选择的文件追加到文件列表
3119
+ * @param {Object} file kq-upload 组件返回的文件对象
3120
+ */
2956
3121
  function changeFile(file) {
2957
3122
  fileList.value.push(file);
2958
3123
  }
2959
3124
 
2960
- // 删除文件
3125
+ /**
3126
+ * @description 删除文件,依据 uid 从文件列表中移除指定文件
3127
+ * @param {Object} file 待删除的文件对象
3128
+ */
2961
3129
  function removeFile(file) {
2962
3130
  fileList.value.forEach((item, index) => {
2963
3131
  if (item.uid === file.uid) {
@@ -2966,14 +3134,14 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
2966
3134
  });
2967
3135
  }
2968
3136
 
2969
- //清空所有文件
3137
+ /** @description 清空所有文件,重置上传组件并清空文件列表 */
2970
3138
  function removeFiles() {
2971
3139
  upload_ref.value.$refs.child.clearFiles();
2972
3140
  upload_btn_ref.value.$refs.child.clearFiles();
2973
3141
  fileList.value = [];
2974
3142
  }
2975
3143
 
2976
- //加载文件
3144
+ /** @description 加载文件:并发解析所有已选文件,成功后清空列表,失败则提示 */
2977
3145
  function loadFiles() {
2978
3146
  loadingFile.value = true;
2979
3147
  let promiseList = [];
@@ -2994,7 +3162,7 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
2994
3162
  });
2995
3163
  }
2996
3164
 
2997
- //加载URL
3165
+ /** @description 加载URL:去除 url 前后空格后调用 ViewModel.parseDataSource 解析 */
2998
3166
  function loadURL() {
2999
3167
  dataSource.url = dataSource.url.trim();
3000
3168
  viewModel.parseDataSource({
@@ -3004,13 +3172,13 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
3004
3172
  }, props.loadCallback, props.loadCustom);
3005
3173
  }
3006
3174
 
3007
- // 重置
3175
+ /** @description 重置 URL 加载表单:清空 url 与 name 字段 */
3008
3176
  function reset() {
3009
3177
  dataSource.url = "";
3010
3178
  dataSource.name = "";
3011
3179
  }
3012
3180
 
3013
- // 销毁
3181
+ /** @description 组件销毁前钩子(预留清理逻辑) */
3014
3182
  (0, _vue.onBeforeUnmount)(() => {});
3015
3183
  __expose({});
3016
3184
  return (_ctx, _cache) => {
@@ -3455,11 +3623,11 @@ Object.defineProperty(exports, "__esModule", ({
3455
3623
  value: true
3456
3624
  }));
3457
3625
  exports.kq_npm_client_leaflet_vue = exports.kq_npm_client_common_vue = exports.kq_npm_client3d_webgl_vue = void 0;
3458
- let kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
3626
+ const kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
3459
3627
  __webpack_require__.g.kq_npm_client_common_vue = kq_npm_client_common_vue;
3460
- let kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
3628
+ const kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
3461
3629
  __webpack_require__.g.kq_npm_client_leaflet_vue = kq_npm_client_leaflet_vue;
3462
- let kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
3630
+ const kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
3463
3631
  __webpack_require__.g.kq_npm_client3d_webgl_vue = kq_npm_client3d_webgl_vue;
3464
3632
 
3465
3633
  /***/ })