@inweb/viewer-visualize 25.10.1 → 25.11.1

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 (44) hide show
  1. package/dist/viewer-visualize.js +294 -176
  2. package/dist/viewer-visualize.js.map +1 -1
  3. package/dist/viewer-visualize.min.js +1 -1
  4. package/dist/viewer-visualize.module.js +261 -104
  5. package/dist/viewer-visualize.module.js.map +1 -1
  6. package/lib/Viewer/Commands/index.d.ts +1 -1
  7. package/lib/Viewer/Draggers/Actions/PanAction.d.ts +2 -2
  8. package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +1 -1
  9. package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +1 -1
  10. package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +4 -0
  11. package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +1 -1
  12. package/lib/Viewer/Draggers/OdPanDragger.d.ts +2 -2
  13. package/lib/Viewer/Draggers/OdZoomDragger.d.ts +5 -2
  14. package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +1 -1
  15. package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +1 -1
  16. package/lib/Viewer/Markup/Visualize/VisualizeMarkup.d.ts +1 -1
  17. package/lib/Viewer/Viewer.d.ts +23 -64
  18. package/package.json +6 -6
  19. package/src/Viewer/Commands/{Unselect.ts → ClearSelected.ts} +4 -3
  20. package/src/Viewer/Commands/Explode.ts +1 -1
  21. package/src/Viewer/Commands/HideSelected.ts +2 -1
  22. package/src/Viewer/Commands/IsolateSelected.ts +1 -1
  23. package/src/Viewer/Commands/ResetView.ts +2 -2
  24. package/src/Viewer/Commands/ShowAll.ts +1 -1
  25. package/src/Viewer/Commands/index.ts +1 -1
  26. package/src/Viewer/Draggers/Actions/PanAction.ts +8 -8
  27. package/src/Viewer/Draggers/Actions/ZoomAction.ts +3 -1
  28. package/src/Viewer/Draggers/Common/GestureManager.ts +3 -3
  29. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +3 -3
  30. package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +6 -1
  31. package/src/Viewer/Draggers/MeasureLineDragger/index.ts +81 -3
  32. package/src/Viewer/Draggers/OdOrbitDragger.ts +1 -1
  33. package/src/Viewer/Draggers/OdPanDragger.ts +4 -4
  34. package/src/Viewer/Draggers/OdZoomDragger.ts +13 -4
  35. package/src/Viewer/Draggers/OdZoomWheelDragger.ts +3 -1
  36. package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +1 -1
  37. package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +1 -1
  38. package/src/Viewer/Loaders/TCSLoader.ts +1 -0
  39. package/src/Viewer/Loaders/VsfXLoader.ts +1 -0
  40. package/src/Viewer/Loaders/VsfXPartialLoader.ts +1 -0
  41. package/src/Viewer/Loaders/VsfXStreamingLoader.ts +1 -0
  42. package/src/Viewer/Markup/Visualize/VisualizeMarkup.ts +8 -8
  43. package/src/Viewer/Viewer.ts +104 -82
  44. /package/lib/Viewer/Commands/{Unselect.d.ts → ClearSelected.d.ts} +0 -0
@@ -103,7 +103,8 @@
103
103
  reverseZoomWheel: false,
104
104
  enableZoomWheel: true,
105
105
  enableGestures: true,
106
- geometryType: "vsfx"
106
+ geometryType: "vsfx",
107
+ rulerUnit: "Default"
107
108
  };
108
109
  }
109
110
 
@@ -363,6 +364,13 @@
363
364
  this._data.geometryType = value;
364
365
  this.change();
365
366
  }
367
+ get rulerUnit() {
368
+ return this._data.rulerUnit;
369
+ }
370
+ set rulerUnit(value) {
371
+ this._data.rulerUnit = value;
372
+ this.change();
373
+ }
366
374
  }
367
375
 
368
376
  const CanvasEvents = [ "click", "contextmenu", "dblclick", "mousedown", "mouseleave", "mousemove", "mouseup", "pointercancel", "pointerdown", "pointerleave", "pointermove", "pointerup", "touchcancel", "touchend", "touchmove", "touchstart", "wheel" ];
@@ -460,6 +468,39 @@
460
468
  commands("VisualizeJS").registerCommand("clearMarkup", (viewer) => viewer.clearOverlay());
461
469
  commands("VisualizeJS").registerCommandAlias("clearMarkup", "clearOverlay");
462
470
 
471
+ ///////////////////////////////////////////////////////////////////////////////
472
+ // Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
473
+ // All rights reserved.
474
+ //
475
+ // This software and its documentation and related materials are owned by
476
+ // the Alliance. The software may only be incorporated into application
477
+ // programs owned by members of the Alliance, subject to a signed
478
+ // Membership Agreement and Supplemental Software License Agreement with the
479
+ // Alliance. The structure and organization of this software are the valuable
480
+ // trade secrets of the Alliance and its suppliers. The software is also
481
+ // protected by copyright law and international treaty provisions. Application
482
+ // programs incorporating this software must include the following statement
483
+ // with their copyright notices:
484
+ //
485
+ // This application incorporates Open Design Alliance software pursuant to a
486
+ // license agreement with Open Design Alliance.
487
+ // Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
488
+ // All rights reserved.
489
+ //
490
+ // By use of this software, its documentation or related materials, you
491
+ // acknowledge and accept the above terms.
492
+ ///////////////////////////////////////////////////////////////////////////////
493
+ function clearSelected(viewer) {
494
+ if (!viewer.visualizeJs)
495
+ return;
496
+ const visViewer = viewer.visViewer();
497
+ visViewer.unselect();
498
+ viewer.update();
499
+ viewer.emitEvent({ type: "select", data: undefined, handles: [] });
500
+ }
501
+ commands("VisualizeJS").registerCommand("clearSelected", clearSelected);
502
+ commands("VisualizeJS").registerCommandAlias("clearSelected", "unselect");
503
+
463
504
  ///////////////////////////////////////////////////////////////////////////////
464
505
  // Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
465
506
  // All rights reserved.
@@ -542,7 +583,7 @@
542
583
  const visViewer = viewer.visViewer();
543
584
  visViewer.explode(index);
544
585
  viewer.update();
545
- viewer.emit({ type: "explode", data: index });
586
+ viewer.emitEvent({ type: "explode", data: index });
546
587
  }
547
588
  commands("VisualizeJS").registerCommand("explode", explode);
548
589
  commands("VisualizeJS").registerCommand("collect", (viewer) => explode(viewer, 0));
@@ -694,7 +735,8 @@
694
735
  const visViewer = viewer.visViewer();
695
736
  visViewer.hideSelectedObjects(false);
