@kq_npm/client3d_webgl_vue 4.3.2 → 4.3.4

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.
@@ -416,9 +416,9 @@ const __default__ = {
416
416
  let formItem = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.reactive)({
417
417
  altitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 2920,
418
418
  // 基准高度
419
- minAltitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 0,
419
+ minAltitudeHeight: props.settingParams && props.settingParams.minAltitudeHeight || 0,
420
420
  // 基准高度区间最小值
421
- maxAltitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 5000,
421
+ maxAltitudeHeight: props.settingParams && props.settingParams.maxAltitudeHeight || 5000,
422
422
  // 基准高度区间最大值
423
423
  excavateColor: props.settingParams && props.settingParams.excavateColor || "#67C23A",
424
424
  // 挖方颜色
package/index.js CHANGED
@@ -7802,6 +7802,8 @@ class MeasureViewModel {
7802
7802
 
7803
7803
  _defineProperty(this, "activeEvent", null);
7804
7804
 
7805
+ _defineProperty(this, "nauticalMileUnit", "nmi");
7806
+
7805
7807
  this._measureHandler = new Cesium.Kq3dMeasureHandler(viewer);
7806
7808
  this._viewer = viewer;
7807
7809
  this.measureEvent = this._measureHandler.measureEvent;
@@ -7910,8 +7912,8 @@ class MeasureViewModel {
7910
7912
  newValue = (value / 1000).toFixed(2) + " km";
7911
7913
  break;
7912
7914
 
7913
- case "nmi":
7914
- newValue = (value / 1852).toFixed(2) + " nmi";
7915
+ case this.nauticalMileUnit:
7916
+ newValue = (value / 1852).toFixed(2) + " " + this.nauticalMileUnit;
7915
7917
  break;
7916
7918
 
7917
7919
  case "m²":
@@ -8142,8 +8144,11 @@ const Measurevue_type_script_setup_true_lang_js_default_ = {
8142
8144
 
8143
8145
  let isActive = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(null);
8144
8146
  let isResult = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(false);
8145
- let distanceValue = null;
8146
- let distanceUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.distanceUnit || ""); // 单位
8147
+ let distanceValue = null; // 默认显示距离的单位
8148
+
8149
+ let distanceUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.distanceUnit || ""); // 海里单位选择
8150
+
8151
+ let nauticalMileUnit = props.settingParams && props.settingParams.nauticalMileUnit || "nmi"; // 面积单位
8147
8152
 
8148
8153
  let areaUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.areaUnit || "");
8149
8154
  let result = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("0");
@@ -8176,7 +8181,7 @@ const Measurevue_type_script_setup_true_lang_js_default_ = {
8176
8181
  value: "m"
8177
8182
  }, {
8178
8183
  label: language.value.nauticalMile,
8179
- value: "nmi"
8184
+ value: nauticalMileUnit
8180
8185
  }];
8181
8186
  };
8182
8187
 
@@ -8217,7 +8222,8 @@ const Measurevue_type_script_setup_true_lang_js_default_ = {
8217
8222
  });
