@kq_npm/client3d_webgl_vue 4.1.1-beta → 4.1.3-beta

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.
@@ -190,6 +190,7 @@ class ModelExcavateViewModel {
190
190
  //Box裁剪存储参数对象
191
191
  //绘制管理对象
192
192
  //绘制完成监听事件
193
+ //Kq3dWallPrimitive
193
194
  constructor(scenceView, options) {
194
195
  (0,defineProperty/* default */.Z)(this, "_viewer", null);
195
196
 
@@ -201,28 +202,165 @@ class ModelExcavateViewModel {
201
202
 
202
203
  (0,defineProperty/* default */.Z)(this, "_removeEventListener", null);
203
204
 
205
+ (0,defineProperty/* default */.Z)(this, "_wallPrimitive", void 0);
206
+
207
+ (0,defineProperty/* default */.Z)(this, "entity0", null);
208
+
209
+ (0,defineProperty/* default */.Z)(this, "wall", null);
210
+
211
+ (0,defineProperty/* default */.Z)(this, "ratio", 0.01);
212
+
213
+ (0,defineProperty/* default */.Z)(this, "ii", 1);
214
+
215
+ (0,defineProperty/* default */.Z)(this, "scratchCartesian2", new window.Cesium.Cartesian3());
216
+
217
+ (0,defineProperty/* default */.Z)(this, "scratchCartesian3", new window.Cesium.Cartesian3());
218
+
219
+ (0,defineProperty/* default */.Z)(this, "scratchCartesian4", new window.Cesium.Cartesian3());
220
+
221
+ (0,defineProperty/* default */.Z)(this, "scratchCartesian5", new window.Cesium.Cartesian3());
222
+
223
+ (0,defineProperty/* default */.Z)(this, "scratchCartesian6", new window.Cesium.Cartesian3());
224
+
225
+ (0,defineProperty/* default */.Z)(this, "scratchCartesian7", new window.Cesium.Cartesian3());
226
+
227
+ (0,defineProperty/* default */.Z)(this, "intervalId", null);
228
+
229
+ (0,defineProperty/* default */.Z)(this, "g_flattenedPolygonTexture", null);
230
+
204
231
  this._viewer = scenceView._viewer;
205
232
  this._options = options;
206
233
  this._drawManager = scenceView._drawManager;
207
234
  this._viewer.scene.globe.depthTestAgainstTerrain = true; //开启深度检测
208
- // var kq3dFlattenning = new window.Cesium.Kq3dFlattenning(this._viewer, {});
209
- // var g_flattenedPolygonTexture = kq3dFlattenning.createFlattenedPolygonTexture();
210
235
 
236
+ let kq3dFlattenning = new window.Cesium.Kq3dFlattenning(this._viewer, {});
237
+ this.g_flattenedPolygonTexture = kq3dFlattenning.createFlattenedPolygonTexture();
211
238
  var that = this;
212
239
  this._removeEventListener = this._drawManager.drawFinishedEvent.addEventListener(shape => {
213
240
  if (shape) {
214
241
  that._options.positions = shape._controlPoints;
215
- this._Kq3dTerrainExcavation = this._Kq3dTerrainExcavation && this._Kq3dTerrainExcavation.destroy();
216
- this._Kq3dTerrainExcavation = new window.Cesium.Kq3dTerrainExcavation({
217
- viewer: this.viewer,
218
- height: this._options.height,
219
- positions: that._options.positions,
220
- hasWall: false
221
- });
242
+ that.createDynamicExcavationEffect();
222
243
 
223
244
  that._drawManager.clear();
224
245
  }
225
246
  });
247
+ } // 创建开挖模型
248
+
249
+
250
+ createDynamicExcavationEffect() {
251
+ this._Kq3dTerrainExcavation && this._Kq3dTerrainExcavation.destroy();
252
+ this._Kq3dTerrainExcavation = new window.Cesium.Kq3dTerrainExcavation({
253
+ viewer: this._viewer,
254
+ height: this._options.height,
255
+ positions: this._options.positions,
256
+ hasWall: false
257
+ });
258
+
259
+ if (this._wallPrimitive) {
260
+ this._viewer.scene.primitives.remove(this._wallPrimitive);
261
+
262
+ this._wallPrimitive = undefined;
263
+ }
264
+
265
+ this._wallPrimitive = new window.Cesium.Kq3dWallPrimitive({
266
+ viewer: this._viewer,
267
+ height: this._options.height,
268
+ positions: this._options.positions,
269
+ elevationOnTerrain: false
270
+ });
271
+
272
+ this._viewer.scene.primitives.add(this._wallPrimitive);
273
+
274
+ let that = this;
275
+
276
+ this._wallPrimitive._readyEvent.addEventListener(function (eventType) {
277
+ if (eventType != "Ready") {
278
+ return;
279
+ }
280
+
281
+ that.intervalId = setInterval(function () {
282
+ if (that.ii > 100) {
283
+ if (that.entity0) {
284
+ that._viewer.scene.primitives.remove(that.entity0);
285
+
286
+ that.entity0 = undefined;
287
+ }
288
+
289
+ if (that.wall) {
290
+ that._viewer.scene.primitives.remove(that.wall);
291
+
292
+ that.wall = undefined;
293
+ }
294
+
295
+ clearInterval(that.intervalId);
296
+ that.ii = 0;
297
+ return;
298
+ }
299
+
300
+ var carto2 = window.Cesium.Cartesian3.lerp(that._options.positions[0], that._options.positions[3], that.ratio * that.ii, that.scratchCartesian2);
301
+ var carto3 = window.Cesium.Cartesian3.lerp(that._options.positions[1], that._options.positions[2], that.ratio * that.ii, that.scratchCartesian3);
302
+
303
+ if (that.entity0) {
304
+ that._viewer.scene.primitives.remove(that.entity0);
305
+
306
+ that.entity0 = undefined;
307
+ }
308
+
309
+ that.entity0 = that.createPolyline([carto2, carto3]);
310
+ that.ii++;
311
+ that.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
312
+ var myPolygon = window.Cesium.PolygonGeometry.fromPositions({
313
+ positions: [that._options.positions[0], that._options.positions[1], carto3, carto2],
314
+ height: window.Cesium.Cartographic.fromCartesian(that._options.positions[0]).height
315
+ });
316
+ that.g_flattenedPolygonTexture.addFlattenedPolygon(myPolygon);
317
+ }, 100);
318
+ });
319
+ }
320
+
321
+ createPolyline(positions) {
322
+ var material = window.Cesium.Material.fromType("Kq3dLightningMaterial", {});
323
+
324
+ if (this.wall) {
325
+ this._viewer.scene.primitives.remove(this.wall);
326
+
327
+ this.wall = undefined;
328
+ }
329
+
330
+ var geometryInstances = [];
331
+ geometryInstances.push(new window.Cesium.GeometryInstance({
332
+ geometry: new window.Cesium.WallGeometry({
333
+ positions: positions,
334
+ maximumHeights: [10, 10],
335
+ minimumHeights: [-10, -10],
336
+ vertexFormat: window.Cesium.VertexFormat.POSITION_NORMAL_AND_ST
337
+ })
338
+ }));
339
+ this.wall = new window.Cesium.Primitive({
340
+ geometryInstances: geometryInstances,
341
+ appearance: new window.Cesium.MaterialAppearance({
342
+ material: material
343
+ })
344
+ });
345
+
346
+ this._viewer.scene.primitives.add(this.wall);
347
+
348
+ var geo = new window.Cesium.GroundPolylineGeometry({
349
+ positions: positions,
350
+ width: 40.0,
351
+ vertexFormat: window.Cesium.PolylineMaterialAppearance.VERTEX_FORMAT
352
+ });
353
+ var primitive = new window.Cesium.GroundPolylinePrimitive({
354
+ asynchronous: false,
355
+ classificationType: window.Cesium.ClassificationType.BOTH,
356
+ geometryInstances: new window.Cesium.GeometryInstance({
357
+ geometry: geo
358
+ }),
359
+ appearance: new window.Cesium.PolylineMaterialAppearance({
360
+ material: material
361
+ })
362
+ });
363
+ return this._viewer.scene.primitives.add(primitive);
226
364
  }
227
365
 
228
366
  start() {
@@ -232,6 +370,9 @@ class ModelExcavateViewModel {
232
370
 
233
371
  for (let i = 0; i < models.length; i++) {
234
372
  if (models[i]._url) {
373
+ models[i].enableFlattenning = true;
374
+ models[i].flattenDiscard = true;
375
+ this.g_flattenedPolygonTexture.attachTileset(models[i]);
235
376
  flag = true;
236
377
  }
237
378
  }
@@ -244,16 +385,41 @@ class ModelExcavateViewModel {
244
385
  });
245
386
  } else {
246
387
  (0,message/* default */.Z)({
247
- message: "请添加模型后拾取!",
388
+ message: "请添加模型后绘制!",
248
389
  type: "warning"
249
390
  });
250
391
  }
251
- } //清除
392
+ } // qi切换高度重新计算
393
+
394
+
395
+ setHeight(val) {
396
+ this._options.height = Number(val);
397
+ } // 清除
252
398
 