696
737
  viewer.update();
697
- viewer.emit({ type: "hide" });
738
+ viewer.emitEvent({ type: "hide" });
739
+ viewer.emitEvent({ type: "select", data: undefined, handles: [] });
698
740
  }
699
741
  commands("VisualizeJS").registerCommand("hideSelected", hideSelected);
700
742
 
@@ -726,7 +768,7 @@
726
768
  const visViewer = viewer.visViewer();
727
769
  visViewer.isolateSelectedObjects(false);
728
770
  viewer.update();
729
- viewer.emit({ type: "isolate" });
771
+ viewer.emitEvent({ type: "isolate" });
730
772
  }
731
773
  commands("VisualizeJS").registerCommand("isolateSelected", isolateSelected);
732
774
 
@@ -787,11 +829,11 @@
787
829
  function resetView(viewer) {
788
830
  if (!viewer.visualizeJs)
789
831
  return;
790
- viewer.executeCommand("setActiveDragger", "");
832
+ viewer.executeCommand("setActiveDragger");
791
833
  viewer.executeCommand("clearSlices");
792
834
  viewer.executeCommand("clearOverlay");
793
835
  viewer.executeCommand("setMarkupColor");
794
- viewer.executeCommand("unselect");
836
+ viewer.executeCommand("clearSelected");
795
837
  viewer.executeCommand("showAll");
796
838
  viewer.executeCommand("explode", 0);
797
839
  viewer.executeCommand("zoomToExtents", true);
@@ -1008,42 +1050,10 @@
1008
1050
  const visViewer = viewer.visViewer();
1009
1051
  visViewer.unisolateSelectedObjects(false);
1010
1052
  viewer.update();
1011
- viewer.emit({ type: "showall" });
1053
+ viewer.emitEvent({ type: "showall" });
1012
1054
  }
1013
1055
  commands("VisualizeJS").registerCommand("showAll", showAll);
1014
1056
 
1015
- ///////////////////////////////////////////////////////////////////////////////
1016
- // Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
1017
- // All rights reserved.
1018
- //
1019
- // This software and its documentation and related materials are owned by
1020
- // the Alliance. The software may only be incorporated into application
1021
- // programs owned by members of the Alliance, subject to a signed
1022
- // Membership Agreement and Supplemental Software License Agreement with the
1023
- // Alliance. The structure and organization of this software are the valuable
1024
- // trade secrets of the Alliance and its suppliers. The software is also
1025
- // protected by copyright law and international treaty provisions. Application
1026
- // programs incorporating this software must include the following statement
1027
- // with their copyright notices:
1028
- //
1029
- // This application incorporates Open Design Alliance software pursuant to a
1030
- // license agreement with Open Design Alliance.
1031
- // Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
1032
- // All rights reserved.
1033
- //
1034
- // By use of this software, its documentation or related materials, you
1035
- // acknowledge and accept the above terms.
1036
- ///////////////////////////////////////////////////////////////////////////////
1037
- function unselect(viewer) {
1038
- if (!viewer.visualizeJs)
1039
- return;
1040
- const visViewer = viewer.visViewer();
1041
- visViewer.unselect();
1042
- viewer.update();
1043
- viewer.emitEvent({ type: "select", data: visViewer.getSelected(), handles: [] });
1044
- }
1045
- commands("VisualizeJS").registerCommand("unselect", unselect);
1046
-
1047
1057
  ///////////////////////////////////////////////////////////////////////////////
1048
1058
  // Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
1049
1059
  // All rights reserved.
@@ -13705,33 +13715,21 @@
13705
13715
  this._konvaStage.height(height);
13706
13716
  };
13707
13717
  this.pan = event => {
13708
- const pointer = this._konvaStage.getPointerPosition();
13709
- const pointTo = {
13710
- x: (pointer.x - this._konvaStage.x()) / this._konvaStage.scaleX(),
13711
- y: (pointer.y - this._konvaStage.y()) / this._konvaStage.scaleX()
13712
- };
13713
13718
  const newPos = {
13714
- x: pointer.x - pointTo.x * this._konvaStage.scale().x + event.dX,
13715
- y: pointer.y - pointTo.y * this._konvaStage.scale().x + event.dY
13719
+ x: this._konvaStage.x() + event.dX,
13720
+ y: this._konvaStage.y() + event.dY
13716
13721
  };
13717
13722
  this._konvaStage.position(newPos);
13718
13723
  };
13719
13724
  this.zoomAt = event => {
13720
- const oldScale = this._konvaStage.scaleX();
13721
- const pointer = this._konvaStage.getPointerPosition();
13722
- const mousePointTo = {
13723
- x: (pointer.x - this._konvaStage.x()) / oldScale,
13724
- y: (pointer.y - this._konvaStage.y()) / oldScale
13725
- };
13726
- const direction = event.data > 0 ? 1 : -1;
13727
- const newScale = direction > 0 ? oldScale * event.data : oldScale / event.data;
13725
+ const newScale = this._konvaStage.scaleX() * event.data;
13728
13726
  this._konvaStage.scale({
13729
13727
  x: newScale,
13730
13728
  y: newScale
13731
13729
  });
13732
13730
  const newPos = {
13733
- x: pointer.x - mousePointTo.x * newScale,
13734
- y: pointer.y - mousePointTo.y * newScale
13731
+ x: event.x - (event.x - this._konvaStage.x()) * event.data,
13732
+ y: event.y - (event.y - this._konvaStage.y()) * event.data
13735
13733
  };
13736
13734
  this._konvaStage.position(newPos);
13737
13735
  };
@@ -13757,6 +13755,7 @@
13757
13755
  this._markupContainer.style.top = "0px";
13758
13756
  this._markupContainer.style.left = "0px";
13759
13757
  this._markupContainer.style.outline = "0px";
13758
+ this._markupContainer.style.pointerEvents = "none";
13760
13759
  const parentDiv = this._container.parentElement;
13761
13760
  parentDiv.appendChild(this._markupContainer);
13762
13761
  this._resizeObserver = new ResizeObserver(this.resizeContainer);
@@ -13764,7 +13763,6 @@
13764
13763
  this._markupColor.setColor(255, 0, 0);
13765
13764
  this.initializeKonva();
13766
13765
  if (this._viewer) {
13767
- this._containerEvents.forEach((x => this._markupContainer.addEventListener(x, this.redirectToViewer)));
13768
13766
  this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
13769
13767
  this._viewer.addEventListener("pan", this.pan);
13770
13768
  this._viewer.addEventListener("zoomat", this.zoomAt);
@@ -13776,7 +13774,6 @@
13776
13774
  this._viewer.removeEventListener("zoomat", this.zoomAt);
13777
13775
  this._viewer.removeEventListener("pan", this.pan);
13778
13776
  this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
13779
- this._containerEvents.forEach((x => this._markupContainer.removeEventListener(x, this.redirectToViewer)));
13780
13777
  }
