@inweb/viewer-visualize 25.11.0 → 25.11.2

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.
@@ -829,7 +829,7 @@
829
829
  function resetView(viewer) {
830
830
  if (!viewer.visualizeJs)
831
831
  return;
832
- viewer.executeCommand("setActiveDragger", "");
832
+ viewer.executeCommand("setActiveDragger");
833
833
  viewer.executeCommand("clearSlices");
834
834
  viewer.executeCommand("clearOverlay");
835
835
  viewer.executeCommand("setMarkupColor");
@@ -13874,8 +13874,8 @@
13874
13874
  this.addImage(screenPoint, image.src, image.width, image.height, image.id);
13875
13875
  }));
13876
13876
  }
13877
- getViewpoint() {
13878
- const viewpoint = {};
13877
+ getViewpoint(viewpoint) {
13878
+ if (!viewpoint) viewpoint = {};
13879
13879
  viewpoint.lines = this.getMarkupLines();
13880
13880
  viewpoint.texts = this.getMarkupTexts();
13881
13881
  viewpoint.arrows = this.getMarkupArrows();
@@ -13889,7 +13889,6 @@
13889
13889
  viewpoint.snapshot = {
13890
13890
  data: this.combineMarkupWithDrawing()
13891
13891
  };
13892
- viewpoint.description = (new Date).toDateString();
13893
13892
  return viewpoint;
13894
13893
  }
13895
13894
  enableEditMode(mode) {
@@ -15457,7 +15456,8 @@
15457
15456
  //avp.lensLength = this.viewParams.lensLength;
15458
15457
  avp.delete();
15459
15458
  }
15460
- this.subject.update();
15459
+ // CLOUD-5359 Demo Viewer crashes after the Walk Mode
15460
+ this.subject.update(true);
15461
15461
  this.subject.options.enableZoomWheel = this.enableZoomWheelPreviousValue;
15462
15462
  }
15463
15463
  keydown(ev) {
@@ -16837,6 +16837,7 @@
16837
16837
  this.viewer.update(true);
16838
16838
  this.viewer.syncOpenCloudVisualStyle(false);
16839
16839
  this.viewer.syncOptions();
16840
+ this.viewer.syncOverlay();
16840
16841
  this.viewer.resize();
16841
16842
  this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
16842
16843
  }
@@ -16899,6 +16900,7 @@
16899
16900
  visViewer.parseVsfx(data);
16900
16901
  this.viewer.syncOpenCloudVisualStyle(false);
16901
16902
  this.viewer.syncOptions();
16903
+ this.viewer.syncOverlay();
16902
16904
  this.viewer.resize();
16903
16905
  }
16904
16906
  console.timeEnd("File load time");
@@ -16989,6 +16991,7 @@
16989
16991
  updaterController.update(UpdateType.kForce);
16990
16992
  this.viewer.syncOpenCloudVisualStyle(false);
16991
16993
  this.viewer.syncOptions();
16994
+ this.viewer.syncOverlay();
16992
16995
  this.viewer.resize();
16993
16996
  this.viewer.emitEvent({ type: "databasechunk", data: chunk, model: this.model });
16994
16997
  }
@@ -17064,6 +17067,7 @@
17064
17067
  updaterController.update(UpdateType.kForce);
17065
17068
  this.viewer.syncOpenCloudVisualStyle(false);
17066
17069
  this.viewer.syncOptions();
17070
+ this.viewer.syncOverlay();
17067
17071
  this.viewer.resize();
17068
17072
  this.viewer.emitEvent({ type: "databasechunk", data: chunk, model: this.model });
17069
17073
  }
@@ -17444,18 +17448,18 @@
17444
17448
  }
17445
17449
  this._viewer.update();
17446
17450
  }