253
399
 
254
400
  clear() {
255
401
  this._drawManager.stopDraw(); // 销毁地形开挖
256
402
 
403
+
404
+ if (this.intervalId) {
405
+ clearInterval(this.intervalId);
406
+ this.ii = 0;
407
+
408
+ if (this.entity0) {
409
+ this._viewer.scene.primitives.remove(this.entity0);
410
+
411
+ this.entity0 = undefined;
412
+ }
413
+
414
+ if (this.wall) {
415
+ this._viewer.scene.primitives.remove(this.wall);
416
+
417
+ this.wall = undefined;
418
+ }
419
+ }
420
+
421
+ this.Kq3dTerrainExcavation && this.Kq3dTerrainExcavation.destroy();
422
+ this.g_flattenedPolygonTexture && this.g_flattenedPolygonTexture.removeAllFlattenedPolygon();
257
423
  } //销毁
258
424
 
259
425
 
@@ -378,7 +544,7 @@ const __default__ = {
378
544
  gis_utils_.utils.getWebMap(null, scenceView => {
379
545
  if (scenceView) {
380
546
  viewModel = new ModelExcavateViewModel(scenceView, {
381
- excavationDepth: formItem.excavationDepth
547
+ height: formItem.excavationDepth
382
548
  });
383
549
  }
384
550
  });
@@ -459,7 +625,7 @@ const __default__ = {
459
625
  default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_slider, {
460
626
  modelValue: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(formItem).excavationDepth,
461
627
  "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(formItem).excavationDepth = $event),
462
- step: 100,
628
+ step: 1,
463
629
  min: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(formItem).minExcavationDepth,
464
630
  max: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(formItem).maxExcavationDepth,
465
631
  onChange: _cache[1] || (_cache[1] = $event => changeHeight()),
@@ -499,9 +665,9 @@ const __default__ = {
499
665
  }), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_row, {
500
666
  class: "kq3d-model-excavate-tip"
501
667
  }, {
502
- default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("p", null, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(language).skylineTips), 1
668
+ default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("p", null, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(language).skylineTips + '(' + (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(language).reverseDrawPolygon + ')'), 1
503
669
  /* TEXT */
504
- ), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createCommentVNode)(" <p v-if=\"formItem.terrainStyle === 2\">{{ \"(\" + language.reverseDrawPolygon + \")\" }}</p> ")]),
670
+ )]),
505
671
  _: 1
506
672
  /* STABLE */
507
673
 
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@kq_npm/client3d_webgl_vue","description":"KQGIS Client3D for Vue.js","version":"4.1.1-beta","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.1.3-beta","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"}}