13781
13778
  this.destroyKonva();
13782
13779
  (_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
@@ -13800,6 +13797,14 @@
13800
13797
  }
13801
13798
  setMarkupColor(r, g, b) {
13802
13799
  this._markupColor.setColor(r, g, b);
13800
+ this._viewer.emit({
13801
+ type: "changemarkupcolor",
13802
+ data: {
13803
+ r: r,
13804
+ g: g,
13805
+ b: b
13806
+ }
13807
+ });
13803
13808
  }
13804
13809
  colorizeAllMarkup(r, g, b) {
13805
13810
  const hexColor = new MarkupColor(r, g, b).asHex();
@@ -13869,8 +13874,8 @@
13869
13874
  this.addImage(screenPoint, image.src, image.width, image.height, image.id);
13870
13875
  }));
13871
13876
  }
13872
- getViewpoint() {
13873
- const viewpoint = {};
13877
+ getViewpoint(viewpoint) {
13878
+ if (!viewpoint) viewpoint = {};
13874
13879
  viewpoint.lines = this.getMarkupLines();
13875
13880
  viewpoint.texts = this.getMarkupTexts();
13876
13881
  viewpoint.arrows = this.getMarkupArrows();
@@ -13884,7 +13889,6 @@
13884
13889
  viewpoint.snapshot = {
13885
13890
  data: this.combineMarkupWithDrawing()
13886
13891
  };
13887
- viewpoint.description = (new Date).toDateString();
13888
13892
  return viewpoint;
13889
13893
  }
13890
13894
  enableEditMode(mode) {
@@ -13892,9 +13896,11 @@
13892
13896
  this.clearSelected();
13893
13897
  this.removeTextInput();
13894
13898
  this.removeImageInput();
13899
+ this._markupContainer.style.pointerEvents = "none";
13895
13900
  this._markupIsActive = false;
13896
13901
  } else {
13897
13902
  this._markupMode = mode;
13903
+ this._markupContainer.style.pointerEvents = "all";
13898
13904
  this._markupIsActive = true;
13899
13905
  }
13900
13906
  return this;
@@ -14766,7 +14772,7 @@
14766
14772
  }
14767
14773
  ev.target.releasePointerCapture(ev.pointerId);
14768
14774
  const relCoord = this.relativeCoords(ev);
14769
- this.end(relCoord.x, relCoord.y);
14775
+ this.end(relCoord.x, relCoord.y, ev.clientX, ev.clientY);
14770
14776
  this.isDragging = false;
14771
14777
  this.subject.update();
14772
14778
  }
@@ -14781,7 +14787,7 @@
14781
14787
  return;
14782
14788
  }
14783
14789
  const relCoord = this.relativeCoords(ev);
14784
- this.drag(relCoord.x, relCoord.y, ev.movementX, ev.movementY);
14790
+ this.drag(relCoord.x, relCoord.y, ev.clientX, ev.clientY);
14785
14791
  if (this.isDragging) {
14786
14792
  this.subject.update();
14787
14793
  }
@@ -14830,7 +14836,7 @@
14830
14836
  }
14831
14837
  start(x, y, absoluteX = 0, absoluteY = 0) { }
14832
14838
  drag(x, y, absoluteX = 0, absoluteY = 0) { }
14833
- end(x, y) { }
14839
+ end(x, y, absoluteX = 0, absoluteY = 0) { }
14834
14840
  getActiveMarkupEntity(entityName) {
14835
14841
  return this.subject.addMarkupEntity(entityName);
14836
14842
  }
@@ -15126,7 +15132,11 @@
15126
15132
  }
15127
15133
  }
15128
15134
  getDistance() {
15129
- return getDistance(this.startPoint, this.endPoint, this.moduleInstance) / this.scale;
15135
+ let distance = getDistance(this.startPoint, this.endPoint, this.moduleInstance);
15136
+ if (Math.abs(this.scale - 1.0) > 10e-5) {
15137
+ distance = (distance / this.scale).toFixed(2);
15138
+ }
15139
+ return distance;
15130
15140
  }
15131
15141
  setStartPoint(gePoint) {
15132
15142
  this.startPoint = gePoint;
@@ -15182,6 +15192,7 @@
15182
15192
  }