8218
8223
  gis_utils_.utils.getWebMap(props.target, scenceView => {
8219
8224
  if (scenceView) {
8220
- viewModel = new MeasureViewModel(scenceView._viewer); //注册测量事件,以获取测量结果
8225
+ viewModel = new MeasureViewModel(scenceView._viewer);
8226
+ viewModel.nauticalMileUnit = nauticalMileUnit; //注册测量事件,以获取测量结果
8221
8227
 
8222
8228
  viewModel.measureEvent.addEventListener(function (res) {
8223
8229
  if (measureType.value === "distance") {
@@ -8394,8 +8400,8 @@ const Measurevue_type_script_setup_true_lang_js_default_ = {
8394
8400
  newValue = (value / 1000).toFixed(2) + " km";
8395
8401
  break;
8396
8402
 
8397
- case "nmi":
8398
- newValue = (value / 1852).toFixed(2) + " nmi";
8403
+ case nauticalMileUnit:
8404
+ newValue = (value / 1852).toFixed(2) + " " + nauticalMileUnit;
8399
8405
  break;
8400
8406
 
8401
8407
  case "m²":
@@ -14851,6 +14857,8 @@ class ModelExcavateViewModel {
14851
14857
 
14852
14858
  _defineProperty(this, "intervalId", null);
14853
14859
 
14860
+ _defineProperty(this, "tileset1", null);
14861
+
14854
14862
  _defineProperty(this, "g_flattenedPolygonTexture", null);
14855
14863
 
14856
14864
  this._viewer = scenceView._viewer;
@@ -14859,12 +14867,43 @@ class ModelExcavateViewModel {
14859
14867
  this._viewer.scene.globe.depthTestAgainstTerrain = true; //开启深度检测
14860
14868
 
14861
14869
  let kq3dFlattenning = new window.Cesium.Kq3dFlattenning(this._viewer, {});
14862
- this.g_flattenedPolygonTexture = kq3dFlattenning.createFlattenedPolygonTexture();
14870
+ this.g_flattenedPolygonTexture = kq3dFlattenning.createFlattenedPolygonTexture(); // this.tileset1 = this._viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
14871
+ // url: "http://support.kqgeo.com:18700/SampleData/3DTiles/Oblique/tileset.json"
14872
+ // }));
14873
+ // this.tileset1.readyPromise.then(function (tileset) {
14874
+ // that._viewer.zoomTo(tileset);
14875
+ // }).otherwise(function (error) {
14876
+ // console.log(error);
14877
+ // });
14878
+ // this.tileset1.enableFlattenning = true;
14879
+ // this.tileset1.flattenDiscard = true;
14880
+ // this.g_flattenedPolygonTexture.attachTileset(this.tileset1);
14881
+
14863
14882
  var that = this;
14883
+ var models = this._viewer.scene.primitives._primitives;
14884
+
14885
+ for (let i = 0; i < models.length; i++) {
14886
+ if (models[1] instanceof Cesium.Cesium3DTileset && models[i]._url) {
14887
+ models[i].enableFlattenning = true;
14888
+ models[i].flattenDiscard = true;
14889
+ models[i].readyPromise.then(function (tileset) {
14890
+ that.g_flattenedPolygonTexture.attachTileset(tileset);
14891
+ });
14892
+ }
14893
+ }
14894
+
14864
14895
  this._removeEventListener = this._drawManager.drawFinishedEvent.addEventListener(shape => {
14865
14896
  if (shape) {
14866
14897
  that._options.positions = shape._controlPoints;
14867
- that.createDynamicExcavationEffect();
14898
+
14899
+ if (shape._controlPoints && shape._controlPoints.length > 3 || shape._controlPoints && shape._controlPoints.length == 3 && shape._controlPoints[2] != shape._controlPoints[0]) {
14900
+ that.createDynamicExcavationEffect();
14901
+ } else {
14902
+ message({
14903
+ message: "请至少绘制3个点!",
14904
+ type: "warning"
14905
+ });
14906
+ }
14868
14907
 
14869
14908
  that._drawManager.clear();
14870
14909
  }
@@ -14873,12 +14912,20 @@ class ModelExcavateViewModel {
14873
14912
 
14874
14913
 
14875
14914
  createDynamicExcavationEffect() {
14915
+ this._Kq3dTerrainExcavation && this._Kq3dTerrainExcavation.destroy();
14876
14916
  this._Kq3dTerrainExcavation = new window.Cesium.Kq3dTerrainExcavation({
14877
14917
  viewer: this._viewer,
14878
14918
  height: this._options.height,
14879
14919
  positions: this._options.positions,
14880
14920
  hasWall: false
14881
14921
  });
14922
+
14923
+ if (this._wallPrimitive) {
14924
+ this._viewer.scene.primitives.remove(this._wallPrimitive);
14925
+
14926
+ this._wallPrimitive = undefined;
14927
+ }
14928
+
14882
14929
  this._wallPrimitive = new window.Cesium.Kq3dWallPrimitive({
14883
14930
  viewer: this._viewer,
14884
14931
  height: this._options.height,
@@ -14895,43 +14942,40 @@ class ModelExcavateViewModel {
14895
14942
  return;
14896
14943
  }
14897
14944
 
14898
- that.intervalId = setInterval(function () {
14899
- if (that.ii > 100) {
14900
- if (that.entity0) {
14901
- that._viewer.scene.primitives.remove(that.entity0);
14902
-
14903
- that.entity0 = undefined;
14904
- }
14905
-
14906
- if (that.wall) {
14907
- that._viewer.scene.primitives.remove(that.wall);
14908
-
14909
- that.wall = undefined;
14910
- }
14911
-
14912
- clearInterval(that.intervalId);
14913
- that.ii = 0;
14914
- return;
14915
- }
14916
-
14917
- var carto2 = window.Cesium.Cartesian3.lerp(that._options.positions[0], that._options.positions[3], that.ratio * that.ii, that.scratchCartesian2);
14918
- var carto3 = window.Cesium.Cartesian3.lerp(that._options.positions[1], that._options.positions[2], that.ratio * that.ii, that.scratchCartesian3);
14919
-
14920
- if (that.entity0) {
14921
- that._viewer.scene.primitives.remove(that.entity0);
14922
-
14923
- that.entity0 = undefined;
14924
- }
14925
-
14926
- that.entity0 = that.createPolyline([carto2, carto3]);
14927
- that.ii++;
14928
- that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
14929
- var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
14930
- positions: [that._options.positions[0], that._options.positions[1], carto3, carto2],
14931
- height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
14932
- });
14933
- that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon);
14934
- }, 100);
14945
+ that.g_flattenedPolygonTexture && that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
14946
+ var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
14947
+ positions: that._options.positions,
14948
+ height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
14949
+ });
14950
+ that.g_flattenedPolygonTexture && that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon); // that.intervalId = setInterval(function () {
14951
+ // if (that.ii > 100) {
14952
+ // if (that.entity0) {
14953
+ // that._viewer.scene.primitives.remove(that.entity0);
14954
+ // that.entity0 = undefined;
14955
+ // }
14956
+ // if (that.wall) {
14957
+ // that._viewer.scene.primitives.remove(that.wall);
14958
+ // that.wall = undefined;
14959
+ // }
14960
+ // clearInterval(that.intervalId);
14961
+ // that.ii = 0;
14962
+ // return;
14963
+ // }
14964
+ // var carto2 = window.Cesium.Cartesian3.lerp(that._options.positions[0], that._options.positions[3], that.ratio * that.ii, that.scratchCartesian2);
14965
+ // var carto3 = window.Cesium.Cartesian3.lerp(that._options.positions[1], that._options.positions[2], that.ratio * that.ii, that.scratchCartesian3);
14966
+ // if (that.entity0) {
14967
+ // that._viewer.scene.primitives.remove(that.entity0);
14968
+ // that.entity0 = undefined;
14969
+ // }
14970
+ // that.entity0 = that.createPolyline([carto2, carto3]);
14971
+ // that.ii++;
14972
+ // that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
14973
+ // var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
14974
+ // positions: [that._options.positions[0], that._options.positions[1], carto3, carto2],
14975
+ // height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
14976
+ // });
14977
+ // that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon);
14978
+ // }, 100);
14935
14979
  });
14936
14980
  }
14937
14981
 
@@ -14983,19 +15027,22 @@ class ModelExcavateViewModel {
14983
15027
  start() {
14984
15028
  // 判断是否添加了模型
14985
15029
  var flag = false;
15030
+ var that = this;
14986
15031
  var models = this._viewer.scene.primitives._primitives;
14987
15032
 
14988
15033
  for (let i = 0; i < models.length; i++) {
14989
- if (models[i]._url) {
14990
- models[i].enableFlattenning = true;
14991
- models[i].flattenDiscard = true;
14992
- this.g_flattenedPolygonTexture.attachTileset(models[i]);
15034
+ if (models[i] instanceof Cesium.Cesium3DTileset && models[i]._url) {
15035
+ // models[i].enableFlattenning = true;
15036
+ // models[i].flattenDiscard = true;
15037
+ // models[i].readyPromise.then(function (tileset) {
15038
+ // that.g_flattenedPolygonTexture.attachTileset(tileset);
15039
+ // });
14993
15040
  flag = true;
14994
15041
  }
14995
15042
  }
14996
15043
 
14997
15044
  if (flag) {
14998
- this.clear();
15045
+ this.remove();
14999
15046
 
15000
15047
  this._drawManager.startDraw("polygon", {
15001
15048
  clampToGround: true
@@ -15011,13 +15058,10 @@ class ModelExcavateViewModel {
15011
15058
 
15012
15059
  setHeight(val) {
15013
15060
  this._options.height = Number(val);
15014
- } // 清除
15015
-
15016
-
15017
- clear() {
15018
- this._drawManager.stopDraw(); // 销毁地形开挖
15019
-
15061
+ }
15020
15062
 
15063
+ remove() {
15064
+ // 销毁地形开挖
15021
15065
  if (this.intervalId) {
15022
15066
  clearInterval(this.intervalId);
15023
15067
  this.ii = 0;
@@ -15043,11 +15087,20 @@ class ModelExcavateViewModel {
15043
15087
 
15044
15088
  this._Kq3dTerrainExcavation && this._Kq3dTerrainExcavation.destroy();
15045
15089
  this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
15090
+ } // 清除
15091
+
15092
+
15093
+ clear() {
15094
+ this._drawManager.stopDraw();
15095
+
15096
+ this.remove();
15046
15097
  } //销毁
15047
15098
 
15048
15099
 
15049
15100
  destroy() {
15050
15101
  this.clear();
15102
+ this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.detachAllTileset();
15103
+ this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.destroy();
15051
15104
  }
15052
15105
 
15053
15106
  }
@@ -15163,6 +15216,7 @@ const ModelExcavatevue_type_script_setup_true_lang_js_default_ = {
15163
15216
  viewModel = new ModelExcavateViewModel(scenceView, {
15164
15217
  height: formItem.excavationDepth
15165
15218
  });
15219
+ window.scenceView = scenceView;
15166
15220
  }
15167
15221
  });
15168
15222
  });
@@ -20847,9 +20901,9 @@ const ExcavateFillAnalysisvue_type_script_setup_true_lang_js_default_ = {
20847
20901
  let formItem = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.reactive)({
20848
20902
  altitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 2920,
20849
20903
  // 基准高度
20850
- minAltitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 0,
20904
+ minAltitudeHeight: props.settingParams && props.settingParams.minAltitudeHeight || 0,
20851
20905
  // 基准高度区间最小值
20852
- maxAltitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 5000,
20906
+ maxAltitudeHeight: props.settingParams && props.settingParams.maxAltitudeHeight || 5000,
20853
20907
  // 基准高度区间最大值
20854
20908
  excavateColor: props.settingParams && props.settingParams.excavateColor || "#67C23A",
20855
20909
  // 挖方颜色
package/measure/index.js CHANGED
@@ -61,6 +61,8 @@ class MeasureViewModel {
61
61
 
62
62
  (0,_Users_zpc_Documents_KQGEOSpace_KQGISClientForVue_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(this, "activeEvent", null);
63
63
 
64
+ (0,_Users_zpc_Documents_KQGEOSpace_KQGISClientForVue_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(this, "nauticalMileUnit", "nmi");
65
+
64
66
  this._measureHandler = new Cesium.Kq3dMeasureHandler(viewer);
65
67
  this._viewer = viewer;
66
68
  this.measureEvent = this._measureHandler.measureEvent;
@@ -169,8 +171,8 @@ class MeasureViewModel {
169
171
  newValue = (value / 1000).toFixed(2) + " km";
170
172
  break;
171
173
 
172
- case "nmi":
173
- newValue = (value / 1852).toFixed(2) + " nmi";
174
+ case this.nauticalMileUnit:
175
+ newValue = (value / 1852).toFixed(2) + " " + this.nauticalMileUnit;
174
176
  break;
175
177
 
176
178
  case "m²":
@@ -572,8 +574,11 @@ const __default__ = {
572
574
 
573
575
  let isActive = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(null);
574
576
  let isResult = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(false);
575
- let distanceValue = null;
576
- let distanceUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.distanceUnit || ""); // 单位
577
+ let distanceValue = null; // 默认显示距离的单位
578
+
579
+ let distanceUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.distanceUnit || ""); // 海里单位选择
580
+
581
+ let nauticalMileUnit = props.settingParams && props.settingParams.nauticalMileUnit || "nmi"; // 面积单位
577
582
 
578
583
  let areaUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.areaUnit || "");
579
584
  let result = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("0");
@@ -606,7 +611,7 @@ const __default__ = {
606
611
  value: "m"
607
612
  }, {
608
613
  label: language.value.nauticalMile,
609
- value: "nmi"
614
+ value: nauticalMileUnit
610
615
  }];
611
616
  };
612
617
 
@@ -647,7 +652,8 @@ const __default__ = {
647
652
  });
648
653
  gis_utils_.utils.getWebMap(props.target, scenceView => {
649
654
  if (scenceView) {
650
- viewModel = new MeasureViewModel/* default */.Z(scenceView._viewer); //注册测量事件,以获取测量结果
655
+ viewModel = new MeasureViewModel/* default */.Z(scenceView._viewer);
656
+ viewModel.nauticalMileUnit = nauticalMileUnit; //注册测量事件,以获取测量结果
651
657
 
652
658
  viewModel.measureEvent.addEventListener(function (res) {
653
659
  if (measureType.value === "distance") {
@@ -824,8 +830,8 @@ const __default__ = {
824
830
  newValue = (value / 1000).toFixed(2) + " km";
825
831
  break;
826
832
 
827
- case "nmi":
828
- newValue = (value / 1852).toFixed(2) + " nmi";
833
+ case nauticalMileUnit:
834
+ newValue = (value / 1852).toFixed(2) + " " + nauticalMileUnit;
829
835
  break;
830
836
 
831
837
  case "m²":
@@ -237,6 +237,8 @@ class ModelExcavateViewModel {
237
237
 
238
238
  (0,defineProperty/* default */.Z)(this, "intervalId", null);
239
239
 
240
+ (0,defineProperty/* default */.Z)(this, "tileset1", null);
241
+
240
242
  (0,defineProperty/* default */.Z)(this, "g_flattenedPolygonTexture", null);
241
243
 
242
244
  this._viewer = scenceView._viewer;
@@ -245,12 +247,43 @@ class ModelExcavateViewModel {
245
247
  this._viewer.scene.globe.depthTestAgainstTerrain = true; //开启深度检测
246
248
 
247
249
  let kq3dFlattenning = new window.Cesium.Kq3dFlattenning(this._viewer, {});
248
- this.g_flattenedPolygonTexture = kq3dFlattenning.createFlattenedPolygonTexture();
250
+ this.g_flattenedPolygonTexture = kq3dFlattenning.createFlattenedPolygonTexture(); // this.tileset1 = this._viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
251
+ // url: "http://support.kqgeo.com:18700/SampleData/3DTiles/Oblique/tileset.json"
252
+ // }));
253
+ // this.tileset1.readyPromise.then(function (tileset) {
254
+ // that._viewer.zoomTo(tileset);
255
+ // }).otherwise(function (error) {
256
+ // console.log(error);
257
+ // });
258
+ // this.tileset1.enableFlattenning = true;
259
+ // this.tileset1.flattenDiscard = true;
260
+ // this.g_flattenedPolygonTexture.attachTileset(this.tileset1);
261
+
249
262
  var that = this;
263
+ var models = this._viewer.scene.primitives._primitives;
264
+
265
+ for (let i = 0; i < models.length; i++) {
266
+ if (models[1] instanceof Cesium.Cesium3DTileset && models[i]._url) {
267
+ models[i].enableFlattenning = true;
268
+ models[i].flattenDiscard = true;
269
+ models[i].readyPromise.then(function (tileset) {
270
+ that.g_flattenedPolygonTexture.attachTileset(tileset);
271
+ });
272
+ }
273
+ }
274
+
250
275
  this._removeEventListener = this._drawManager.drawFinishedEvent.addEventListener(shape => {
251
276
  if (shape) {
252
277
  that._options.positions = shape._controlPoints;
253
- that.createDynamicExcavationEffect();
278
+
279
+ if (shape._controlPoints && shape._controlPoints.length > 3 || shape._controlPoints && shape._controlPoints.length == 3 && shape._controlPoints[2] != shape._controlPoints[0]) {
280
+ that.createDynamicExcavationEffect();
281
+ } else {
282
+ (0,message/* default */.Z)({
283
+ message: "请至少绘制3个点!",
284
+ type: "warning"
285
+ });
286
+ }
254
287
 
255
288
  that._drawManager.clear();
256
289
  }
@@ -259,12 +292,20 @@ class ModelExcavateViewModel {
259
292
 
260
293
 
261
294
  createDynamicExcavationEffect() {
295
+ this._Kq3dTerrainExcavation && this._Kq3dTerrainExcavation.destroy();
262
296
  this._Kq3dTerrainExcavation = new window.Cesium.Kq3dTerrainExcavation({
263
297
  viewer: this._viewer,
264
298
  height: this._options.height,
265
299
  positions: this._options.positions,
266
300
  hasWall: false
267
301
  });
302
+
303
+ if (this._wallPrimitive) {
304
+ this._viewer.scene.primitives.remove(this._wallPrimitive);
305
+
306
+ this._wallPrimitive = undefined;
307
+ }
308
+
268
309
  this._wallPrimitive = new window.Cesium.Kq3dWallPrimitive({
269
310
  viewer: this._viewer,
270
311
  height: this._options.height,
@@ -281,43 +322,40 @@ class ModelExcavateViewModel {
281
322
  return;
282
323
  }
283
324
 
284
- that.intervalId = setInterval(function () {
285
- if (that.ii > 100) {
286
- if (that.entity0) {
287
- that._viewer.scene.primitives.remove(that.entity0);
288
-
289
- that.entity0 = undefined;
290
- }
291
-
292
- if (that.wall) {
293
- that._viewer.scene.primitives.remove(that.wall);
294
-
295
- that.wall = undefined;
296
- }
297
-
298
- clearInterval(that.intervalId);
299
- that.ii = 0;
300
- return;
301
- }
302
-
303
- var carto2 = window.Cesium.Cartesian3.lerp(that._options.positions[0], that._options.positions[3], that.ratio * that.ii, that.scratchCartesian2);
304
- var carto3 = window.Cesium.Cartesian3.lerp(that._options.positions[1], that._options.positions[2], that.ratio * that.ii, that.scratchCartesian3);
305
-
306
- if (that.entity0) {
307
- that._viewer.scene.primitives.remove(that.entity0);
308
-
309
- that.entity0 = undefined;
310
- }
311
-
312
- that.entity0 = that.createPolyline([carto2, carto3]);
313
- that.ii++;
314
- that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
315
- var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
316
- positions: [that._options.positions[0], that._options.positions[1], carto3, carto2],
317
- height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
318
- });
319
- that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon);
320
- }, 100);
325
+ that.g_flattenedPolygonTexture && that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
326
+ var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
327
+ positions: that._options.positions,
328
+ height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
329
+ });
330
+ that.g_flattenedPolygonTexture && that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon); // that.intervalId = setInterval(function () {
331
+ // if (that.ii > 100) {
332
+ // if (that.entity0) {
333
+ // that._viewer.scene.primitives.remove(that.entity0);
334
+ // that.entity0 = undefined;
335
+ // }
336
+ // if (that.wall) {
337
+ // that._viewer.scene.primitives.remove(that.wall);
338
+ // that.wall = undefined;
339
+ // }
340
+ // clearInterval(that.intervalId);
341
+ // that.ii = 0;
342
+ // return;
343
+ // }
344
+ // var carto2 = window.Cesium.Cartesian3.lerp(that._options.positions[0], that._options.positions[3], that.ratio * that.ii, that.scratchCartesian2);
345
+ // var carto3 = window.Cesium.Cartesian3.lerp(that._options.positions[1], that._options.positions[2], that.ratio * that.ii, that.scratchCartesian3);
346
+ // if (that.entity0) {
347
+ // that._viewer.scene.primitives.remove(that.entity0);
348
+ // that.entity0 = undefined;
349
+ // }
350
+ // that.entity0 = that.createPolyline([carto2, carto3]);
351
+ // that.ii++;
352
+ // that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
353
+ // var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
354
+ // positions: [that._options.positions[0], that._options.positions[1], carto3, carto2],
355
+ // height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
356
+ // });
357
+ // that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon);
358
+ // }, 100);
321
359
  });
322
360
  }
323
361
 
@@ -369,19 +407,22 @@ class ModelExcavateViewModel {
369
407
  start() {
370
408
  // 判断是否添加了模型
371
409
  var flag = false;
410
+ var that = this;
372
411
  var models = this._viewer.scene.primitives._primitives;
373
412
 
374
413
  for (let i = 0; i < models.length; i++) {
375
- if (models[i]._url) {
376
- models[i].enableFlattenning = true;
377
- models[i].flattenDiscard = true;
378
- this.g_flattenedPolygonTexture.attachTileset(models[i]);
414
+ if (models[i] instanceof Cesium.Cesium3DTileset && models[i]._url) {
415
+ // models[i].enableFlattenning = true;
416
+ // models[i].flattenDiscard = true;
417
+ // models[i].readyPromise.then(function (tileset) {
418
+ // that.g_flattenedPolygonTexture.attachTileset(tileset);
419
+ // });
379
420
  flag = true;
380
421
  }
381
422
  }
382
423
 
383
424
  if (flag) {
384
- this.clear();
425
+ this.remove();
385
426
 
386
427
  this._drawManager.startDraw("polygon", {
387
428
  clampToGround: true
@@ -397,13 +438,10 @@ class ModelExcavateViewModel {
397
438
 
398
439
  setHeight(val) {
399
440
  this._options.height = Number(val);
400
- } // 清除
401
-
402
-
403
- clear() {
404
- this._drawManager.stopDraw(); // 销毁地形开挖
405
-
441
+ }
406
442
 
443
+ remove() {
444
+ // 销毁地形开挖
407
445
  if (this.intervalId) {
408
446
  clearInterval(this.intervalId);
409
447
  this.ii = 0;
@@ -429,11 +467,20 @@ class ModelExcavateViewModel {
429
467
 
430
468
  this._Kq3dTerrainExcavation && this._Kq3dTerrainExcavation.destroy();
431
469
  this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
470
+ } // 清除
471
+
472
+
473
+ clear() {
474
+ this._drawManager.stopDraw();
475
+
476
+ this.remove();
432
477
  } //销毁
433
478
 
434
479
 
435
480
  destroy() {
436
481
  this.clear();
482
+ this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.detachAllTileset();
483
+ this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.destroy();
437
484
  }
438
485
 
439
486
  }
@@ -555,6 +602,7 @@ const __default__ = {
555
602
  viewModel = new ModelExcavateViewModel(scenceView, {
556
603
  height: formItem.excavationDepth
557
604
  });
605
+ window.scenceView = scenceView;
558
606
  }
559
607
  });
560
608
  });
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@kq_npm/client3d_webgl_vue","description":"KQGIS Client3D for Vue.js","version":"4.3.2","homepage":"","keywords":["KQGIS","webGL","Vue"],"restrictedVersion":true,"browserslist":["> 1%","last 2 versions","not dead","not ie 11"],"author":"KQWEB GROUP","license":"Apache-2.0","dependencies":{"colorcolor":"1.1.1","echarts":"5.3.0","echarts-stat":"1.2.0","js-cookie":"3.0.1","omit.js":"2.0.2","save":"2.5.0","tinycolor2":"1.4.2","vue-i18n":"9.2.0-beta.36","xlsx":"0.18.5","css-vars-ponyfill":"2.4.8","html2canvas":"1.4.1","xe-utils":"3.5.4"}}
1
+ {"name":"@kq_npm/client3d_webgl_vue","description":"KQGIS Client3D for Vue.js","version":"4.3.4","homepage":"","keywords":["KQGIS","webGL","Vue"],"restrictedVersion":true,"browserslist":["> 1%","last 2 versions","not dead","not ie 11"],"author":"KQWEB GROUP","license":"Apache-2.0","dependencies":{"colorcolor":"1.1.1","echarts":"4.9.0","echarts-stat":"1.2.0","js-cookie":"3.0.1","omit.js":"2.0.2","save":"2.5.0","tinycolor2":"1.4.2","vue-i18n":"9.2.0-beta.36","xlsx":"0.18.5","@kq_npm/client_icons_vue":"0.7.9-beta","css-vars-ponyfill":"2.4.8","html2canvas":"1.4.1","xe-utils":"3.5.4"}}
@@ -7820,9 +7820,9 @@ const __default__ = {
7820
7820
  let formItem = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.reactive)({
7821
7821
  altitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 2920,
7822
7822
  // 基准高度
7823
- minAltitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 0,
7823
+ minAltitudeHeight: props.settingParams && props.settingParams.minAltitudeHeight || 0,
7824
7824
  // 基准高度区间最小值
7825
- maxAltitudeHeight: props.settingParams && props.settingParams.altitudeHeight || 5000,
7825
+ maxAltitudeHeight: props.settingParams && props.settingParams.maxAltitudeHeight || 5000,
7826
7826
  // 基准高度区间最大值
7827
7827
  excavateColor: props.settingParams && props.settingParams.excavateColor || "#67C23A",
7828
7828
  // 挖方颜色
@@ -17025,6 +17025,8 @@ class MeasureViewModel {
17025
17025
 
17026
17026
  (0,_Users_zpc_Documents_KQGEOSpace_KQGISClientForVue_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(this, "activeEvent", null);
17027
17027
 
17028
+ (0,_Users_zpc_Documents_KQGEOSpace_KQGISClientForVue_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(this, "nauticalMileUnit", "nmi");
17029
+
17028
17030
  this._measureHandler = new Cesium.Kq3dMeasureHandler(viewer);
17029
17031
  this._viewer = viewer;
17030
17032
  this.measureEvent = this._measureHandler.measureEvent;
@@ -17133,8 +17135,8 @@ class MeasureViewModel {
17133
17135
  newValue = (value / 1000).toFixed(2) + " km";
17134
17136
  break;
17135
17137
 
17136
- case "nmi":
17137
- newValue = (value / 1852).toFixed(2) + " nmi";
17138
+ case this.nauticalMileUnit:
17139
+ newValue = (value / 1852).toFixed(2) + " " + this.nauticalMileUnit;
17138
17140
  break;
17139
17141
 
17140
17142
  case "m²":
@@ -17396,8 +17398,11 @@ const __default__ = {
17396
17398
 
17397
17399
  let isActive = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(null);
17398
17400
  let isResult = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(false);
17399
- let distanceValue = null;
17400
- let distanceUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.distanceUnit || ""); // 单位
17401
+ let distanceValue = null; // 默认显示距离的单位
17402
+
17403
+ let distanceUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.distanceUnit || ""); // 海里单位选择
17404
+
17405
+ let nauticalMileUnit = props.settingParams && props.settingParams.nauticalMileUnit || "nmi"; // 面积单位
17401
17406
 
17402
17407
  let areaUnit = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(props.settingParams && props.settingParams.areaUnit || "");
17403
17408
  let result = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("0");
@@ -17430,7 +17435,7 @@ const __default__ = {
17430
17435
  value: "m"
17431
17436
  }, {
17432
17437
  label: language.value.nauticalMile,
17433
- value: "nmi"
17438
+ value: nauticalMileUnit
17434
17439
  }];
17435
17440
  };
17436
17441
 
@@ -17471,7 +17476,8 @@ const __default__ = {
17471
17476
  });
17472
17477
  gis_utils_.utils.getWebMap(props.target, scenceView => {
17473
17478
  if (scenceView) {
17474
- viewModel = new MeasureViewModel/* default */.Z(scenceView._viewer); //注册测量事件,以获取测量结果
17479
+ viewModel = new MeasureViewModel/* default */.Z(scenceView._viewer);
17480
+ viewModel.nauticalMileUnit = nauticalMileUnit; //注册测量事件,以获取测量结果
17475
17481
 
17476
17482
  viewModel.measureEvent.addEventListener(function (res) {
17477
17483
  if (measureType.value === "distance") {
@@ -17648,8 +17654,8 @@ const __default__ = {
17648
17654
  newValue = (value / 1000).toFixed(2) + " km";
17649
17655
  break;
17650
17656
 
17651
- case "nmi":
17652
- newValue = (value / 1852).toFixed(2) + " nmi";
17657
+ case nauticalMileUnit:
17658
+ newValue = (value / 1852).toFixed(2) + " " + nauticalMileUnit;
17653
17659
  break;
17654
17660
 
17655
17661
  case "m²":
@@ -18650,6 +18656,8 @@ class ModelExcavateViewModel {
18650
18656
 
18651
18657
  (0,defineProperty/* default */.Z)(this, "intervalId", null);
18652
18658
 
18659
+ (0,defineProperty/* default */.Z)(this, "tileset1", null);
18660
+
18653
18661
  (0,defineProperty/* default */.Z)(this, "g_flattenedPolygonTexture", null);
18654
18662
 
18655
18663
  this._viewer = scenceView._viewer;
@@ -18658,12 +18666,43 @@ class ModelExcavateViewModel {
18658
18666
  this._viewer.scene.globe.depthTestAgainstTerrain = true; //开启深度检测
18659
18667
 
18660
18668
  let kq3dFlattenning = new window.Cesium.Kq3dFlattenning(this._viewer, {});
18661
- this.g_flattenedPolygonTexture = kq3dFlattenning.createFlattenedPolygonTexture();
18669
+ this.g_flattenedPolygonTexture = kq3dFlattenning.createFlattenedPolygonTexture(); // this.tileset1 = this._viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
18670
+ // url: "http://support.kqgeo.com:18700/SampleData/3DTiles/Oblique/tileset.json"
18671
+ // }));
18672
+ // this.tileset1.readyPromise.then(function (tileset) {
18673
+ // that._viewer.zoomTo(tileset);
18674
+ // }).otherwise(function (error) {
18675
+ // console.log(error);
18676
+ // });
18677
+ // this.tileset1.enableFlattenning = true;
18678
+ // this.tileset1.flattenDiscard = true;
18679
+ // this.g_flattenedPolygonTexture.attachTileset(this.tileset1);
18680
+
18662
18681
  var that = this;
18682
+ var models = this._viewer.scene.primitives._primitives;
18683
+
18684
+ for (let i = 0; i < models.length; i++) {
18685
+ if (models[1] instanceof Cesium.Cesium3DTileset && models[i]._url) {
18686
+ models[i].enableFlattenning = true;
18687
+ models[i].flattenDiscard = true;
18688
+ models[i].readyPromise.then(function (tileset) {
18689
+ that.g_flattenedPolygonTexture.attachTileset(tileset);
18690
+ });
18691
+ }
18692
+ }
18693
+
18663
18694
  this._removeEventListener = this._drawManager.drawFinishedEvent.addEventListener(shape => {
18664
18695
  if (shape) {
18665
18696
  that._options.positions = shape._controlPoints;
18666
- that.createDynamicExcavationEffect();
18697
+
18698
+ if (shape._controlPoints && shape._controlPoints.length > 3 || shape._controlPoints && shape._controlPoints.length == 3 && shape._controlPoints[2] != shape._controlPoints[0]) {
18699
+ that.createDynamicExcavationEffect();
18700
+ } else {
18701
+ (0,message/* default */.Z)({
18702
+ message: "请至少绘制3个点!",
18703
+ type: "warning"
18704
+ });
18705
+ }
18667
18706
 
18668
18707
  that._drawManager.clear();
18669
18708
  }
@@ -18672,12 +18711,20 @@ class ModelExcavateViewModel {
18672
18711
 
18673
18712
 
18674
18713
  createDynamicExcavationEffect() {
18714
+ this._Kq3dTerrainExcavation && this._Kq3dTerrainExcavation.destroy();
18675
18715
  this._Kq3dTerrainExcavation = new window.Cesium.Kq3dTerrainExcavation({
18676
18716
  viewer: this._viewer,
18677
18717
  height: this._options.height,
18678
18718
  positions: this._options.positions,
18679
18719
  hasWall: false
18680
18720
  });
18721
+
18722
+ if (this._wallPrimitive) {
18723
+ this._viewer.scene.primitives.remove(this._wallPrimitive);
18724
+
18725
+ this._wallPrimitive = undefined;
18726
+ }
18727
+
18681
18728
  this._wallPrimitive = new window.Cesium.Kq3dWallPrimitive({
18682
18729
  viewer: this._viewer,
18683
18730
  height: this._options.height,
@@ -18694,43 +18741,40 @@ class ModelExcavateViewModel {
18694
18741
  return;
18695
18742
  }
18696
18743
 
18697
- that.intervalId = setInterval(function () {
18698
- if (that.ii > 100) {
18699
- if (that.entity0) {
18700
- that._viewer.scene.primitives.remove(that.entity0);
18701
-
18702
- that.entity0 = undefined;
18703
- }
18704
-
18705
- if (that.wall) {
18706
- that._viewer.scene.primitives.remove(that.wall);
18707
-
18708
- that.wall = undefined;
18709
- }
18710
-
18711
- clearInterval(that.intervalId);
18712
- that.ii = 0;
18713
- return;
18714
- }
18715
-
18716
- var carto2 = window.Cesium.Cartesian3.lerp(that._options.positions[0], that._options.positions[3], that.ratio * that.ii, that.scratchCartesian2);
18717
- var carto3 = window.Cesium.Cartesian3.lerp(that._options.positions[1], that._options.positions[2], that.ratio * that.ii, that.scratchCartesian3);
18718
-
18719
- if (that.entity0) {
18720
- that._viewer.scene.primitives.remove(that.entity0);
18721
-
18722
- that.entity0 = undefined;
18723
- }
18724
-
18725
- that.entity0 = that.createPolyline([carto2, carto3]);
18726
- that.ii++;
18727
- that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
18728
- var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
18729
- positions: [that._options.positions[0], that._options.positions[1], carto3, carto2],
18730
- height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
18731
- });
18732
- that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon);
18733
- }, 100);
18744
+ that.g_flattenedPolygonTexture && that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
18745
+ var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
18746
+ positions: that._options.positions,
18747
+ height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
18748
+ });
18749
+ that.g_flattenedPolygonTexture && that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon); // that.intervalId = setInterval(function () {
18750
+ // if (that.ii > 100) {
18751
+ // if (that.entity0) {
18752
+ // that._viewer.scene.primitives.remove(that.entity0);
18753
+ // that.entity0 = undefined;
18754
+ // }
18755
+ // if (that.wall) {
18756
+ // that._viewer.scene.primitives.remove(that.wall);
18757
+ // that.wall = undefined;
18758
+ // }
18759
+ // clearInterval(that.intervalId);
18760
+ // that.ii = 0;
18761
+ // return;
18762
+ // }
18763
+ // var carto2 = window.Cesium.Cartesian3.lerp(that._options.positions[0], that._options.positions[3], that.ratio * that.ii, that.scratchCartesian2);
18764
+ // var carto3 = window.Cesium.Cartesian3.lerp(that._options.positions[1], that._options.positions[2], that.ratio * that.ii, that.scratchCartesian3);
18765
+ // if (that.entity0) {
18766
+ // that._viewer.scene.primitives.remove(that.entity0);
18767
+ // that.entity0 = undefined;
18768
+ // }
18769
+ // that.entity0 = that.createPolyline([carto2, carto3]);
18770
+ // that.ii++;
18771
+ // that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
18772
+ // var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
18773
+ // positions: [that._options.positions[0], that._options.positions[1], carto3, carto2],
18774
+ // height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
18775
+ // });
18776
+ // that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon);
18777
+ // }, 100);
18734
18778
  });
18735
18779
  }
18736
18780
 
@@ -18782,19 +18826,22 @@ class ModelExcavateViewModel {
18782
18826
  start() {
18783
18827
  // 判断是否添加了模型
18784
18828
  var flag = false;
18829
+ var that = this;
18785
18830
  var models = this._viewer.scene.primitives._primitives;
18786
18831
 
18787
18832
  for (let i = 0; i < models.length; i++) {
18788
- if (models[i]._url) {
18789
- models[i].enableFlattenning = true;
18790
- models[i].flattenDiscard = true;
18791
- this.g_flattenedPolygonTexture.attachTileset(models[i]);
18833
+ if (models[i] instanceof Cesium.Cesium3DTileset && models[i]._url) {
18834
+ // models[i].enableFlattenning = true;
18835
+ // models[i].flattenDiscard = true;
18836
+ // models[i].readyPromise.then(function (tileset) {
18837
+ // that.g_flattenedPolygonTexture.attachTileset(tileset);
18838
+ // });
18792
18839
  flag = true;
18793
18840
  }
18794
18841
  }
18795
18842
 
18796
18843
  if (flag) {
18797
- this.clear();
18844
+ this.remove();
18798
18845
 
18799
18846
  this._drawManager.startDraw("polygon", {
18800
18847
  clampToGround: true
@@ -18810,13 +18857,10 @@ class ModelExcavateViewModel {
18810
18857
 
18811
18858
  setHeight(val) {
18812
18859
  this._options.height = Number(val);
18813
- } // 清除
18814
-
18815
-
18816
- clear() {
18817
- this._drawManager.stopDraw(); // 销毁地形开挖
18818
-
18860
+ }
18819
18861
 
18862
+ remove() {
18863
+ // 销毁地形开挖
18820
18864
  if (this.intervalId) {
18821
18865
  clearInterval(this.intervalId);
18822
18866
  this.ii = 0;
@@ -18842,11 +18886,20 @@ class ModelExcavateViewModel {
18842
18886
 
18843
18887
  this._Kq3dTerrainExcavation && this._Kq3dTerrainExcavation.destroy();
18844
18888
  this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
18889
+ } // 清除
18890
+
18891
+
18892
+ clear() {
18893
+ this._drawManager.stopDraw();
18894
+
18895
+ this.remove();
18845
18896
  } //销毁
18846
18897
 
18847
18898
 
18848
18899
  destroy() {
18849
18900
  this.clear();
18901
+ this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.detachAllTileset();
18902
+ this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.destroy();
18850
18903
  }
18851
18904
 
18852
18905
  }
@@ -18968,6 +19021,7 @@ const __default__ = {
18968
19021
  viewModel = new ModelExcavateViewModel(scenceView, {
18969
19022
  height: formItem.excavationDepth
18970
19023
  });
19024
+ window.scenceView = scenceView;
18971
19025
  }
18972
19026
  });
18973
19027
  });