@kq_npm/client3d_webgl_vue 4.5.56 → 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 (73) hide show
  1. package/adddata/index.js +189 -21
  2. package/airspacegridoccupancyquery/index.js +108 -7
  3. package/airspaceprofileanalysis/index.js +99 -7
  4. package/aspectanalysis/index.js +25 -7
  5. package/baseterraingallery/index.js +16 -4
  6. package/boxclip/index.js +58 -16
  7. package/buildpointmodel/index.js +3441 -544
  8. package/buildpointmodel/style/buildpointmodel.css +1 -1
  9. package/buildpolygonmodel/index.js +205 -81
  10. package/buildpolylinemodel/index.js +346 -70
  11. package/clientPrint/index.js +10524 -3041
  12. package/comparemap/index.js +132 -60
  13. package/compass/index.js +16 -6
  14. package/excavatefillanalysis/index.js +51 -7
  15. package/fixedzoomin/index.js +24 -7
  16. package/fixedzoomout/index.js +25 -7
  17. package/flight/index.js +113 -26
  18. package/floodanalysis/index.js +79 -14
  19. package/geologicalbodyanalysis/index.js +41 -5
  20. package/gpuspatialquery/index.js +59 -11
  21. package/gridoccupancyquery/index.js +78 -12
  22. package/hawkeye/index.js +20 -2
  23. package/headertemp/index.js +7 -2
  24. package/heatmap3d/index.js +282 -158
  25. package/index.js +10524 -3041
  26. package/isolineanalysis/index.js +113 -38
  27. package/light/index.js +80 -22
  28. package/limitheightanalysis/index.js +30 -10
  29. package/lowaltitudefeature/index.js +292 -119
  30. package/measure/index.js +60 -19
  31. package/modelFlat/index.js +48 -8
  32. package/modeledit/index.js +38 -4
  33. package/modelexcavate/index.js +48 -7
  34. package/modelfilter/index.js +51 -8
  35. package/modelmaterialedit/index.js +127 -25
  36. package/modelprofileanalysis/index.js +50 -14
  37. package/modelselect/index.js +33 -3
  38. package/modelstyleedit/index.js +39 -3
  39. package/modeltransform/index.js +79 -14
  40. package/package.json +1 -1
  41. package/particleeffect/index.js +83 -17
  42. package/planeclip/index.js +66 -17
  43. package/pointcloudrender/index.js +134 -15
  44. package/radarscananalysis/index.js +35 -3
  45. package/resetview/index.js +14 -6
  46. package/roller/index.js +55 -18
  47. package/scaneffect/index.js +98 -29
  48. package/sceneadvancedtoimage/index.js +32 -6
  49. package/sceneapp/index.js +10524 -3041
  50. package/sceneset/index.js +141 -71
  51. package/scenetohdimage/index.js +23 -3
  52. package/sceneview/index.js +10524 -3041
  53. package/screenshot/index.js +44 -11
  54. package/shadowanalysis/index.js +79 -19
  55. package/sightlineanalysis/index.js +66 -15
  56. package/skylineanalysis/index.js +20 -4
  57. package/slopeanalysis/index.js +75 -16
  58. package/slopeaspectanalysis/index.js +128 -26
  59. package/statusbar/index.js +80 -67
  60. package/style.css +1 -1
  61. package/terrainoperation/index.js +39 -7
  62. package/terrainprofileanalysis/index.js +43 -5
  63. package/toolbarapp/index.js +10524 -3041
  64. package/toolboxapp/index.js +10524 -3041
  65. package/typhoontrac/index.js +134 -16
  66. package/underground/index.js +8 -2
  67. package/videofusion/index.js +86 -30
  68. package/videoproject/index.js +77 -23
  69. package/viewshedanalysis/index.js +58 -13
  70. package/weathereffect/index.js +73 -18
  71. package/webgl.es.js +263 -264
  72. package/windyslicing/index.js +233 -45
  73. package/wireframesketch/index.js +25 -8
@@ -1062,11 +1062,21 @@ var _message = _interopRequireDefault(__webpack_require__(71323));
1062
1062
  var _loading = _interopRequireDefault(__webpack_require__(90724));
1063
1063
  var _useGlobalConfig = __webpack_require__(22686);