15183
15193
  class MeasureLineDragger extends OdBaseDragger {
15184
15194
  constructor(subject) {
15195
+ var _a;
15185
15196
  super(subject);
15186
15197
  this.lineThickness = 2;
15187
15198
  this.press = false;
@@ -15199,10 +15210,12 @@
15199
15210
  Miles: "mi",
15200
15211
  Micrometers: "µm",
15201
15212
  MicroInches: "µin",
15202
- Undefined: " ",
15213
+ Default: "unit",
15203
15214
  };
15204
15215
  this.items = [];
15205
15216
  this.canvasEvents.push("resize");
15217
+ this.oldRulerUnit = (_a = subject.options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
15218
+ this.optionsChange = this.optionsChange.bind(this);
15206
15219
  }
15207
15220
  initialize() {
15208
15221
  super.initialize();
@@ -15212,11 +15225,13 @@
15212
15225
  this.m_overlayElement.style.zIndex = "1";
15213
15226
  this.m_overlayElement.style.pointerEvents = "none";
15214
15227
  document.body.appendChild(this.m_overlayElement);
15228
+ this.subject.addEventListener("optionschange", this.optionsChange);
15215
15229
  this.resize();
15216
15230
  }
15217
15231
  dispose() {
15218
15232
  super.dispose();
15219
15233
  this.m_overlayElement.remove();
15234
+ this.subject.removeEventListener("optionschange", this.optionsChange);
15220
15235
  }
15221
15236
  updatePreview() {
15222
15237
  this.items.forEach((item) => item.update());
@@ -15295,10 +15310,80 @@
15295
15310
  const viewer = this.m_module.getViewer();
15296
15311
  const item = new MeasureLineItem(this.m_overlayElement, viewer, this.m_module);
15297
15312
  item.lineThickness = this.lineThickness || item.lineThickness;
15298
- item.setUnit(renameUnit(this.renameUnitTable, viewer.getUnit()));
15313
+ const isDefaultUnit = !this.subject.options.rulerUnit || this.subject.options.rulerUnit === "Default";
15314
+ item.setUnit(renameUnit(this.renameUnitTable, isDefaultUnit ? viewer.getUnit() : this.subject.options.rulerUnit));
15315
+ if (!isDefaultUnit) {
15316
+ const fromUnit = this.getKUnitByName(viewer.getUnit());
15317
+ const toUnit = this.getKUnitByName(this.subject.options.rulerUnit);
15318
+ const multiplier = viewer.getUnitsConversionCoef(fromUnit, toUnit);
15319
+ this.conversionFactor = 1 / multiplier;
15320
+ item.setConversionFactor(this.conversionFactor);
15321
+ }
15322
+ else {
15323
+ item.setConversionFactor(1.0);
15324
+ }
15299
15325
  this.items.push(item);
15300
15326
  return item;
15301
15327
  }
15328
+ optionsChange(event) {
15329
+ var _a;
15330
+ const options = event.data;
15331
+ const toUnitName = (_a = options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
15332
+ if (this.oldRulerUnit === toUnitName)
15333
+ return;
15334
+ this.oldRulerUnit = toUnitName;
15335
+ const drawingUnit = this.m_module.getViewer().getUnit();
15336
+ const eToUnit = this.getKUnitByName(toUnitName);
15337
+ const eFromUnit = this.getKUnitByName(drawingUnit);
15338
+ this.items.forEach((item) => {
15339
+ if (toUnitName === "Default") {
15340
+ item.setUnit(renameUnit(this.renameUnitTable, drawingUnit));
15341
+ item.setConversionFactor(1.0);
15342
+ }
15343
+ else {
15344
+ item.setUnit(renameUnit(this.renameUnitTable, toUnitName));
15345
+ const multiplier = this.m_module.getViewer().getUnitsConversionCoef(eFromUnit, eToUnit);
15346
+ this.conversionFactor = 1 / multiplier;
15347
+ item.setConversionFactor(this.conversionFactor);
15348
+ }
15349
+ });
15350
+ }
15351
+ getKUnitByName(unitName) {
15352
+ let eUnit = this.m_module.Units.kUserDefined;
15353
+ switch (unitName) {
15354
+ case "Millimeters":
15355
+ eUnit = this.m_module.Units.kMillimeters;
15356
+ break;
15357
+ case "Centimeters":
15358
+ eUnit = this.m_module.Units.kCentimeters;
15359
+ break;
15360
+ case "Meters":
15361
+ eUnit = this.m_module.Units.kMeters;
15362
+ break;
15363
+ case "Feet":
15364
+ eUnit = this.m_module.Units.kFeet;
15365
+ break;
15366
+ case "Inches":
15367
+ eUnit = this.m_module.Units.kInches;
15368
+ break;
15369
+ case "Yards":
15370
+ eUnit = this.m_module.Units.kYards;
15371
+ break;
15372
+ case "Kilometers":
15373
+ eUnit = this.m_module.Units.kKilometers;
15374
+ break;
15375
+ case "Miles":
15376
+ eUnit = this.m_module.Units.kMiles;
15377
+ break;
15378
+ case "Micrometers":
15379
+ eUnit = this.m_module.Units.kMicrometers;
15380
+ break;
15381
+ case "MicroInches":
15382
+ eUnit = this.m_module.Units.kMicroInches;
15383
+ break;
15384
+ }
15385
+ return eUnit;
15386
+ }
15302
15387
  }
15303
15388
 
15304
15389
  const FocalLengthConst = 42.0;
@@ -15884,7 +15969,7 @@
15884
15969
  extView.setView(this.startCameraParams.position, this.startCameraParams.target, this.startCameraParams.upVector, this.startCameraParams.viewFieldWidth, this.startCameraParams.viewFieldHeight, this.startCameraParams.perspective);
15885
15970
  extView.delete();
15886
15971
  }
