@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
@@ -145,6 +145,7 @@ const __default__ = {
145
145
  };
146
146
  var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
147
147
  props: {
148
+ // 指定组件绑定的viewer对象的div的id
148
149
  mapTarget: {
149
150
  type: String
150
151
  },
@@ -170,6 +171,7 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
170
171
  return ['id', 'oid'];
171
172
  }
172
173
  },
174
+ // 是否通过模型属性拾取高亮
173
175
  isModelSelectByFiled: {
174
176
  type: Boolean,
175
177
  default: true
@@ -271,12 +273,20 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
271
273
  headerTemp.value = (0, _util.createHeaderTemp)(boxRef.value, (0, _vue.toRefs)(props), headerTempRef, "webgl.modelPick");
272
274
  }
273
275
  };
276
+
277
+ // 拾取
274
278
  function pick() {
275
279
  viewModel && viewModel.pick();
276
280
  }
281
+ /**
282
+ * @description 拾取回调:根据图层名和属性构造表格数据,支持外部字段别名映射
283
+ * @param {String} layerName 图层名称
284
+ * @param {Object} properties 模型属性对象
285
+ */
277
286
  function pickCallFunc(layerName, properties) {
278
287
  layerNameTitle.value = layerName;
279
288
  let propertiesData = [];
289
+ // 存在外部字段别名映射时,按映射后的字段名构造表格数据
280
290
  if (props.aliasNameReflection) {
281
291
  properties.layerName = layerName;
282
292
  props.aliasNameReflection(properties, item => {
@@ -290,6 +300,7 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
290
300
  tableData.value = propertiesData;
291
301
  });
292
302
  } else {
303
+ // 无映射时直接以原属性键构造表格数据
293
304
  for (let key in properties) {
294
305
  propertiesData.push({
295
306
  field: key,
@@ -698,6 +709,11 @@ var _useGlobalConfig = __webpack_require__(22686);
698
709
  //模型拾取逻辑类
699
710
 
700
711
  class ModelSelectViewModel {
712
+ /**
713
+ * @description 构造函数,初始化viewer、绘制管理器及拾取回调
714
+ * @param {Object} scenceView 三维场景视图对象
715
+ * @param {Function} pickCallFunc 拾取结果回调函数
716
+ */
701
717
  constructor(scenceView, pickCallFunc) {
702
718
  this._viewer = null;
703
719
  //三维viewer对象
@@ -717,8 +733,11 @@ class ModelSelectViewModel {
717
733
  // 模型属性匹配字段
718
734
  this._language = {};
719
735
  this.selectedKey = null;
736
+ //当前选中要素的键值
720
737
  this.oldColor = null;
738
+ //拾取前要素原始颜色
721
739
  this.selectedFeature = null;
740
+ //当前选中的要素对象
722
741
  this._drawManager = null;
723
742
  this._pickCallFunc = null;
724
743
  this._isModelSelectByFiled = null;
@@ -749,6 +768,7 @@ class ModelSelectViewModel {
749
768
  }, (feature, {
750
769
  shape
751
770
  }) => {
771
+ // 过滤非本组件绘制的图形
752
772
  if (!shape.groupName || shape.groupName !== "ModelSelectDraw") return;
753
773
  that._drawManager.clearDrawGroup("ModelSelectDraw");
754
774
  const screenPosition = that._viewer.scene.cartesianToCanvasCoordinates(shape._position);
@@ -761,6 +781,7 @@ class ModelSelectViewModel {
761
781
  // 兼容Cesium186和1102
762
782
  let properties = pickedObject.getPropertyNames !== undefined ? pickedObject.getPropertyNames() : (pickedObject.getPropertyIds !== undefined ? pickedObject.getPropertyIds() : null) || [];
763
783
  // console.log(properties);
784
+ // 按字段拾取高亮:根据字段值匹配并高亮所有同名同值要素
764
785
  if (that._isModelSelectByFiled) {
765
786
  if (that._modeFiledArray && that._modeFiledArray.length && that._modeFiledArray.length > 0) {
766
787
  that._modeFiledArray.forEach(val => {
@@ -784,6 +805,7 @@ class ModelSelectViewModel {
784
805
  });
785
806
  }
786
807
  } else {
808
+ // 直接高亮:恢复上次选中要素颜色后高亮当前要素
787
809
  if (that.selectedFeature) {
788
810
  that.selectedFeature.color = that.oldColor;
789
811
  that.selectedFeature = null;
@@ -795,18 +817,21 @@ class ModelSelectViewModel {
795
817
  that.selectedFeature.applyColor = true;
796
818
  that.selectedFeature.colorBlendMode = Cesium.ColorBlendMode.REPLACE;
797
819
  }
820
+ // 收集所有属性并通过回调返回
798
821
  let attrs = {};
799
822
  properties.forEach(prop => {
800
823
  attrs[prop] = pickedObject.getProperty(prop);
801
824
  });
802
825
  that._pickCallFunc && that._pickCallFunc(pickedObject.tileset.name || "LayerName", attrs);
803
826
  } else {
827
+ // 拾取到的对象不是3DTileFeature
804
828
  (0, _message.default)({
805
829
  message: that._language.value.webgl["noCesium3DTileFeature"],
806
830
  type: "info"
807
831
  });
808
832
  }
809
833
  } else {
834
+ // 未拾取到任何对象
810
835
  (0, _message.default)({
811
836
  message: that._language.value.webgl["noSelect3DTileFeature"],
812
837
  type: "info"
@@ -816,12 +841,17 @@ class ModelSelectViewModel {
816
841
  }
817
842
  }, "ModelSelectDraw", true);
818
843
  } else {
844
+ // 未添加模型时给出警告
819
845
  (0, _message.default)({
820
846
  message: this._language.value.webgl["addModelAnalysisTips"],
821
847
  type: "warning"
822
848
  });
823
849
  }
824
850
  }
851
+ /**
852
+ * @description 将高亮颜色字符串解析为Cesium.Color对象,支持rgba/rgb/十六进制格式
853
+ * @returns {Object} Cesium.Color对象
854
+ */
825
855
  parseColorToCesium() {
826
856
  if (!this._highlightColor || typeof this._highlightColor !== "string") {
827
857
  return Cesium.Color.RED.withAlpha(this._highlightColorAlpha); // 返回默认颜色
@@ -862,6 +892,7 @@ class ModelSelectViewModel {
862
892
  this._highlight && this._highlight.remove();
863
893
  this._highlight = null;
864
894
  this._isPick = false;
895
+ // 恢复选中要素的原始颜色
865
896
  if (this.selectedFeature) {
866
897
  this.selectedFeature.color = this.oldColor;
867
898
  this.selectedFeature = null;
@@ -1122,11 +1153,11 @@ Object.defineProperty(exports, "__esModule", ({
1122
1153
  value: true
1123
1154
  }));
1124
1155
  exports.kq_npm_client_leaflet_vue = exports.kq_npm_client_common_vue = exports.kq_npm_client3d_webgl_vue = void 0;
1125
- let kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
1156
+ const kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
1126
1157
  __webpack_require__.g.kq_npm_client_common_vue = kq_npm_client_common_vue;
1127
- let kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
1158
+ const kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
1128
1159
  __webpack_require__.g.kq_npm_client_leaflet_vue = kq_npm_client_leaflet_vue;
1129
- let kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
1160
+ const kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
1130
1161
  __webpack_require__.g.kq_npm_client3d_webgl_vue = kq_npm_client3d_webgl_vue;
1131
1162
 
1132
1163
  /***/ })
@@ -58,6 +58,7 @@ const __default__ = {
58
58
  };
59
59
  var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
60
60
  props: {
61
+ // 指定组件绑定的viewer对象的div的id
61
62
  mapTarget: {
62
63
  type: String
63
64
  },
@@ -111,6 +112,8 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
111
112
 
112
113
  // 获取组件传参
113
114
  const props = __props;
115
+
116
+ // 表单数据对象
114
117
  let formItem = (0, _vue.reactive)({
115
118
  showOutline: props?.settingParams?.showOutline ?? false,
116
119
  outlineColor: props?.settingParams?.outlineColor ?? "#FFFFFF",
@@ -152,6 +155,10 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
152
155
  headerTemp.value = (0, _util.createHeaderTemp)(boxRef.value, (0, _vue.toRefs)(props), headerTempRef, "webgl.modelStyleEdit");
153
156
  }
154
157
  };
158
+ /**
159
+ * @description 参数变化处理:同步表单参数到逻辑类并触发参数应用
160
+ * @param {String} key 变化的参数名:showOutline/outlineColor/outlineWidth
161
+ */
155
162
  function paramsChanged(key) {
156
163
  if (!viewModel) return;
157
164
  Object.assign(viewModel._option, formItem);
@@ -161,6 +168,10 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
161
168
  function clear() {
162
169
  viewModel && viewModel.clear();
163
170
  }
171
+ /**
172
+ * @description 设置可编辑样式模型集合
173
+ * @param {Array} guids 模型guid数组
174
+ */
164
175
  function setEditModels(guids) {
165
176
  viewModel && viewModel.setEditModels(guids);
166
177
  }
@@ -375,10 +386,20 @@ var _useGlobalConfig = __webpack_require__(22686);
375
386
  */
376
387
 
377
388
  class ModelStyleEditViewModel {
389
+ //语言对象
390
+
391
+ /**
392
+ * @description 构造函数,初始化viewer、深度检测及样式参数
393
+ * @param {Object} scenceView 三维场景视图对象
394
+ * @param {Object} formItem 表单参数对象
395
+ */
378
396
  constructor(scenceView, formItem) {
379
397
  this._viewer = null;
398
+ //三维viewer对象
380
399
  this._option = null;
400
+ //样式参数对象
381
401
  this._modelEdits = [];
402
+ //可编辑样式模型集合
382
403
  this._language = null;
383
404
  this._viewer = scenceView._viewer;
384
405
  this._viewer.scene.globe.depthTestAgainstTerrain = true;
@@ -388,6 +409,11 @@ class ModelStyleEditViewModel {
388
409
  } = (0, _useGlobalConfig.useLocale)();
389
410
  this._language = locale;
390
411
  }
412
+
413
+ /**
414
+ * @description 根据guid集合筛选出可编辑样式的模型
415
+ * @param {Array} guids 模型guid数组
416
+ */
391
417
  setEditModels(guids) {
392
418
  if (!Array.isArray(guids) || guids.length === 0) {
393
419
  this._modelEdits = [];
@@ -398,6 +424,11 @@ class ModelStyleEditViewModel {
398
424
  return element && element._key && guids.includes(element._key);
399
425
  });
400
426
  }
427
+
428
+ /**
429
+ * @description 参数变化处理:将当前样式参数应用到所有可编辑模型
430
+ * @param {String} key 变化的参数名
431
+ */
401
432
  paramsChanged(key) {
402
433
  if (this._modelEdits.length === 0) {
403
434
  this._showNoDataMessage();
@@ -406,12 +437,14 @@ class ModelStyleEditViewModel {
406
437
  const optionKeys = Object.keys(this._option);
407
438
  if (optionKeys.length === 0) return;
408
439
  let that = this;
440
+ // 遍历所有可编辑模型,应用全部样式参数
409
441
  this._modelEdits.forEach(model => {
410
442
  optionKeys.forEach(k => {
411
443
  model[k] = that._option[k];
412
444
  });
413
445
  });
414
446
  }
447
+ // 显示无可编辑模型数据提示
415
448
  _showNoDataMessage() {
416
449
  const message = this._language?.value?.webgl?.noEditModelData || "暂无可编辑的模型数据";
417
450
  (0, _message.default)({
@@ -419,9 +452,12 @@ class ModelStyleEditViewModel {
419
452
  type: "info"
420
453
  });
421
454
  }
455
+
456
+ // 清除可编辑模型集合
422
457
  clear() {
423
458
  this._modelEdits = [];
424
459
  }
460
+ // 销毁
425
461
  destroy() {
426
462
  this.clear();
427
463
  this._option = null;
@@ -466,11 +502,11 @@ Object.defineProperty(exports, "__esModule", ({
466
502
  value: true
467
503
  }));
468
504
  exports.kq_npm_client_leaflet_vue = exports.kq_npm_client_common_vue = exports.kq_npm_client3d_webgl_vue = void 0;
469
- let kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
505
+ const kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
470
506
  __webpack_require__.g.kq_npm_client_common_vue = kq_npm_client_common_vue;
471
- let kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
507
+ const kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
472
508
  __webpack_require__.g.kq_npm_client_leaflet_vue = kq_npm_client_leaflet_vue;
473
- let kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
509
+ const kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
474
510
  __webpack_require__.g.kq_npm_client3d_webgl_vue = kq_npm_client3d_webgl_vue;
475
511
 
476
512
  /***/ })
@@ -82,9 +82,9 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
82
82
  lang,
83
83
  locale
84
84
  } = (0, _useGlobalConfig.useLocale)();
85
- let viewModel = null;
86
- let ref_box = (0, _vue.ref)();
87
- let tiles = (0, _vue.ref)([]);
85
+ let viewModel = null; // 模型变换视图模型实例
86
+ let ref_box = (0, _vue.ref)(); // 模型变换容器Ref
87
+ let tiles = (0, _vue.ref)([]); // 所有3dtiles模型对象列表
88
88
  // 获取组件传参
89
89
  const props = __props;
90
90
  // 组件容器Ref
@@ -114,10 +114,11 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
114
114
  minScale: props?.settingParams?.minScale ?? 0.1,
115
115
  maxScale: props?.settingParams?.maxScale ?? 10
116
116
  });
117
- let defTilset = {};
117
+ let defTilset = {}; // 缓存各tileset对应的表单参数
118
118
  // 生成组件默认header
119
119
  let headerTemp = (0, _vue.ref)();
120
- let headerTempRef = (0, _vue.ref)();
120
+ let headerTempRef = (0, _vue.ref)(); // headerTemp组件Ref
121
+ // 坐标转换工具集
121
122
  const CoordTransform = {
122
123
  // 笛卡尔3 → 经纬度(角度)
123
124
  cartesianToLngLatHeight: cartesian => {
@@ -154,15 +155,22 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
154
155
  }
155
156
  });
156
157
  });
158
+ /**
159
+ * @description 视图模型回调参数处理
160
+ * @param {String} key 回调类型(setData/center)
161
+ * @param {*} val 回调数据
162
+ */
157
163
  function callbackParams(key, val) {
158
164
  if (!viewModel) return;
159
165
  switch (key) {
160
166
  case "setData":
167
+ // 图层数据变化,重新加载列表
161
168
  tiles.value = viewModel.findLayers(); // 获取所有tileset对象
162
169
  formItem.tileset = "";
163
170
  paramsChanged("tileset");
164
171
  break;
165
172
  case "center":
173
+ // 模型中心点变化,更新原始坐标显示
166
174
  formItem.origin = cartesianToGeographic(val);
167
175
  break;
168
176
  default:
@@ -179,13 +187,20 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
179
187
  headerTemp.value = (0, _util.createHeaderTemp)(boxRef.value, (0, _vue.toRefs)(props), headerTempRef, "webgl.modelTransformTitle");
180
188
  }
181
189
  };
190
+
191
+ /**
192
+ * @description 表单参数变化处理
193
+ * @param {String} value 变化的字段名(tileset/x/y/z/heading/pitch/roll/scale)
194
+ */
182
195
  function paramsChanged(value) {
183
196
  if (!viewModel) return;
184
197
  if (value == "tileset") {
198
+ // 切换图层:清空表单并应用该图层缓存参数
185
199
  clear();
186
200
  if (defTilset[formItem.tileset]) Object.assign(formItem, defTilset[formItem.tileset]);
187
201
  viewModel.setLayer(formItem.tileset);
188
202
  } else {
203
+ // 平移/旋转/缩放:缓存当前图层参数并更新模型
189
204
  if (formItem.tileset) {
190
205
  defTilset[formItem.tileset] = JSON.parse(JSON.stringify(formItem));
191
206
  }
@@ -193,19 +208,26 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
193
208
  viewModel.updateModel(value);
194
209
  }
195
210
  }
211
+ /**
212
+ * @description 设置当前操作的图层并加载该图层缓存数据
213
+ * @param {String} guid 图层guid
214
+ */
196
215
  function setLayerData(guid) {
197
216
  clear();
198
217
  formItem.tileset = guid;
199
218
  if (defTilset[formItem.tileset]) Object.assign(formItem, defTilset[formItem.tileset]);
200
219
  viewModel && viewModel.setLayerData(guid);
201
220
  }
221
+ // 目标位置变化时更新模型中心点
202
222
  function targetChange() {
203
223
  if (formItem.target.x && formItem.target.y && formItem.target.z) {
224
+ // 有目标坐标时:以目标坐标作为变换中心
204
225
  if (viewModel) {
205
226
  viewModel._targetCenter = Cesium.Cartesian3.fromDegrees(formItem.target.x, formItem.target.y, formItem.target.z);
206
227
  viewModel.updateModel("x");
207
228
  }
208
229
  } else {
230
+ // 无目标坐标时:清空变换中心
209
231
  if (viewModel) {
210
232
  viewModel._targetCenter = null;
211
233
  viewModel.updateModel("x");
@@ -232,13 +254,19 @@ var _default = exports.A = /*@__PURE__*/Object.assign(__default__, {
232
254
  z: height
233
255
  };
234
256
  }
257
+ /**
258
+ * @description 设置当前操作的模型对象
259
+ * @param {Object} model 模型对象(Cesium3DTileset或Entity)
260
+ */
235
261
  function setModel(model) {
236
262
  clear();
237
263
  if (viewModel && model) {
238
264
  viewModel._selectModel = model;
239
265
  if (model instanceof Cesium.Cesium3DTileset) {
266
+ // 3DTileset类型:使用包围球中心作为变换中心
240
267
  viewModel._center = model.boundingSphere.center;
241
268
  } else {
269
+ // Entity类型:使用其位置属性值作为变换中心
242
270
  viewModel._center = model.position._value;
243
271
  }
244
272
  callbackParams("center", viewModel._center);
@@ -753,13 +781,24 @@ var _message = _interopRequireDefault(__webpack_require__(71323));
753
781
  //模型平整逻辑类
754
782
 
755
783
  class ModeltransformViewModel {
784
+ // 目标中心点(笛卡尔坐标)
785
+ /**
786
+ * @description 构造函数:初始化视图模型
787
+ * @param {Object} scenceView 场景视图对象
788
+ * @param {Object} formItem 表单参数对象
789
+ * @param {Function} callbackParams 视图模型回调函数
790
+ */
756
791
  constructor(scenceView, formItem, callbackParams) {
757
792
  this._viewer = null;
758
793
  //三维viewer对象
759
794
  this._option = {};
795
+ // 表单参数对象
760
796
  this.callbackParams = null;
797
+ // 视图模型回调函数
761
798
  this._selectModel = null;
799
+ // 当前选中的模型对象
762
800
  this._center = {};
801
+ // 模型中心点(笛卡尔坐标)
763
802
  this._targetCenter = null;
764
803
  this._viewer = scenceView._viewer;
765
804
  this._viewer.scene.globe.depthTestAgainstTerrain = true;
@@ -770,6 +809,10 @@ class ModeltransformViewModel {
770
809
  // 添加图层数据源变化监听
771
810
  _gisUtils.mapViewUtils.bindViewEvents("resetLayerDatas", this._resetListData, scenceView._viewerId);
772
811
  }
812
+ /**
813
+ * @description 图层数据源变化时重置列表数据
814
+ * @param {Object} e 事件对象
815
+ */
773
816
  _resetListData(e) {
774
817
  // 如果图层变化事件是自己触发的 则不继续执行 避免死循环
775
818
  if (e.eventTarget && e.eventTarget === this) {
@@ -779,10 +822,11 @@ class ModeltransformViewModel {
779
822
  }
780
823
  // 查找所有3dtiles模型对象
781
824
  findLayers() {
782
- let tilesets = [];
825
+ const tilesets = [];
783
826
  const primitives = this._viewer.scene.primitives._primitives;
784
827
  for (let m = 0; m < primitives.length; m++) {
785
828
  if (primitives[m] instanceof Cesium.Cesium3DTileset) {
829
+ // 跳过隐藏的模型
786
830
  if (!primitives[m].show) continue;
787
831
  tilesets.push({
788
832
  guid: primitives[m].guid,
@@ -792,7 +836,10 @@ class ModeltransformViewModel {
792
836
  }
793
837
  return tilesets;
794
838
  }
795
- // 查询并设置模型变换对象
839
+ /**
840
+ * @description 查询并设置模型变换对象
841
+ * @param {String} guid 图层guid
842
+ */
796
843
  setLayerData(guid) {
797
844
  const primitives = this._viewer.scene.primitives._primitives;
798
845
  for (let m = 0; m < primitives.length; m++) {
@@ -800,8 +847,10 @@ class ModeltransformViewModel {
800
847
  if (primitives[m].guid === guid) {
801
848
  this._selectModel = primitives[m];
802
849
  if (primitives[m] instanceof Cesium.Cesium3DTileset) {
850
+ // 3DTileset类型:使用包围球中心作为变换中心
803
851
  this._center = this._selectModel.boundingSphere.center;
804
852
  } else {
853
+ // Entity类型:使用其位置属性值作为变换中心
805
854
  this._center = this._selectModel.position._value;
806
855
  }
807
856
  break;
@@ -809,7 +858,10 @@ class ModeltransformViewModel {
809
858
  }
810
859
  if (this._center) this.callbackParams("center", this._center);
811
860
  }
812
- // 设置过滤对象
861
+ /**
862
+ * @description 设置过滤对象
863
+ * @param {String} layerId 图层guid
864
+ */
813
865
  setLayer(layerId) {
814
866
  if (layerId) {
815
867
  this.clear();
@@ -820,7 +872,11 @@ class ModeltransformViewModel {
820
872
  }
821
873
  }
822
874
 
823
- //根据id获取tileset对象
875
+ /**
876
+ * @description 根据id获取tileset对象
877
+ * @param {String} id 图层guid
878
+ * @returns {Object} tileset对象
879
+ */
824
880
  findLayerById(id) {
825
881
  const primitives = this._viewer.scene.primitives._primitives;
826
882
  const tileset = primitives.find(function (item) {
@@ -828,30 +884,39 @@ class ModeltransformViewModel {
828
884
  });
829
885
  return tileset;
830
886
  }
887
+ /**
888
+ * @description 根据变化字段更新模型变换
889
+ * @param {String} key 变化的字段名(x/y/z/heading/pitch/roll/scale)
890
+ */
831
891
  updateModel(key) {
832
- let that = this;
892
+ const that = this;
833
893
  if (!this._selectModel) return;
834
894
  var transform = new Cesium.Kq3dTransform();
835
895
  if (this._selectModel instanceof Cesium.Cesium3DTileset) {
896
+ // 3DTileset类型:通过modelMatrix一次性应用平移、缩放、旋转
836
897
  var translation = new Cesium.Cartesian3(that._option.x, that._option.y, that._option.z);
837
898
  var hpRoll = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(that._option.heading), Cesium.Math.toRadians(that._option.pitch), Cesium.Math.toRadians(that._option.roll));
838
899
  var scaleXYZ = new Cesium.Cartesian3(that._option.scale, that._option.scale, that._option.scale);
839
900
  this._selectModel.modelMatrix = transform.translationScaleAndRotate(translation, scaleXYZ, hpRoll, this._targetCenter || this._center);
840
901
  } else {
902
+ // Entity类型:根据变化字段单独处理位置、朝向或缩放
841
903
  switch (key) {
842
904
  case "x":
843
905
  case "y":
844
906
  case "z":
845
- let translation = new Cesium.Cartesian3(this._option.x, this._option.y, this._option.z);
907
+ // 平移:根据xyz坐标更新位置
908
+ const translation = new Cesium.Cartesian3(this._option.x, this._option.y, this._option.z);
846
909
  this._selectModel.position = transform.translation(this._targetCenter || this._center, translation);
847
910
  break;
848
911
  case "heading":
849
912
  case "pitch":
850
913
  case "roll":
914
+ // 旋转:根据heading/pitch/roll更新朝向
851
915
  var hpRoll = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(this._option.heading), Cesium.Math.toRadians(this._option.pitch), Cesium.Math.toRadians(this._option.roll));
852
916
  this._selectModel.orientation = transform.rotate(this._targetCenter || this._center, hpRoll);
853
917
  break;
854
918
  case "scale":
919
+ // 缩放:更新模型缩放比例
855
920
  this._selectModel.model.scale = Number(this._option.scale);
856
921
  break;
857
922
  default:
@@ -921,11 +986,11 @@ Object.defineProperty(exports, "__esModule", ({
921
986
  value: true
922
987
  }));
923
988
  exports.kq_npm_client_leaflet_vue = exports.kq_npm_client_common_vue = exports.kq_npm_client3d_webgl_vue = void 0;
924
- let kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
989
+ const kq_npm_client_common_vue = exports.kq_npm_client_common_vue = window.kq_npm_client_common_vue = window.kq_npm_client_common_vue || {};
925
990
  __webpack_require__.g.kq_npm_client_common_vue = kq_npm_client_common_vue;
926
- let kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
991
+ const kq_npm_client_leaflet_vue = exports.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue = window.kq_npm_client_leaflet_vue || {};
927
992
  __webpack_require__.g.kq_npm_client_leaflet_vue = kq_npm_client_leaflet_vue;
928
- let kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
993
+ const kq_npm_client3d_webgl_vue = exports.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue = window.kq_npm_client3d_webgl_vue || {};
929
994
  __webpack_require__.g.kq_npm_client3d_webgl_vue = kq_npm_client3d_webgl_vue;
930
995
 
931
996
  /***/ })
package/package.json CHANGED
@@ -1 +1 @@
1
- {"jsdelivr":"./webgl.es.js","name":"@kq_npm/client3d_webgl_vue","description":"KQGIS Client WebGL for Vue.js","version":"4.5.55","homepage":"","keywords":["KQGIS","webGL","Vue"],"sdkNames":["@kq_npm/client_icons_vue"],"restrictedVersion":true,"validateSDK":true,"browserslist":["> 1%","last 2 versions","not dead","not ie 11"],"author":"zhupc_npm","license":"Apache-2.0","dependencies":{"html2canvas-pro":"1.5.10","save":"2.5.0","papaparse":"5.4.1"}}
1
+ {"jsdelivr":"./webgl.es.js","name":"@kq_npm/client3d_webgl_vue","description":"KQGIS Client WebGL for Vue.js","version":"4.5.57","homepage":"","keywords":["KQGIS","webGL","Vue"],"sdkNames":["@kq_npm/client_icons_vue"],"restrictedVersion":true,"validateSDK":true,"browserslist":["> 1%","last 2 versions","not dead","not ie 11"],"author":"zhupc_npm","license":"Apache-2.0","dependencies":{"html2canvas-pro":"1.5.10","save":"2.5.0","papaparse":"5.4.1"}}