1064
1064
  class AirspaceGridOccupancyQueryViewModel {
1065
+ // 全屏加载实例
1066
+
1067
+ /** @description 构造函数,初始化视图模型
1068
+ * @param {Object} scenceView 场景视图对象,包含 _viewer、_drawManager 等
1069
+ * @param {Object} options 用户传入的查询参数
1070
+ */
1065
1071
  constructor(scenceView, options) {
1066
1072
  this._viewer = null;
1073
+ // Cesium 场景视图实例
1067
1074
  this._mapTarget = null;
1075
+ // 地图容器 DOM id
1068
1076
  this._options = {};
1077
+ // 当前生效的查询参数
1069
1078
  this._defaultOptions = {
1079
+ // 默认查询参数
1070
1080
  queryUrl: "",
1071
1081
  calcLevel: 23,
1072
1082
  heightType: "trueHeight",
@@ -1076,10 +1086,15 @@ class AirspaceGridOccupancyQueryViewModel {
1076
1086
  merge: true
1077
1087
  };
1078
1088
  this._drawManager = null;
1089
+ // 绘制管理器,负责矩形绘制交互
1079
1090
  this._language = null;
1091
+ // 多语言资源对象
1080
1092
  this._htmlTag = null;
1093
+ // HTML 标签对象(保留字段)
1081
1094
  this._clickGirdPrimitive = null;
1095
+ // 点击拾取的网格图元(保留字段)
1082
1096
  this._queryGrids = [];
1097
+ // 已添加到场景中的查询网格图元集合
1083
1098
  this._loading = null;
1084
1099
  const {
1085
1100
  locale
@@ -1093,9 +1108,12 @@ class AirspaceGridOccupancyQueryViewModel {
1093
1108
  this._viewer.postProcessStages.fxaa.enabled = true;
1094
1109
  this._viewer.scene.logarithmicDepthBuffer = true;
1095
1110
  }
1111
+
1112
+ // 启动查询:校验参数后启动矩形绘制交互(无参数)
1096
1113
  start() {
1097
1114
  const that = this;
1098
1115
  const queryUrl = this._options.queryUrl || "";
1116
+ // 校验查询服务地址是否配置
1099
1117
  if (!queryUrl.trim()) {
1100
1118
  (0, _message.default)({
1101
1119
  message: that._language.value.webgl["gridOccupancyQueryUrlEmpty"] || "请配置查询服务地址",
@@ -1105,6 +1123,7 @@ class AirspaceGridOccupancyQueryViewModel {
1105
1123
  }
1106
1124
  const startH = Number(this._options.startHeight);
1107
1125
  const endH = Number(this._options.endHeight);
1126
+ // 校验起始高度不能大于结束高度
1108
1127
  if (!isNaN(startH) && !isNaN(endH) && startH > endH) {
1109
1128
  (0, _message.default)({
1110
1129
  message: that._language.value.webgl["airspaceGridOccupancyQueryHeightError"] || "起始高度不能大于结束高度",
@@ -1114,6 +1133,7 @@ class AirspaceGridOccupancyQueryViewModel {
1114
1133
  }
1115
1134
  this.removeData();
1116
1135
  if (!this._drawManager) return;
1136
+ // 启动矩形绘制,绘制完成后回调中执行查询
1117
1137
  this._drawManager.startDraw("rectangle", {
1118
1138
  fill: true,
1119
1139
  clampToGround: false
@@ -1125,6 +1145,10 @@ class AirspaceGridOccupancyQueryViewModel {
1125
1145
  that._drawManager.clearDrawGroup("AirspaceGridOccupancyQueryDraw");
1126
1146
  }, "AirspaceGridOccupancyQueryDraw");
1127
1147
  }
1148
+
1149
+ /** @description 根据绘制的矩形区域执行空域网格占用查询并绘制结果
1150
+ * @param {Object} shape 绘制得到的矩形几何对象
1151
+ */
1128
1152
  showAirspaceGridOccupancyQuery(shape) {
1129
1153
  this.removeData();
1130
1154
  const that = this;
@@ -1134,6 +1158,8 @@ class AirspaceGridOccupancyQueryViewModel {
1134
1158
  const endHeight = this._options.endHeight || 100;
1135
1159
  const buffer = this._options.buffer || 0;
1136
1160
  const merge = this._options.merge !== undefined ? this._options.merge : true;
1161
+
1162
+ // 将矩形弧度边界转为角度经纬度
1137
1163
  const minLon = shape.rectangle.west / Math.PI * 180;
1138
1164
  const maxLon = shape.rectangle.east / Math.PI * 180;
1139
1165
  const minLat = shape.rectangle.south / Math.PI * 180;
@@ -1143,6 +1169,8 @@ class AirspaceGridOccupancyQueryViewModel {
1143
1169
  // 客户端计算矩形范围内的三维网格编码列表,用作轮廓打底
1144
1170
  const codeList = Module.calcGeoSotGBCode3DListOfRectZ(minLon, minLat, startHeight, maxLon, maxLat, endHeight, level - 1);
1145
1171
  this.drawGridsOutlineFromCodeList(codeList, Cesium.Color.GREEN.withAlpha(0.3));
1172
+
1173
+ // 构造查询请求体
1146
1174
  const body = {
1147
1175
  geom: {
1148
1176
  type: "FeatureCollection",
@@ -1161,6 +1189,8 @@ class AirspaceGridOccupancyQueryViewModel {
1161
1189
  merge: merge
1162
1190
  };
1163
1191
  this._showLoading();
1192
+
1193
+ // 请求服务端获取占用网格并绘制
1164
1194
  fetch(queryUrl + "/airspaceOccupyRegion", {
1165
1195
  method: "POST",
1166
1196
  headers: {
@@ -1197,6 +1227,11 @@ class AirspaceGridOccupancyQueryViewModel {
1197
1227
  });
1198
1228
  });
1199
1229
  }
1230
+
1231
+ /** @description 根据网格编码列表绘制实心网格图元
1232
+ * @param {Array} codeList 网格编码数组
1233
+ * @param {Cesium.Color} color 网格填充颜色
1234
+ */
1200
1235
  drawGridsFromCodeList(codeList, color) {
1201
1236
  let instances = [];
1202
1237
  for (let i = 0; i < codeList.length; i++) {
@@ -1204,6 +1239,7 @@ class AirspaceGridOccupancyQueryViewModel {
1204
1239
  const index = (code.length + 1) / 2;
1205
1240
  const grid = Module.decodeGeoSotGBCodeToBox(code.substring(0, index), code.substring(index));
1206
1241
  if (grid) {
1242
+ // 限制经纬度边界到合法范围
1207
1243
  if (grid.minx < -180) grid.minx = -180;
1208
1244
  if (grid.maxx > 180) grid.maxx = 180;
1209
1245
  if (grid.miny < -90) grid.miny = -90;
@@ -1225,6 +1261,8 @@ class AirspaceGridOccupancyQueryViewModel {
1225
1261
  }));
1226
1262
  }
1227
1263
  }
1264
+
1265
+ // 存在几何实例时创建 Primitive 添加到场景
1228
1266
  if (instances.length > 0) {
1229
1267
  const primitive = this._viewer.scene.primitives.add(new Cesium.Primitive({
1230
1268
  geometryInstances: instances,
@@ -1251,6 +1289,11 @@ class AirspaceGridOccupancyQueryViewModel {
1251
1289
  this._queryGrids.push(primitive);
1252
1290
  }
1253
1291
  }
1292
+
1293
+ /** @description 根据网格编码列表绘制网格轮廓线
1294
+ * @param {Array} codeList 网格编码数组(可能是数组或类 Map 结构)
1295
+ * @param {Cesium.Color} color 轮廓颜色
1296
+ */
1254
1297
  drawGridsOutlineFromCodeList(codeList, color) {
1255
1298
  const outlineColor = Cesium.ColorGeometryInstanceAttribute.fromColor(color);
1256
1299
  const instances = [];
@@ -1258,6 +1301,7 @@ class AirspaceGridOccupancyQueryViewModel {
1258
1301
  for (let i = 0; i < size; i++) {
1259
1302
  const code = codeList.get ? codeList.get(i) : codeList[i];
1260
1303
  const index = (code.length + 1) / 2;
1304
+ // 优先使用 3D 编码解码方法,兼容旧版二维解码
1261
1305
  const grid = Module.decodeGeoSotGBCode3DToBox ? Module.decodeGeoSotGBCode3DToBox(code) : Module.decodeGeoSotGBCodeToBox(code.substring(0, index), code.substring(index));
1262
1306
  if (grid) {
1263
1307
  if (grid.minx < -180) grid.minx = -180;
@@ -1284,6 +1328,8 @@ class AirspaceGridOccupancyQueryViewModel {
1284
1328
  }));
1285
1329
  }
1286
1330
  }
1331
+
1332
+ // 存在几何实例时创建轮廓 Primitive 添加到场景
1287
1333
  if (instances.length > 0) {
1288
1334
  const primitive = this._viewer.scene.primitives.add(new Cesium.Primitive({
1289
1335
  geometryInstances: instances,
@@ -1299,6 +1345,8 @@ class AirspaceGridOccupancyQueryViewModel {
1299
1345
  this._queryGrids.push(primitive);
1300
1346
  }
1301
1347
  }
1348
+
1349
+ // 显示全屏加载动画(无参数)
1302
1350
  _showLoading() {
1303
1351
  this._loading = _loading.default.service({
1304
1352
  lock: true,
@@ -1307,27 +1355,51 @@ class AirspaceGridOccupancyQueryViewModel {
1307
1355
  target: this._mapTarget ? document.getElementById(this._mapTarget) : null
1308
1356
  });
1309
1357
  }
1358
+
1359
+ // 关闭全屏加载动画(无参数)
1310
1360
  _hideLoading() {
1311
1361
  if (this._loading) {
1312
1362
  this._loading.close();
1313
1363
  this._loading = null;
1314
1364
  }
1315
1365
  }
1366
+
1367
+ /** @description 设置查询服务地址
1368
+ * @param {String} val 查询服务地址
1369
+ */
1316
1370
  setQueryUrl(val) {
1317
1371
  this._options.queryUrl = val;
1318
1372
  }
1373
+
1374
+ /** @description 设置计算层级
1375
+ * @param {Number} val 计算层级
1376
+ */
1319
1377
  setCalcLevel(val) {
1320
1378
  this._options.calcLevel = Number(val);
1321
1379
  }
1380
+
1381
+ /** @description 设置高度类型
1382
+ * @param {String} val 高度类型
1383
+ */
1322
1384
  setHeightType(val) {
1323
1385
  this._options.heightType = val;
1324
1386
  }
1387
+
1388
+ /** @description 设置起始高度
1389
+ * @param {Number} val 起始高度
1390
+ */
1325
1391
  setStartHeight(val) {
1326
1392
  this._options.startHeight = Number(val);
1327
1393
  }
1394
+
1395
+ /** @description 设置结束高度
1396
+ * @param {Number} val 结束高度
1397
+ */
1328
1398
  setEndHeight(val) {
1329
1399
  this._options.endHeight = Number(val);
1330
1400
  }
1401
+
1402
+ // 移除已添加的 HTML 标签与查询网格图元(无参数)
1331
1403
  removeData() {
1332
1404
  if (this._htmlTag) {
1333
1405
  this._htmlTag.destroy();
@@ -1340,12 +1412,16 @@ class AirspaceGridOccupancyQueryViewModel {
1340
1412
  this._queryGrids = [];
1341
1413
  }
1342
1414
  }
1415
+
1416
+ // 清除查询结果、关闭加载并停止绘制(无参数)
1343
1417
  clear() {
1344
1418
  this.removeData();
1345
1419
  this._hideLoading();
1346
1420
  this._drawManager?.stopDraw();
1347
1421
  this._drawManager?.clearDrawGroup("AirspaceGridOccupancyQueryDraw");
1348
1422
  }
1423
+
1424
+ // 销毁视图模型,释放所有资源(无参数)
1349
1425
  destroy() {
1350
1426
  this.clear();
1351
1427
  }
@@ -1412,6 +1488,8 @@ const _hoisted_1 = {
1412
1488
  const _hoisted_2 = {
1413
1489
  class: "kq3d-airspace-grid-occupancy-query-footer"
1414
1490
  };
1491
+ // 组件属性定义
1492
+
1415
1493
  const __default__ = {
1416
1494
  name: "Kq3dAirspaceGridOccupancyQuery"
1417
1495
  };
@@ -1459,6 +1537,7 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
1459
1537
  const {
1460
1538
  settingParams = {}
1461
1539
  } = props || {};
1540
+ // 表单参数响应式状态,保存用户输入的查询参数
1462
1541
  let formItem = (0, _vue.reactive)({
1463
1542
  collapseValue: settingParams.collapseValue === "" ? "" : settingParams.collapseValue ?? "setting",
1464
1543
  queryUrl: settingParams.queryUrl ?? "",
@@ -1467,34 +1546,47 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
1467
1546
  startHeight: settingParams.startHeight ?? 0,
1468
1547
  endHeight: settingParams.endHeight ?? 100
1469
1548
  });
1470
- let viewModel = null;
1471
- let boxRef = (0, _vue.ref)(null);
1472
- let headerTemp = (0, _vue.ref)();
1473
- let headerTempRef = (0, _vue.ref)();
1549
+ let viewModel = null; // 视图模型实例,承担核心业务逻辑
1550
+ let boxRef = (0, _vue.ref)(null); // 组件根容器引用
1551
+ let headerTemp = (0, _vue.ref)(); // 头部模板动态组件
1552
+ let headerTempRef = (0, _vue.ref)(); // 头部模板组件实例引用
1553
+
1554
+ // 组件挂载后初始化定位、监听与视图模型
1474
1555
  (0, _vue.onMounted)(() => {
1475
1556
  (0, _util.updatePosition)(boxRef.value, props);
1557
+ // 监听位置变化,实时更新组件位置
1476
1558
  (0, _vue.watch)(() => props.position, (newVal, oldVal) => {
1477
1559
  (0, _util.updatePosition)(boxRef.value, props);
1478
1560
  });
1479
1561
  watchCreateHeaderTemp();
1562
+ // 监听是否显示头部模板,变化时重建头部模板
1480
1563
  (0, _vue.watch)(() => props.showHeaderTemp, (newVal, oldVal) => {
1481
1564
  (0, _vue.nextTick)(() => {
1482
1565
  watchCreateHeaderTemp();
1483
1566
  });
1484
1567
  });
1568
+
1569
+ // 获取地图场景视图后实例化视图模型
1485
1570
  _gisUtils.utils.getWebMap(props.mapTarget, scenceView => {
1486
1571
  if (scenceView) {
1487
1572
  viewModel = new _AirspaceGridOccupancyQueryViewModel.default(scenceView, formItem);
1488
1573
  }
1489
1574
  });
1490
1575
  });
1576
+
1577
+ // 根据属性创建头部模板(无参数)
1491
1578
  const watchCreateHeaderTemp = () => {
1492
1579
  if (props.showHeaderTemp) {
1493
1580
  headerTemp.value = (0, _util.createHeaderTemp)(boxRef.value, (0, _vue.toRefs)(props), headerTempRef, "webgl.airspaceGridOccupancyQuery");
1494
1581
  }
1495
1582
  };
1583
+
1584
+ /** @description 参数变更处理,根据变更的字段同步到视图模型
1585
+ * @param {String} key 变更的参数字段名
1586
+ */
1496
1587
  function paramsChanged(key) {
1497
1588
  if (!viewModel) return;
1589
+ // 高度参数变更时校验起始高度不能大于结束高度
1498
1590
  if (key === "startHeight" || key === "endHeight") {
1499
1591
  const startH = Number(formItem.startHeight);
1500
1592
  const endH = Number(formItem.endHeight);
@@ -1506,6 +1598,7 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
1506
1598
  return;
1507
1599
  }
1508
1600
  }
1601
+ // 根据字段名调用对应 setter 同步参数到视图模型
1509
1602
  switch (key) {
1510
1603
  case "queryUrl":
1511
1604
  viewModel.setQueryUrl(formItem.queryUrl);
@@ -1526,9 +1619,12 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
1526
1619
  break;
1527
1620
  }
1528
1621
  }
1622
+
1623
+ // 执行空域网格占用查询(无参数)
1529
1624
  function query() {
1530
1625
  let startH = Number(formItem.startHeight);
1531
1626
  let endH = Number(formItem.endHeight);
1627
+ // 高度值必须为数字
1532
1628
  if (isNaN(startH) || isNaN(endH)) {
1533
1629
  (0, _message.default)({
1534
1630
  message: locale.value.webgl["airspaceGridOccupancyQueryHeightError"] || "高度值必须为数字",
@@ -1536,6 +1632,7 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
1536
1632
  });
1537
1633
  return;
1538
1634
  }
1635
+ // 起始高度不能大于结束高度
1539
1636
  if (startH > endH) {
1540
1637
  (0, _message.default)({
1541
1638
  message: locale.value.webgl["airspaceGridOccupancyQueryHeightError"] || "起始高度不能大于结束高度",
@@ -1545,9 +1642,13 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
1545
1642
  }
1546
1643
  viewModel && viewModel.start();
1547
1644
  }
1645
+
1646
+ // 清除查询结果(无参数)
1548
1647
  function clearResult() {
1549
1648
  viewModel && viewModel.clear();
1550
1649
  }
1650
+
1651
+ // 组件卸载前销毁视图模型释放资源
1551
1652
  (0, _vue.onBeforeUnmount)(() => {
1552
1653
  viewModel && viewModel.destroy();
1553
1654
  });
@@ -1758,11 +1859,11 @@ Object.defineProperty(exports, "__esModule", ({
1758
1859
  value: true
1759
1860
  }));
1760
1861
  exports.kq_npm_client_leaflet_vue = exports.kq_npm_client_common_vue = exports.kq_npm_client3d_webgl_vue = void 0;
1761
- let kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
1862
+ const kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
1762
1863
  __webpack_require__.g.kq_npm_client_common_vue = kq_npm_client_common_vue;
1763
- let kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
1864
+ const kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
1764
1865
  __webpack_require__.g.kq_npm_client_leaflet_vue = kq_npm_client_leaflet_vue;
1765
- let kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
1866
+ const kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
1766
1867
  __webpack_require__.g.kq_npm_client3d_webgl_vue = kq_npm_client3d_webgl_vue;
1767
1868
 
1768
1869
  /***/ })
@@ -919,6 +919,7 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
919
919
  const {
920
920
  settingParams = {}
921
921
  } = props || {};
922
+ // 表单参数响应式状态,保存用户输入的分析参数
922
923
  let formItem = (0, _vue.reactive)({
923
924
  collapseValue: settingParams.collapseValue === "" ? "" : settingParams.collapseValue ?? "setting",
924
925
  queryUrl: settingParams.queryUrl ?? "",
@@ -926,21 +927,27 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
926
927
  heightType: settingParams.heightType ?? "trueHeight",
927
928
  height: settingParams.height ?? 120
928
929
  });
929
- let viewModel = null;
930
- let boxRef = (0, _vue.ref)(null);
931
- let headerTemp = (0, _vue.ref)();
932
- let headerTempRef = (0, _vue.ref)();
930
+ let viewModel = null; // 视图模型实例,承担核心业务逻辑
931
+ let boxRef = (0, _vue.ref)(null); // 组件根容器引用
932
+ let headerTemp = (0, _vue.ref)(); // 头部模板动态组件
933
+ let headerTempRef = (0, _vue.ref)(); // 头部模板组件实例引用
934
+
935
+ // 组件挂载后初始化定位、监听与视图模型
933
936
  (0, _vue.onMounted)(() => {
934
937
  (0, _util.updatePosition)(boxRef.value, props);
938
+ // 监听位置变化,实时更新组件位置
935
939
  (0, _vue.watch)(() => props.position, (newVal, oldVal) => {
936
940
  (0, _util.updatePosition)(boxRef.value, props);
937
941
  });
938
942
  watchCreateHeaderTemp();
943
+ // 监听是否显示头部模板,变化时重建头部模板
939
944
  (0, _vue.watch)(() => props.showHeaderTemp, (newVal, oldVal) => {
940
945
  (0, _vue.nextTick)(() => {
941
946
  watchCreateHeaderTemp();
942
947
  });
943
948
  });
949
+
950
+ // 获取地图场景视图后实例化视图模型
944
951
  _gisUtils.utils.getWebMap(props.mapTarget, scenceView => {
945
952
  if (scenceView) {
946
953
  let options = {
@@ -953,13 +960,20 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
953
960
  }
954
961
  });
955
962
  });
963
+
964
+ // 根据属性创建头部模板(无参数)
956
965
  const watchCreateHeaderTemp = () => {
957
966
  if (props.showHeaderTemp) {
958
967
  headerTemp.value = (0, _util.createHeaderTemp)(boxRef.value, (0, _vue.toRefs)(props), headerTempRef, "webgl.airspaceProfileAnalysis");
959
968
  }
960
969
  };
970
+
971
+ /** @description 参数变更处理,根据变更的字段同步到视图模型
972
+ * @param {String} key 变更的参数字段名
973
+ */
961
974
  function paramsChanged(key) {
962
975
  if (!viewModel) return;
976
+ // 根据字段名调用对应 setter 同步参数到视图模型
963
977
  switch (key) {
964
978
  case "queryUrl":
965
979
  viewModel.setQueryUrl(formItem.queryUrl);
@@ -977,8 +991,11 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
977
991
  break;
978
992
  }
979
993
  }
994
+
995
+ // 执行空域剖面分析(无参数)
980
996
  function query() {
981
997
  let heightVal = Number(formItem.height);
998
+ // 校验高度值必须为有效正数
982
999
  if (isNaN(heightVal) || heightVal <= 0) {
983
1000
  (0, _message.default)({
984
1001
  message: "请输入有效的高度值",
@@ -988,9 +1005,13 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
988
1005
  }
989
1006
  viewModel && viewModel.start();
990
1007
  }
1008
+
1009
+ // 清除分析结果(无参数)
991
1010
  function clearResult() {
992
1011
  viewModel && viewModel.clear();
993
1012
  }
1013
+
1014
+ // 组件卸载前销毁视图模型释放资源
994
1015
  (0, _vue.onBeforeUnmount)(() => {
995
1016
  viewModel && viewModel.destroy();
996
1017
  });
@@ -1373,20 +1394,34 @@ var _message = _interopRequireDefault(__webpack_require__(71323));
1373
1394
  var _loading = _interopRequireDefault(__webpack_require__(90724));
1374
1395
  var _useGlobalConfig = __webpack_require__(22686);
1375
1396
  class AirspaceProfileAnalysisViewModel {
1397
+ // 全屏加载实例
1398
+
1399
+ /** @description 构造函数,初始化视图模型
1400
+ * @param {Object} scenceView 场景视图对象,包含 _viewer、_drawManager 等
1401
+ * @param {Object} options 用户传入的分析参数
1402
+ */
1376
1403
  constructor(scenceView, options) {
1377
1404
  this._viewer = null;
1405
+ // Cesium 场景视图实例
1378
1406
  this._mapTarget = null;
1407
+ // 地图容器 DOM id
1379
1408
  this._options = {};
1409
+ // 当前生效的分析参数
1380
1410
  this._defaultOptions = {
1411
+ // 默认分析参数
1381
1412
  queryUrl: "",
1382
1413
  calcLevel: 23,
1383
1414
  heightType: "trueHeight",
1384
1415
  height: 120
1385
1416
  };
1386
1417
  this._drawManager = null;
1418
+ // 绘制管理器,负责矩形绘制交互
1387
1419
  this._language = null;
1420
+ // 多语言资源对象
1388
1421
  this._htmlTag = null;
1422
+ // HTML 标签对象(保留字段)
1389
1423
  this._queryGrids = [];
1424
+ // 已添加到场景中的网格图元集合
1390
1425
  this._loading = null;
1391
1426
  const {
1392
1427
  locale
@@ -1400,9 +1435,12 @@ class AirspaceProfileAnalysisViewModel {
1400
1435
  this._viewer.postProcessStages.fxaa.enabled = true;
1401
1436
  this._viewer.scene.logarithmicDepthBuffer = true;
1402
1437
  }
1438
+
1439
+ // 启动分析:校验参数后启动矩形绘制交互(无参数)
1403
1440
  start() {
1404
1441
  const that = this;
1405
1442
  const queryUrl = this._options.queryUrl || "";
1443
+ // 校验查询服务地址是否配置
1406
1444
  if (!queryUrl.trim()) {
1407
1445
  (0, _message.default)({
1408
1446
  message: that._language.value.webgl["gridOccupancyQueryUrlEmpty"] || "请配置查询服务地址",
@@ -1412,6 +1450,7 @@ class AirspaceProfileAnalysisViewModel {
1412
1450
  }
1413
1451
  this.removeData();
1414
1452
  if (!this._drawManager) return;
1453
+ // 启动矩形绘制,绘制完成后回调中执行分析
1415
1454
  this._drawManager.startDraw("rectangle", {
1416
1455
  fill: true,
1417
1456
  clampToGround: false
@@ -1423,12 +1462,18 @@ class AirspaceProfileAnalysisViewModel {
1423
1462
  that._drawManager.clearDrawGroup("AirspaceProfileAnalysisDraw");
1424
1463
  }, "AirspaceProfileAnalysisDraw");
1425
1464
  }
1465
+
1466
+ /** @description 根据绘制的矩形区域执行空域剖面分析并绘制结果
1467
+ * @param {Object} shape 绘制得到的矩形几何对象
1468
+ */
1426
1469
  showAirspaceProfileAnalysis(shape) {
1427
1470
  this.removeData();
1428
1471
  const that = this;
1429
1472
  const queryUrl = this._options.queryUrl || "";
1430
1473
  const level = this._options.calcLevel || 23;
1431
1474
  const height = Number(this._options.height) || 120;
1475
+
1476
+ // 将矩形弧度边界转为角度经纬度
1432
1477
  const minLon = shape.rectangle.west / Math.PI * 180;
1433
1478
  const maxLon = shape.rectangle.east / Math.PI * 180;
1434
1479
  const minLat = shape.rectangle.south / Math.PI * 180;
@@ -1438,6 +1483,8 @@ class AirspaceProfileAnalysisViewModel {
1438
1483
  // 客户端计算矩形范围内的三维网格编码列表
1439
1484
  const codeList = Module.calcGeoSotGBCode3DListOfRectZ(minLon, minLat, height, maxLon, maxLat, height, level - 1);
1440
1485
  this.drawGridsOutlineFromCodeList(codeList, Cesium.Color.GREEN.withAlpha(0.3));
1486
+
1487
+ // 构造查询请求体
1441
1488
  const body = {
1442
1489
  geom: {
1443
1490
  type: "FeatureCollection",
@@ -1454,6 +1501,8 @@ class AirspaceProfileAnalysisViewModel {
1454
1501
  level: Number(level)
1455
1502
  };
1456
1503
  this._showLoading();
1504
+
1505
+ // 请求服务端获取剖面网格并绘制
1457
1506
  fetch(queryUrl + "/airspaceOccupyRegion", {
1458
1507
  method: "POST",
1459
1508
  headers: {
@@ -1469,6 +1518,7 @@ class AirspaceProfileAnalysisViewModel {
1469
1518
  if (data.content) {
1470
1519
  const results = data.content;
1471
1520
  let hasResult = false;
1521
+ // 按类型绘制剖面网格
1472
1522
  for (const key in results) {
1473
1523
  const typeCodes = results[key];
1474
1524
  if (typeCodes && typeCodes.length > 0) {
@@ -1487,6 +1537,11 @@ class AirspaceProfileAnalysisViewModel {
1487
1537
  });
1488
1538
  });
1489
1539
  }
1540
+
1541
+ /** @description 根据网格编码列表绘制实心网格图元
1542
+ * @param {Array} codeList 网格编码数组
1543
+ * @param {Cesium.Color} color 网格填充颜色
1544
+ */
1490
1545
  drawGridsFromCodeList(codeList, color) {
1491
1546
  let instances = [];
1492
1547
  for (let i = 0; i < codeList.length; i++) {
@@ -1494,6 +1549,7 @@ class AirspaceProfileAnalysisViewModel {
1494
1549
  const index = (code.length + 1) / 2;
1495
1550
  const grid = Module.decodeGeoSotGBCodeToBox(code.substring(0, index), code.substring(index));
1496
1551
  if (grid) {
1552
+ // 限制经纬度边界到合法范围
1497
1553
  if (grid.minx < -180) grid.minx = -180;
1498
1554
  if (grid.maxx > 180) grid.maxx = 180;
1499
1555
  if (grid.miny < -90) grid.miny = -90;
@@ -1515,6 +1571,8 @@ class AirspaceProfileAnalysisViewModel {
1515
1571
  }));
1516
1572
  }
1517
1573
  }
1574
+
1575
+ // 存在几何实例时创建 Primitive 添加到场景
1518
1576
  if (instances.length > 0) {
1519
1577
  const primitive = this._viewer.scene.primitives.add(new Cesium.Primitive({
1520
1578
  geometryInstances: instances,
@@ -1541,6 +1599,11 @@ class AirspaceProfileAnalysisViewModel {
1541
1599
  this._queryGrids.push(primitive);
1542
1600
  }
1543
1601
  }
1602
+
1603
+ /** @description 根据网格编码列表绘制网格轮廓线
1604
+ * @param {Array} codeList 网格编码数组(可能是数组或类 Map 结构)
1605
+ * @param {Cesium.Color} color 轮廓颜色
1606
+ */
1544
1607
  drawGridsOutlineFromCodeList(codeList, color) {
1545
1608
  const outlineColor = Cesium.ColorGeometryInstanceAttribute.fromColor(color);
1546
1609
  const instances = [];
@@ -1548,6 +1611,7 @@ class AirspaceProfileAnalysisViewModel {
1548
1611
  for (let i = 0; i < size; i++) {
1549
1612
  const code = codeList.get ? codeList.get(i) : codeList[i];
1550
1613
  const index = (code.length + 1) / 2;
1614
+ // 优先使用 3D 编码解码方法,兼容旧版二维解码
1551
1615
  const grid = Module.decodeGeoSotGBCode3DToBox ? Module.decodeGeoSotGBCode3DToBox(code) : Module.decodeGeoSotGBCodeToBox(code.substring(0, index), code.substring(index));
1552
1616
  if (grid) {
1553
1617
  if (grid.minx < -180) grid.minx = -180;
@@ -1574,6 +1638,8 @@ class AirspaceProfileAnalysisViewModel {
1574
1638
  }));
1575
1639
  }
1576
1640
  }
1641
+
1642
+ // 存在几何实例时创建轮廓 Primitive 添加到场景
1577
1643
  if (instances.length > 0) {
1578
1644
  const primitive = this._viewer.scene.primitives.add(new Cesium.Primitive({
1579
1645
  geometryInstances: instances,
@@ -1589,6 +1655,8 @@ class AirspaceProfileAnalysisViewModel {
1589
1655
  this._queryGrids.push(primitive);
1590
1656
  }
1591
1657
  }
1658
+
1659
+ // 显示全屏加载动画(无参数)
1592
1660
  _showLoading() {
1593
1661
  this._loading = _loading.default.service({
1594
1662
  lock: true,
@@ -1597,24 +1665,44 @@ class AirspaceProfileAnalysisViewModel {
1597
1665
  target: this._mapTarget ? document.getElementById(this._mapTarget) : null
1598
1666
  });
1599
1667
  }
1668
+
1669
+ // 关闭全屏加载动画(无参数)
1600
1670
  _hideLoading() {
1601
1671
  if (this._loading) {
1602
1672
  this._loading.close();
1603
1673
  this._loading = null;
1604
1674
  }
1605
1675
  }
1676
+
1677
+ /** @description 设置查询服务地址
1678
+ * @param {String} val 查询服务地址
1679
+ */
1606
1680
  setQueryUrl(val) {
1607
1681
  this._options.queryUrl = val;
1608
1682
  }
1683
+
1684
+ /** @description 设置计算层级
1685
+ * @param {Number} val 计算层级
1686
+ */
1609
1687
  setCalcLevel(val) {
1610
1688
  this._options.calcLevel = Number(val);
1611
1689
  }
1690
+
1691
+ /** @description 设置高度类型
1692
+ * @param {String} val 高度类型
1693
+ */
1612
1694
  setHeightType(val) {
1613
1695
  this._options.heightType = val;
1614
1696
  }
1697
+
1698
+ /** @description 设置分析高度
1699
+ * @param {Number} val 分析高度
1700
+ */
1615
1701
  setHeight(val) {
1616
1702
  this._options.height = Number(val);
1617
1703
  }
1704
+
1705
+ // 移除已添加的查询网格图元(无参数)
1618
1706
  removeData() {
1619
1707
  if (this._queryGrids && this._queryGrids.length > 0) {
1620
1708
  for (let i = 0; i < this._queryGrids.length; i++) {
@@ -1623,12 +1711,16 @@ class AirspaceProfileAnalysisViewModel {
1623
1711
  this._queryGrids = [];
1624
1712
  }
1625
1713
  }
1714
+
1715
+ // 清除分析结果、关闭加载并停止绘制(无参数)
1626
1716
  clear() {
1627
1717
  this.removeData();
1628
1718
  this._hideLoading();
1629
1719
  this._drawManager?.stopDraw();
1630
1720
  this._drawManager?.clearDrawGroup("AirspaceProfileAnalysisDraw");
1631
1721
  }
1722
+
1723
+ // 销毁视图模型,释放所有资源(无参数)
1632
1724
  destroy() {
1633
1725
  this.clear();
1634
1726
  }
@@ -1673,11 +1765,11 @@ Object.defineProperty(exports, "__esModule", ({
1673
1765
  value: true
1674
1766
  }));
1675
1767
  exports.kq_npm_client_leaflet_vue = exports.kq_npm_client_common_vue = exports.kq_npm_client3d_webgl_vue = void 0;
1676
- let kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
1768
+ const kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
1677
1769
  __webpack_require__.g.kq_npm_client_common_vue = kq_npm_client_common_vue;
1678
- let kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
1770
+ const kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
1679
1771
  __webpack_require__.g.kq_npm_client_leaflet_vue = kq_npm_client_leaflet_vue;
1680
- let kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
1772
+ const kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
1681
1773
  __webpack_require__.g.kq_npm_client3d_webgl_vue = kq_npm_client3d_webgl_vue;
1682
1774
 
1683
1775
  /***/ })