15887
- drag(x, y, dltX, dltY) {
15972
+ drag(x, y) {
15888
15973
  if (this.press) {
15889
15974
  this._orbitAction.action(x, y);
15890
15975
  }
@@ -15926,12 +16011,12 @@
15926
16011
  this._getViewParams = getViewParams;
15927
16012
  this._setViewParams = setViewParams;
15928
16013
  }
15929
- beginAction(x, y) {
16014
+ beginAction(x, y, absoluteX, absoluteY) {
15930
16015
  this._m_start = this.screenToWorld(x, y);
15931
- this._deltaScreenPosition = { x, y };
16016
+ this._deltaScreenPosition = { x: absoluteX, y: absoluteY };
15932
16017
  this._beginInteractivity();
15933
16018
  }
15934
- action(x, y) {
16019
+ action(x, y, absoluteX, absoluteY) {
15935
16020
  var _a;
15936
16021
  const { Vector3d } = this._m_module;
15937
16022
  const params = this._getViewParams();
@@ -15952,12 +16037,12 @@
15952
16037
  (_a = this._subject.activeDragger()) === null || _a === void 0 ? void 0 : _a.updatePreview();
15953
16038
  this._subject.emitEvent({
15954
16039
  type: "pan",
15955
- x,
15956
- y,
15957
- dX: x - this._deltaScreenPosition.x,
15958
- dY: y - this._deltaScreenPosition.y,
16040
+ x: absoluteX,
16041
+ y: absoluteY,
16042
+ dX: absoluteX - this._deltaScreenPosition.x,
16043
+ dY: absoluteY - this._deltaScreenPosition.y,
15959
16044
  });
15960
- this._deltaScreenPosition = { x, y };
16045
+ this._deltaScreenPosition = { x: absoluteX, y: absoluteY };
15961
16046
  }
15962
16047
  endAction() {
15963
16048
  this._endInteractivity();
@@ -15974,13 +16059,13 @@
15974
16059
  this.press = false;
15975
16060
  this._panAction = new PanAction(this.m_module, this.subject, this.beginInteractivity, this.endInteractivity, this.getViewParams, this.setViewParams);
15976
16061
  }
15977
- start(x, y) {
16062
+ start(x, y, absoluteX, absoluteY) {
15978
16063
  this.press = true;
15979
- this._panAction.beginAction(x, y);
16064
+ this._panAction.beginAction(x, y, absoluteX, absoluteY);
15980
16065
  }
15981
- drag(x, y, dltX, dltY) {
16066
+ drag(x, y, absoluteX, absoluteY) {
15982
16067
  if (this.press) {
15983
- this._panAction.action(x, y);
16068
+ this._panAction.action(x, y, absoluteX, absoluteY);
15984
16069
  }
15985
16070
  }
15986
16071
  end(x, y) {
@@ -16016,7 +16101,7 @@
16016
16101
  this._m_module = m_module;
16017
16102
  this._subject = subject;
16018
16103
  }
16019
- action(x, y, zoomFactor) {
16104
+ action(x, y, zoomFactor, absoluteX, absoluteY) {
16020
16105
  var _a;
16021
16106
  const viewer = this._m_module.getViewer();
16022
16107
  viewer.zoomAt(zoomFactor, x, y);
@@ -16025,10 +16110,34 @@
16025
16110
  this._subject.emitEvent({
16026
16111
  type: "zoomat",
16027
16112
  data: zoomFactor,
16113
+ x: absoluteX,
16114
+ y: absoluteY,
16028
16115
  });
16029
16116
  }
16030
16117
  }
16031
16118
 
16119
+ ///////////////////////////////////////////////////////////////////////////////
16120
+ // Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
16121
+ // All rights reserved.
16122
+ //
16123
+ // This software and its documentation and related materials are owned by
16124
+ // the Alliance. The software may only be incorporated into application
16125
+ // programs owned by members of the Alliance, subject to a signed
16126
+ // Membership Agreement and Supplemental Software License Agreement with the
16127
+ // Alliance. The structure and organization of this software are the valuable
16128
+ // trade secrets of the Alliance and its suppliers. The software is also
16129
+ // protected by copyright law and international treaty provisions. Application
16130
+ // programs incorporating this software must include the following statement
16131
+ // with their copyright notices:
16132
+ //
16133
+ // This application incorporates Open Design Alliance software pursuant to a
16134
+ // license agreement with Open Design Alliance.
16135
+ // Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
16136
+ // All rights reserved.
16137
+ //
16138
+ // By use of this software, its documentation or related materials, you
16139
+ // acknowledge and accept the above terms.
16140
+ ///////////////////////////////////////////////////////////////////////////////
16032
16141
  class OdZoomDragger extends OdBaseDragger {
16033
16142
  constructor(subject) {
16034
16143
  super(subject);
@@ -16036,17 +16145,22 @@
16036
16145
  this.press = false;
16037
16146
  this._zoomAction = new ZoomAction(this.m_module, this.subject);
16038
16147
  }
16039
- start(x, y) {
16148
+ start(x, y, absoluteX = 0, absoluteY = 0) {
16040
16149
  this.press = true;
16041
16150
  this.pressX = x;
16042
16151
  this.pressY = y;
16152
+ this.absoluteX = absoluteX;
16153
+ this.absoluteY = absoluteY;
16154
+ this.prevY = y;
16043
16155
  this.beginInteractivity();
16044
16156
  }
16045
- drag(x, y, dltX, dltY) {
16157
+ drag(x, y) {
16158
+ const dltY = y - this.prevY;
16159
+ this.prevY = y;
16046
16160
  if (this.press && Math.abs(dltY) >= 10e-6) {
16047
16161
  const ZOOM_SPEED = 0.025;
16048
16162
  const zoomFactor = dltY > 0 ? 1 + ZOOM_SPEED : 1 - ZOOM_SPEED;
16049
- this._zoomAction.action(this.pressX, this.pressY, zoomFactor);
16163
+ this._zoomAction.action(this.pressX, this.pressY, zoomFactor, this.absoluteX, this.absoluteY);
16050
16164
  }
16051
16165
  }
16052
16166
  end() {
@@ -16098,7 +16212,7 @@
16098
16212
  const viewer = this.getViewer();
16099
16213
  if (viewer) {
16100
16214
  const zoomFactor = event.deltaY > 0 ? 1 + zoomSpeed : 1 - zoomSpeed;
16101
- this._zoomAction.action(event.offsetX * window.devicePixelRatio, event.offsetY * window.devicePixelRatio, zoomFactor);
16215
+ this._zoomAction.action(event.offsetX * window.devicePixelRatio, event.offsetY * window.devicePixelRatio, zoomFactor, event.offsetX, event.offsetY);
16102
16216
  if (!this._isEnableInteractivityMode) {
16103
16217
  this._isEnableInteractivityMode = true;
16104
16218
  this.beginInteractivity();
@@ -16245,7 +16359,7 @@
16245
16359
  const startPoint = this.screenToWorld(x, y);
16246
16360
  this.m_frame.setStartPoint(startPoint);
16247
16361
  }
16248
- drag(x, y, dltX, dltY) {
16362
+ drag(x, y) {
16249
16363
  if (this.press) {
16250
16364
  this.m_maxX = x;
16251
16365
  this.m_maxY = y;
@@ -16285,7 +16399,7 @@
16285
16399
  setDefaultViewParams() {
16286
16400
  this.setViewParams(this.startCameraParams);
16287
16401
  }
16288
- drag(x, y, dltX, dltY) {
16402
+ drag(x, y) {
16289
16403
  if (this.press) {
16290
16404
  let dX = x - this.m_startPoint.x;
16291
16405
  let dY = y - this.m_startPoint.y;
@@ -16502,7 +16616,7 @@
16502
16616
  const zoomSpeed = (currentDistance - previousDistance) / 700;
16503
16617
  const zoomFactor = 1 + zoomSpeed;
16504
16618
  const middlePoint = this.getMiddlePoint(this._currentEvents);
16505
- this._zoomAction.action(middlePoint.x, middlePoint.y, zoomFactor);
16619
+ this._zoomAction.action(middlePoint.x, middlePoint.y, zoomFactor, middlePoint.x, middlePoint.y);
16506
16620
  this.subject.update();
16507
16621
  }
16508
16622
  executePanAction(currentPoint) {
@@ -16510,9 +16624,9 @@
16510
16624
  this.executeEndAction(this._lastGestureAction);
16511
16625
  this._lastGestureAction = GestureAction.Pan;
16512
16626
  OdBaseDragger.isGestureActive = true;
16513
- this._panAction.beginAction(currentPoint.x, currentPoint.y);
16627
+ this._panAction.beginAction(currentPoint.x, currentPoint.y, currentPoint.x, currentPoint.y);
16514
16628
  }
16515
- this._panAction.action(currentPoint.x, currentPoint.y);
16629
+ this._panAction.action(currentPoint.x, currentPoint.y, currentPoint.x, currentPoint.y);
16516
16630
  this.subject.update();
16517
16631
  }
16518
16632
  executeOrbitAction(currentPoint) {
@@ -16722,6 +16836,7 @@
16722
16836
  this.viewer.update(true);
16723
16837
  this.viewer.syncOpenCloudVisualStyle(false);
16724
16838
  this.viewer.syncOptions();
16839
+ this.viewer.syncOverlay();
16725
16840
  this.viewer.resize();
16726
16841
  this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
16727
16842
  }
@@ -16784,6 +16899,7 @@
16784
16899
  visViewer.parseVsfx(data);
16785
16900
  this.viewer.syncOpenCloudVisualStyle(false);
16786
16901
  this.viewer.syncOptions();
16902
+ this.viewer.syncOverlay();
16787
16903
  this.viewer.resize();
16788
16904
  }
16789
16905
  console.timeEnd("File load time");
@@ -16874,6 +16990,7 @@
16874
16990
  updaterController.update(UpdateType.kForce);
16875
16991
  this.viewer.syncOpenCloudVisualStyle(false);
16876
16992
  this.viewer.syncOptions();
16993
+ this.viewer.syncOverlay();
16877
16994
  this.viewer.resize();
16878
16995
  this.viewer.emitEvent({ type: "databasechunk", data: chunk, model: this.model });
16879
16996
  }
@@ -16949,6 +17066,7 @@
16949
17066
  updaterController.update(UpdateType.kForce);
16950
17067
  this.viewer.syncOpenCloudVisualStyle(false);
16951
17068
  this.viewer.syncOptions();
17069
+ this.viewer.syncOverlay();
16952
17070
  this.viewer.resize();
16953
17071
  this.viewer.emitEvent({ type: "databasechunk", data: chunk, model: this.model });
16954
17072
  }
@@ -17259,6 +17377,7 @@
17259
17377
  setMarkupColor(r, g, b) {
17260
17378
  const color = { r, g, b };
17261
17379
  this._markupColor = color;
17380
+ this._viewer.emitEvent({ type: "changemarkupcolor", data: color });
17262
17381
  }
17263
17382
  colorizeAllMarkup(r = 255, g = 0, b = 0) {
17264
17383
  if (!this._viewer.visualizeJs)
@@ -17328,18 +17447,18 @@
17328
17447
  }
17329
17448
  this._viewer.update();
17330
17449
  }
17331
- getViewpoint() {
17450
+ getViewpoint(viewpoint) {
17451
+ if (!this._viewer.visualizeJs)
17452
+ return {};
17332
17453
  function getLogicalPoint3dFromArray(array) {
17333
17454
  return { x: array[0], y: array[1], z: array[2] };
17334
17455
  }
17335
- if (!this._viewer.visualizeJs)
17336
- return {};
17337
17456
  const visLib = this._viewer.visLib();
17338
17457
  const visViewer = visLib.getViewer();
17339
- const viewpoint = {
17340
- lines: [],
17341
- texts: [],
17342
- };
17458
+ if (!viewpoint)
17459
+ viewpoint = {};
17460
+ viewpoint.lines = [];
17461
+ viewpoint.texts = [];
17343
17462
  const model = visViewer.getMarkupModel();
17344
17463
  const itr = model.getEntitiesIterator();
17345
17464
  for (; !itr.done(); itr.step()) {
@@ -17385,7 +17504,6 @@
17385
17504
  viewpoint.custom_fields = {
17386
17505
  markup_color: this.getMarkupColor(),
17387
17506
  };
17388
- viewpoint.description = new Date().toDateString();
17389
17507
  return viewpoint;
17390
17508
  }
17391
17509
  enableEditMode(mode) {
@@ -17549,7 +17667,7 @@
17549
17667
  * `Viewer.visualize` library you are using.
17550
17668
  */
17551
17669
  configure(params) {
17552
- this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/25.10/Visualize.js";
17670
+ this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
17553
17671
  return this;
17554
17672
  }
17555
17673
  /**
@@ -17603,6 +17721,7 @@
17603
17721
  this._gestureManager.initialize();
17604
17722
  this.syncOpenCloudVisualStyle(true);
17605
17723
  this.syncOptions();
17724
+ this.syncOverlay();
17606
17725
  this._renderTime = performance.now();
17607
17726
  this.render(this._renderTime);
17608
17727
  this.emitEvent({ type: "initialize" });
@@ -17904,9 +18023,9 @@
17904
18023
  return this;
17905
18024
  }
17906
18025
  /**
17907
- * List of names of registered draggers.
18026
+ * List of names of available draggers.
17908
18027
  *
17909
- * The following draggers are registered by default:
18028
+ * The following draggers are available by default:
17910
18029
  *
17911
18030
  * - `Line`
17912
18031
  * - `Text`
@@ -17966,6 +18085,7 @@
17966
18085
  .join(" ");
17967
18086
  }
17968
18087
  this.emitEvent({ type: "changeactivedragger", data: name });
18088
+ this.update();
17969
18089
  }
17970
18090
  return this._activeDragger;
17971
18091
  }
@@ -17976,9 +18096,6 @@
17976
18096
  this.setActiveDragger(dragger.name);
17977
18097
  }
17978
18098
  }
17979
- /**
17980
- * Removes all cutting planes.
17981
- */
17982
18099
  clearSlices() {
17983
18100
  if (!this.visualizeJs)
17984
18101
  return;
@@ -17988,18 +18105,12 @@
17988
18105
  activeView.delete();
17989
18106
  this.update();
17990
18107
  }
17991
- /**
17992
- * Clears the overlay view.
17993
- */
17994
18108
  clearOverlay() {
17995
18109
  if (!this.visualizeJs)
17996
18110
  return;
17997
18111
  this._markup.clearOverlay();
17998
18112
  this.update();
17999
18113
  }
18000
- /**
18001
- * Creates an overlay view. Overlay view is used to draw cutting planes and `Visualize` markups.
18002
- */
18003
18114
  syncOverlay() {
18004
18115
  if (!this.visualizeJs)
18005
18116
  return;
@@ -18069,24 +18180,30 @@
18069
18180
  result.z = 1 / z;
18070
18181
  return result;
18071
18182
  }
18072
- /**
18073
- * Returns a list of original handles for the selected objects.
18074
- */
18075
18183
  getSelected() {
18076
18184
  return this.executeCommand("getSelected");
18077
18185
  }
18078
- /**
18079
- * Selects the model objects by original handles that are obtained using `File.searchProperties()`.
18080
- *
18081
- * Fires:
18082
- *
18083
- * - {@link SelectEvent | select}
18084
- *
18085
- * @param handles - The list of original handles.
18086
- */
18087
18186
  setSelected(handles) {
18088
18187
  this.executeCommand("setSelected", handles);
18089
18188
  }
18189
+ clearSelected() {
18190
+ this.executeCommand("clearSelected");
18191
+ }
18192
+ hideSelected() {
18193
+ this.executeCommand("hideSelected");
18194
+ }
18195
+ isolateSelected() {
18196
+ this.executeCommand("isolateSelected");
18197
+ }
18198
+ showAll() {
18199
+ this.executeCommand("showAll");
18200
+ }
18201
+ explode(index = 0) {
18202
+ this.executeCommand("explode", index);
18203
+ }
18204
+ collect() {
18205
+ this.executeCommand("collect");
18206
+ }
18090
18207
  // Internal loading routines
18091
18208
  async loadReferences(model) {
18092
18209
  var _a;
@@ -18133,8 +18250,8 @@
18133
18250
  *
18134
18251
  * The file geometry data on the server must be converted to `VSFX` format.
18135
18252
  *
18136
- * To open a large file, enable {@link IOptions.enablePartialMode | partial load} mode before
18137
- * opening (see example below).
18253
+ * To open a large file, enable {@link IOptions.enablePartialMode | partial streaming} mode
18254
+ * before opening (see example below).
18138
18255
  *
18139
18256
  * This method requires a `Client` instance to be specified when creating the viewer to load
18140
18257
  * model reference files from the Open Cloud Server. For a standalone viewer instance use
@@ -18150,7 +18267,7 @@
18150
18267
  * - {@link GeometryEndEvent | geometryend}
18151
18268
  * - {@link GeometryErrorEvent | geometryerror}
18152
18269
  *
18153
- * @example <caption>Using partial load mode to open a large file from a server.</caption>
18270
+ * @example <caption>Using partial streaming mode to open a large file from a server.</caption>
18154
18271
  * viewer.options.enableStreamingMode = true;
18155
18272
  * viewer.options.enablePartialMode = true;
18156
18273
  * await viewer.open(file);
@@ -18175,7 +18292,8 @@
18175
18292
  const overrideOptions = new Options();
18176
18293
  overrideOptions.data = this._options.data;
18177
18294
  if (file.type === ".rcs" && !overrideOptions.enablePartialMode) {
18178
- console.log("Partial load mode is forced for RCS file");
18295
+ console.log("Partial streaming mode is forced for RCS file");
18296
+ overrideOptions.enableStreamingMode = true;
18179
18297
  overrideOptions.enablePartialMode = true;
18180
18298
  }
18181
18299
  const loaderFactory = new LoaderFactory();
@@ -18192,7 +18310,7 @@
18192
18310
  * Loads a `VSF` file into the viewer.
18193
18311
  *
18194
18312
  * This method does not support {@link IOptions.enableStreamingMode | streaming} or
18195
- * {@link IOptions.enablePartialMode | partial load} mode.
18313
+ * {@link IOptions.enablePartialMode | partial streaming} mode.
18196
18314
  *
18197
18315
  * Fires:
18198
18316
  *
@@ -18219,6 +18337,7 @@
18219
18337
  visViewer.parseFile(data);
18220
18338
  this.syncOpenCloudVisualStyle(false);
18221
18339
  this.syncOptions();
18340
+ this.syncOverlay();
18222
18341
  this.resize();
18223
18342
  this.emitEvent({ type: "geometryprogress", data: 1, buffer });
18224
18343
  this.emitEvent({ type: "databasechunk", data, buffer });
@@ -18234,7 +18353,7 @@
18234
18353
  * Loads a `VSFX` file into the viewer.
18235
18354
  *
18236
18355
  * This method does not support {@link IOptions.enableStreamingMode | streaming} or
18237
- * {@link IOptions.enablePartialMode | partial load} mode.
18356
+ * {@link IOptions.enablePartialMode | partial streaming} mode.
18238
18357
  *
18239
18358
  * Fires:
18240
18359
  *
@@ -18261,6 +18380,7 @@
18261
18380
  visViewer.parseVsfx(data);
18262
18381
  this.syncOpenCloudVisualStyle(false);
18263
18382
  this.syncOptions();
18383
+ this.syncOverlay();
18264
18384
  this.resize();
18265
18385
  this.emitEvent({ type: "geometryprogress", data: 1, buffer });
18266
18386
  this.emitEvent({ type: "databasechunk", data, buffer });
@@ -18289,53 +18409,41 @@
18289
18409
  const visLib = this.visLib();
18290
18410
  const visViewer = visLib.getViewer();
18291
18411
  this.setActiveDragger();
18412
+ this.clearSlices();
18292
18413
  this.clearOverlay();
18293
18414
  visViewer.clear();
18294
18415
  visViewer.createLocalDatabase();
18295
18416
  this.syncOpenCloudVisualStyle(true);
18296
18417
  this.syncOptions();
18418
+ this.syncOverlay();
18297
18419
  this.resize();
18298
18420
  this.emitEvent({ type: "clear" });
18299
18421
  return this;
18300
18422
  }
18301
18423
  /**
18302
- * Returns the color of new markup objects.
18424
+ * Deprecated since `25.11`. Use {@link IMarkup.getMarkupColor | markup.getMarkupColor()} instead.
18303
18425
  */
18304
18426
  getMarkupColor() {
18427
+ console.warn("Viewer.getMarkupColor() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.getMarkupColor() instead.");
18305
18428
  return this._markup.getMarkupColor();
18306
18429
  }
18307
18430
  /**
18308
- * Sets the color of new markup objects.
18309
- *
18310
- * Fires:
18311
- *
18312
- * - {@link ChangeMarkupColorEvent | changemarkupcolor}
18313
- *
18314
- * @param r - The `red` component of the color, as a number between 0 and 255.
18315
- * @param g - The `green` component of the color, as a number between 0 and 255.
18316
- * @param b - The `blue` component of the color, as a number between 0 and 255.
18431
+ * Deprecated since `25.11`. Use {@link IMarkup.setMarkupColor | markup.setMarkupColor()} instead.
18317
18432
  */
18318
18433
  setMarkupColor(r = 255, g = 0, b = 0) {
18434
+ console.warn("Viewer.setMarkupColor() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.setMarkupColor() instead.");
18319
18435
  this._markup.setMarkupColor(r, g, b);
18320
- const color = { r, g, b };
18321
- this.emitEvent({ type: "changemarkupcolor", data: color });
18322
18436
  }
18323
18437
  /**
18324
- * Colors all markup objects with the specified color.
18325
- *
18326
- * @param r - The `red` component of the color, as a number between 0 and 255.
18327
- * @param g - The `green` component of the color, as a number between 0 and 255.
18328
- * @param b - The `blue` component of the color, as a number between 0 and 255.
18438
+ * Deprecated since `25.11`. Use {@link IMarkup.colorizeAllMarkup | markup.colorizeAllMarkup()} instead.
18329
18439
  */
18330
18440
  colorizeAllMarkup(r = 255, g = 0, b = 0) {
18441
+ console.warn("Viewer.colorizeAllMarkup() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.colorizeAllMarkup() instead.");
18331
18442
  this._markup.colorizeAllMarkup(r, g, b);
18332
18443
  }
18333
18444
  /**
18334
- * Colors the selected markup objects with the specified color.
18335
- *
18336
- * @param r - `Red` part of color.
18337
- * @param g - `Green` part of color.
18338
- * @param b - `Blue` part of color.
18445
+ * Deprecated since `25.11`. Use
18446
+ * {@link IMarkup.colorizeSelectedMarkups | markup.colorizeSelectedMarkups()} instead.
18339
18447
  */
18340
18448
  colorizeSelectedMarkups(r = 255, g = 0, b = 0) {
18341
18449
  this._markup.colorizeSelectedMarkups(r, g, b);
@@ -18358,28 +18466,35 @@
18358
18466
  this.update();
18359
18467
  return entityId;
18360
18468
  }
18361
- /**
18362
- * Sets the viewer state to the specified viewpoint.
18363
- *
18364
- * To get a list of available viewpoints from the server for a specific file, use the
18365
- * `File.getViewpoints()`.
18366
- *
18367
- * @param viewpoint - Viewpoint data.
18368
- */
18369
18469
  drawViewpoint(viewpoint) {
18470
+ var _a;
18471
+ if (!this.visualizeJs)
18472
+ return;
18473
+ const draggerName = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.name;
18474
+ this.setActiveDragger();
18475
+ this.clearSlices();
18476
+ this.clearOverlay();
18477
+ this.clearSelected();
18478
+ this.showAll();
18479
+ this.explode();
18370
18480
  this.setOrthogonalCameraSettings(viewpoint.orthogonal_camera);
18371
18481
  this.setClippingPlanes(viewpoint.clipping_planes);
18482
+ this.setSelection(viewpoint.selection);
18372
18483
  this._markup.setViewpoint(viewpoint);
18484
+ this.setActiveDragger(draggerName);
18485
+ this.emitEvent({ type: "drawviewpoint", data: viewpoint });
18486
+ this.update();
18373
18487
  }
18374
- /**
18375
- * Saves the viewer state at the viewpoint.
18376
- *
18377
- * To save a viewpoint to the server for a specific file, use the `File.saveViewpoint()`.
18378
- */
18379
18488
  createViewpoint() {
18380
- const viewpoint = this._markup.getViewpoint();
18489
+ if (!this.visualizeJs)
18490
+ return {};
18491
+ const viewpoint = {};
18381
18492
  viewpoint.orthogonal_camera = this.getOrthogonalCameraSettings();
18382
18493
  viewpoint.clipping_planes = this.getClippingPlanes();
18494
+ viewpoint.selection = this.getSelection();
18495
+ viewpoint.description = new Date().toDateString();
18496
+ this._markup.getViewpoint(viewpoint);
18497
+ this.emitEvent({ type: "createviewpoint", data: viewpoint });
18383
18498
  return viewpoint;
18384
18499
  }
18385
18500
  getPoint3dFromArray(array) {
@@ -18402,13 +18517,10 @@
18402
18517
  setOrthogonalCameraSettings(settings) {
18403
18518
  const visViewer = this.visViewer();
18404
18519
  const activeView = visViewer.activeView;
18405
- this.resetActiveDragger();
18406
- this.clearSlices();
18407
- this.clearOverlay();
18408
18520
  if (settings) {
18409
18521
  activeView.setView(this.getLogicalPoint3dAsArray(settings.view_point), this.getLogicalPoint3dAsArray(settings.direction), this.getLogicalPoint3dAsArray(settings.up_vector), settings.field_width, settings.field_height, true);
18522
+ this.syncOverlay();
18410
18523
  }
18411
- this.syncOverlay();
18412
18524
  }
18413
18525
  getClippingPlanes() {
18414
18526
  const visViewer = this.visViewer();
@@ -18416,35 +18528,42 @@
18416
18528
  const clipping_planes = [];
18417
18529
  for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
18418
18530
  const cuttingPlane = activeView.getCuttingPlane(i);
18419
- const plane = {
18531
+ const clipping_plane = {
18420
18532
  location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
18421
18533
  direction: this.getPoint3dFromArray(cuttingPlane.normal()),
18422
18534
  };
18423
- clipping_planes.push(plane);
18535
+ clipping_planes.push(clipping_plane);
18424
18536
  }
18425
18537
  return clipping_planes;
18426
18538
  }
18427
- setClippingPlanes(clippingPlanes) {
18428
- if (clippingPlanes) {
18539
+ setClippingPlanes(clipping_planes) {
18540
+ if (clipping_planes) {
18429
18541
  const visViewer = this.visViewer();
18430
18542
  const activeView = visViewer.activeView;
18431
- for (const plane of clippingPlanes) {
18543
+ for (const clipping_plane of clipping_planes) {
18432
18544
  const cuttingPlane = new (this.visLib().OdTvPlane)();
18433
- cuttingPlane.set(this.getLogicalPoint3dAsArray(plane.location), this.getLogicalPoint3dAsArray(plane.direction));
18545
+ cuttingPlane.set(this.getLogicalPoint3dAsArray(clipping_plane.location), this.getLogicalPoint3dAsArray(clipping_plane.direction));
18434
18546
  activeView.addCuttingPlane(cuttingPlane);
18435
18547
  activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
18436
18548
  }
18437
18549
  }
18438
18550
  }
18551
+ getSelection() {
18552
+ return this.getSelected().map((handle) => ({ handle }));
18553
+ }
18554
+ setSelection(selection) {
18555
+ this.setSelected(selection === null || selection === void 0 ? void 0 : selection.map((component) => component.handle));
18556
+ }
18439
18557
  /**
18440
18558
  * Executes the command denoted by the given command. If the command is not found, tries to
18441
18559
  * set active dragger with the specified name.
18442
18560
  *
18443
- * The following commands are registered by default:
18561
+ * The following commands are available by default:
18444
18562
  *
18445
18563
  * - `applyModelTransform`
18446
18564
  * - `autoTransformAllModelsToCentralPoint`
18447
18565
  * - `clearMarkup`
18566
+ * - `clearSelected`
18448
18567
  * - `clearSlices`
18449
18568
  * - `createPreview`
18450
18569
  * - `explode`
@@ -18461,7 +18580,6 @@
18461
18580
  * - `setMarkupColor`
18462
18581
  * - `setSelected`
18463
18582
  * - `showAll`
18464
- * - `unselect`
18465
18583
  * - `zoomToExtents`
18466
18584
  * - `zoomToObjects`
18467
18585
  * - `zoomToSelected`