17447
- getViewpoint() {
17451
+ getViewpoint(viewpoint) {
17452
+ if (!this._viewer.visualizeJs)
17453
+ return {};
17448
17454
  function getLogicalPoint3dFromArray(array) {
17449
17455
  return { x: array[0], y: array[1], z: array[2] };
17450
17456
  }
17451
- if (!this._viewer.visualizeJs)
17452
- return {};
17453
17457
  const visLib = this._viewer.visLib();
17454
17458
  const visViewer = visLib.getViewer();
17455
- const viewpoint = {
17456
- lines: [],
17457
- texts: [],
17458
- };
17459
+ if (!viewpoint)
17460
+ viewpoint = {};
17461
+ viewpoint.lines = [];
17462
+ viewpoint.texts = [];
17459
17463
  const model = visViewer.getMarkupModel();
17460
17464
  const itr = model.getEntitiesIterator();
17461
17465
  for (; !itr.done(); itr.step()) {
@@ -17501,7 +17505,6 @@
17501
17505
  viewpoint.custom_fields = {
17502
17506
  markup_color: this.getMarkupColor(),
17503
17507
  };
17504
- viewpoint.description = new Date().toDateString();
17505
17508
  return viewpoint;
17506
17509
  }
17507
17510
  enableEditMode(mode) {
@@ -17719,6 +17722,7 @@
17719
17722
  this._gestureManager.initialize();
17720
17723
  this.syncOpenCloudVisualStyle(true);
17721
17724
  this.syncOptions();
17725
+ this.syncOverlay();
17722
17726
  this._renderTime = performance.now();
17723
17727
  this.render(this._renderTime);
17724
17728
  this.emitEvent({ type: "initialize" });
@@ -18020,9 +18024,9 @@
18020
18024
  return this;
18021
18025
  }
18022
18026
  /**
18023
- * List of names of registered draggers.
18027
+ * List of names of available draggers.
18024
18028
  *
18025
- * The following draggers are registered by default:
18029
+ * The following draggers are available by default:
18026
18030
  *
18027
18031
  * - `Line`
18028
18032
  * - `Text`
@@ -18082,6 +18086,7 @@
18082
18086
  .join(" ");
18083
18087
  }
18084
18088
  this.emitEvent({ type: "changeactivedragger", data: name });
18089
+ this.update();
18085
18090
  }
18086
18091
  return this._activeDragger;
18087
18092
  }
@@ -18092,9 +18097,6 @@
18092
18097
  this.setActiveDragger(dragger.name);
18093
18098
  }
18094
18099
  }
18095
- /**
18096
- * Removes all cutting planes.
18097
- */
18098
18100
  clearSlices() {
18099
18101
  if (!this.visualizeJs)
18100
18102
  return;
@@ -18104,18 +18106,12 @@
18104
18106
  activeView.delete();
18105
18107
  this.update();
18106
18108
  }
18107
- /**
18108
- * Clears the overlay view.
18109
- */
18110
18109
  clearOverlay() {
18111
18110
  if (!this.visualizeJs)
18112
18111
  return;
18113
18112
  this._markup.clearOverlay();
18114
18113
  this.update();
18115
18114
  }
18116
- /**
18117
- * Creates an overlay view. Overlay view is used to draw cutting planes and `Visualize` markups.
18118
- */
18119
18115
  syncOverlay() {
18120
18116
  if (!this.visualizeJs)
18121
18117
  return;
@@ -18342,6 +18338,7 @@
18342
18338
  visViewer.parseFile(data);
18343
18339
  this.syncOpenCloudVisualStyle(false);
18344
18340
  this.syncOptions();
18341
+ this.syncOverlay();
18345
18342
  this.resize();
18346
18343
  this.emitEvent({ type: "geometryprogress", data: 1, buffer });
18347
18344
  this.emitEvent({ type: "databasechunk", data, buffer });
@@ -18384,6 +18381,7 @@
18384
18381
  visViewer.parseVsfx(data);
18385
18382
  this.syncOpenCloudVisualStyle(false);
18386
18383
  this.syncOptions();
18384
+ this.syncOverlay();
18387
18385
  this.resize();
18388
18386
  this.emitEvent({ type: "geometryprogress", data: 1, buffer });
18389
18387
  this.emitEvent({ type: "databasechunk", data, buffer });
@@ -18412,11 +18410,13 @@
18412
18410
  const visLib = this.visLib();
18413
18411
  const visViewer = visLib.getViewer();
18414
18412
  this.setActiveDragger();
18413
+ this.clearSlices();
18415
18414
  this.clearOverlay();
18416
18415
  visViewer.clear();
18417
18416
  visViewer.createLocalDatabase();
18418
18417
  this.syncOpenCloudVisualStyle(true);
18419
18418
  this.syncOptions();
18419
+ this.syncOverlay();
18420
18420
  this.resize();
18421
18421
  this.emitEvent({ type: "clear" });
18422
18422
  return this;
@@ -18467,28 +18467,35 @@
18467
18467
  this.update();
18468
18468
  return entityId;
18469
18469
  }
18470
- /**
18471
- * Sets the viewer state to the specified viewpoint.
18472
- *
18473
- * To get a list of available viewpoints from the server for a specific file, use the
18474
- * `File.getViewpoints()`.
18475
- *
18476
- * @param viewpoint - Viewpoint data.
18477
- */
18478
18470
  drawViewpoint(viewpoint) {
18471
+ var _a;
18472
+ if (!this.visualizeJs)
18473
+ return;
18474
+ const draggerName = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.name;
18475
+ this.setActiveDragger();
18476
+ this.clearSlices();
18477
+ this.clearOverlay();
18478
+ this.clearSelected();
18479
+ this.showAll();
18480
+ this.explode();
18479
18481
  this.setOrthogonalCameraSettings(viewpoint.orthogonal_camera);
18480
18482
  this.setClippingPlanes(viewpoint.clipping_planes);
18483
+ this.setSelection(viewpoint.selection);
18481
18484
  this._markup.setViewpoint(viewpoint);
18485
+ this.setActiveDragger(draggerName);
18486
+ this.emitEvent({ type: "drawviewpoint", data: viewpoint });
18487
+ this.update();
18482
18488
  }
18483
- /**
18484
- * Saves the viewer state at the viewpoint.
18485
- *
18486
- * To save a viewpoint to the server for a specific file, use the `File.saveViewpoint()`.
18487
- */
18488
18489
  createViewpoint() {
18489
- const viewpoint = this._markup.getViewpoint();
18490
+ if (!this.visualizeJs)
18491
+ return {};
18492
+ const viewpoint = {};
18490
18493
  viewpoint.orthogonal_camera = this.getOrthogonalCameraSettings();
18491
18494
  viewpoint.clipping_planes = this.getClippingPlanes();
18495
+ viewpoint.selection = this.getSelection();
18496
+ viewpoint.description = new Date().toDateString();
18497
+ this._markup.getViewpoint(viewpoint);
18498
+ this.emitEvent({ type: "createviewpoint", data: viewpoint });
18492
18499
  return viewpoint;
18493
18500
  }
18494
18501
  getPoint3dFromArray(array) {
@@ -18511,13 +18518,10 @@
18511
18518
  setOrthogonalCameraSettings(settings) {
18512
18519
  const visViewer = this.visViewer();
18513
18520
  const activeView = visViewer.activeView;
18514
- this.resetActiveDragger();
18515
- this.clearSlices();
18516
- this.clearOverlay();
18517
18521
  if (settings) {
18518
18522
  activeView.setView(this.getLogicalPoint3dAsArray(settings.view_point), this.getLogicalPoint3dAsArray(settings.direction), this.getLogicalPoint3dAsArray(settings.up_vector), settings.field_width, settings.field_height, true);
18523
+ this.syncOverlay();
18519
18524
  }
18520
- this.syncOverlay();
18521
18525
  }
18522
18526
  getClippingPlanes() {
18523
18527
  const visViewer = this.visViewer();
@@ -18525,26 +18529,32 @@
18525
18529
  const clipping_planes = [];
18526
18530
  for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
18527
18531
  const cuttingPlane = activeView.getCuttingPlane(i);
18528
- const plane = {
18532
+ const clipping_plane = {
18529
18533
  location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
18530
18534
  direction: this.getPoint3dFromArray(cuttingPlane.normal()),
18531
18535
  };
18532
- clipping_planes.push(plane);
18536
+ clipping_planes.push(clipping_plane);
18533
18537
  }
18534
18538
  return clipping_planes;
18535
18539
  }
18536
- setClippingPlanes(clippingPlanes) {
18537
- if (clippingPlanes) {
18540
+ setClippingPlanes(clipping_planes) {
18541
+ if (clipping_planes) {
18538
18542
  const visViewer = this.visViewer();
18539
18543
  const activeView = visViewer.activeView;
18540
- for (const plane of clippingPlanes) {
18544
+ for (const clipping_plane of clipping_planes) {
18541
18545
  const cuttingPlane = new (this.visLib().OdTvPlane)();
18542
- cuttingPlane.set(this.getLogicalPoint3dAsArray(plane.location), this.getLogicalPoint3dAsArray(plane.direction));
18546
+ cuttingPlane.set(this.getLogicalPoint3dAsArray(clipping_plane.location), this.getLogicalPoint3dAsArray(clipping_plane.direction));
18543
18547
  activeView.addCuttingPlane(cuttingPlane);
18544
18548
  activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
18545
18549
  }
18546
18550
  }
18547
18551
  }
18552
+ getSelection() {
18553
+ return this.getSelected().map((handle) => ({ handle }));
18554
+ }
18555
+ setSelection(selection) {
18556
+ this.setSelected(selection === null || selection === void 0 ? void 0 : selection.map((component) => component.handle));
18557
+ }
18548
18558
  /**
18549
18559
  * Executes the command denoted by the given command. If the command is not found, tries to
18550
18560
  * set active dragger with the specified name.