@inweb/viewer-visualize 27.10.0 → 27.11.0

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 (88) hide show
  1. package/dist/viewer-visualize.js +572 -235
  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 +457 -235
  5. package/dist/viewer-visualize.module.js.map +1 -1
  6. package/lib/Viewer/Commands/ClearSelected.d.ts +1 -1
  7. package/lib/Viewer/Commands/Deselect.d.ts +2 -0
  8. package/lib/Viewer/Commands/Explode.d.ts +1 -1
  9. package/lib/Viewer/Commands/GetHidden.d.ts +2 -0
  10. package/lib/Viewer/Commands/GetIsolated.d.ts +2 -0
  11. package/lib/Viewer/Commands/GetSelected.d.ts +2 -2
  12. package/lib/Viewer/Commands/GetSelected2.d.ts +1 -1
  13. package/lib/Viewer/Commands/Hide.d.ts +2 -0
  14. package/lib/Viewer/Commands/HideAll.d.ts +2 -0
  15. package/lib/Viewer/Commands/HideSelected.d.ts +1 -1
  16. package/lib/Viewer/Commands/Isolate.d.ts +2 -0
  17. package/lib/Viewer/Commands/IsolateSelected.d.ts +1 -1
  18. package/lib/Viewer/Commands/RegenerateAll.d.ts +1 -1
  19. package/lib/Viewer/Commands/ResetView.d.ts +1 -1
  20. package/lib/Viewer/Commands/Select.d.ts +2 -0
  21. package/lib/Viewer/Commands/SelectModel.d.ts +1 -1
  22. package/lib/Viewer/Commands/SetSelected.d.ts +2 -2
  23. package/lib/Viewer/Commands/SetSelected2.d.ts +2 -2
  24. package/lib/Viewer/Commands/Show.d.ts +2 -0
  25. package/lib/Viewer/Commands/ShowAll.d.ts +1 -1
  26. package/lib/Viewer/Commands/ToHandles.d.ts +2 -0
  27. package/lib/Viewer/Commands/ToHandles2.d.ts +2 -0
  28. package/lib/Viewer/Commands/ToggleSelection.d.ts +2 -0
  29. package/lib/Viewer/Commands/ZoomExtents.d.ts +2 -0
  30. package/lib/Viewer/Commands/ZoomTo.d.ts +2 -0
  31. package/lib/Viewer/Commands/ZoomToSelected.d.ts +1 -1
  32. package/lib/Viewer/Components/index.d.ts +1 -1
  33. package/lib/Viewer/Draggers/index.d.ts +2 -2
  34. package/lib/Viewer/Loaders/VSFCloudLoader.d.ts +2 -2
  35. package/lib/Viewer/Loaders/VSFXCloudLoader.d.ts +2 -2
  36. package/lib/Viewer/Loaders/VSFXCloudPartialLoader.d.ts +2 -2
  37. package/lib/Viewer/Loaders/VSFXCloudStreamingLoader.d.ts +2 -2
  38. package/lib/Viewer/Loaders/index.d.ts +4 -2
  39. package/lib/Viewer/Models/ModelImpl.d.ts +14 -0
  40. package/lib/Viewer/Models/ModelImpl.types.d.ts +6 -1
  41. package/lib/Viewer/Viewer.d.ts +18 -3
  42. package/package.json +5 -5
  43. package/src/Viewer/Commands/ClearSelected.ts +4 -8
  44. package/src/Viewer/Commands/Deselect.ts +35 -0
  45. package/src/Viewer/Commands/Explode.ts +4 -6
  46. package/src/Viewer/Commands/GetHidden.ts +30 -0
  47. package/src/Viewer/Commands/GetIsolated.ts +30 -0
  48. package/src/Viewer/Commands/GetModels.ts +2 -3
  49. package/src/Viewer/Commands/GetSelected.ts +5 -30
  50. package/src/Viewer/Commands/GetSelected2.ts +5 -7
  51. package/src/Viewer/Commands/Hide.ts +35 -0
  52. package/src/Viewer/Commands/HideAll.ts +32 -0
  53. package/src/Viewer/Commands/HideSelected.ts +2 -11
  54. package/src/Viewer/Commands/Isolate.ts +41 -0
  55. package/src/Viewer/Commands/IsolateSelected.ts +2 -8
  56. package/src/Viewer/Commands/RegenerateAll.ts +2 -3
  57. package/src/Viewer/Commands/ResetView.ts +2 -4
  58. package/src/Viewer/Commands/Select.ts +36 -0
  59. package/src/Viewer/Commands/SelectModel.ts +11 -14
  60. package/src/Viewer/Commands/SetSelected.ts +8 -19
  61. package/src/Viewer/Commands/SetSelected2.ts +6 -14
  62. package/src/Viewer/Commands/Show.ts +34 -0
  63. package/src/Viewer/Commands/ShowAll.ts +3 -6
  64. package/src/Viewer/Commands/ToHandles.ts +35 -0
  65. package/src/Viewer/Commands/ToHandles2.ts +36 -0
  66. package/src/Viewer/Commands/ToggleSelection.ts +40 -0
  67. package/src/Viewer/Commands/{ZoomToExtents.ts → ZoomExtents.ts} +2 -8
  68. package/src/Viewer/Commands/{ZoomToObjects.ts → ZoomTo.ts} +8 -13
  69. package/src/Viewer/Commands/ZoomToSelected.ts +3 -11
  70. package/src/Viewer/Commands/index.ts +29 -8
  71. package/src/Viewer/Components/index.ts +1 -1
  72. package/src/Viewer/Draggers/Actions/OrbitAction.ts +21 -14
  73. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +32 -32
  74. package/src/Viewer/Draggers/OdZoomWheelDragger.ts +2 -2
  75. package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +14 -10
  76. package/src/Viewer/Draggers/index.ts +2 -2
  77. package/src/Viewer/Loaders/VSFCloudLoader.ts +5 -4
  78. package/src/Viewer/Loaders/VSFFileLoader.ts +2 -1
  79. package/src/Viewer/Loaders/VSFXCloudLoader.ts +5 -4
  80. package/src/Viewer/Loaders/VSFXCloudPartialLoader.ts +5 -4
  81. package/src/Viewer/Loaders/VSFXCloudStreamingLoader.ts +5 -4
  82. package/src/Viewer/Loaders/VSFXFileLoader.ts +2 -1
  83. package/src/Viewer/Loaders/index.ts +4 -2
  84. package/src/Viewer/Models/ModelImpl.ts +149 -2
  85. package/src/Viewer/Models/ModelImpl.types.ts +9 -1
  86. package/src/Viewer/Viewer.ts +120 -18
  87. package/lib/Viewer/Commands/ZoomToExtents.d.ts +0 -2
  88. package/lib/Viewer/Commands/ZoomToObjects.d.ts +0 -2
@@ -21,17 +21,8 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
25
 
26
26
  export function hideSelected(viewer: Viewer): void {
27
- if (!viewer.visualizeJs) return;
28
-
29
- const visViewer = viewer.visViewer();
30
- visViewer.hideSelectedObjects(false);
31
-
32
- viewer.update();
33
-
34
- viewer.emitEvent({ type: "hide" });
35
- viewer.emitEvent({ type: "select", handles: [] });
36
- viewer.emitEvent({ type: "select2", handles: [] });
27
+ viewer.hide(viewer.getSelected(false));
37
28
  }
@@ -0,0 +1,41 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2026, Open Design Alliance ("the Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2026 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+
24
+ import type { Viewer } from "../Viewer";
25
+ import { toHandles } from "./ToHandles";
26
+
27
+ export function isolate(viewer: Viewer, handles: string | string[]): void {
28
+ handles = toHandles(viewer, handles);
29
+
30
+ const handlesSet = new Set(handles);
31
+ const toDeselect = [];
32
+ for (const handle of viewer.selector.selected) {
33
+ if (!handlesSet.has(handle)) toDeselect.push(handle);
34
+ }
35
+
36
+ viewer.deselect(toDeselect);
37
+ viewer.visibilityManager.isolate(handles);
38
+
39
+ viewer.emitEvent({ type: "isolate" });
40
+ viewer.update();
41
+ }
@@ -21,14 +21,8 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
25
 
26
26
  export function isolateSelected(viewer: Viewer): void {
27
- if (!viewer.visualizeJs) return;
28
-
29
- const visViewer = viewer.visViewer();
30
- visViewer.isolateSelectedObjects(false);
31
-
32
- viewer.update();
33
- viewer.emitEvent({ type: "isolate" });
27
+ viewer.isolate(viewer.getSelected(false));
34
28
  }
@@ -21,12 +21,11 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
25
 
26
26
  export function regenerateAll(viewer: Viewer): void {
27
- if (!viewer.visualizeJs) return;
28
-
29
27
  const visViewer = viewer.visViewer();
28
+
30
29
  visViewer.regenAll();
31
30
 
32
31
  viewer.update();
@@ -21,11 +21,9 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
25
 
26
26
  export function resetView(viewer: Viewer): void {
27
- if (!viewer.visualizeJs) return;
28
-
29
27
  viewer.executeCommand("setActiveDragger");
30
28
  viewer.executeCommand("clearSlices");
31
29
  viewer.executeCommand("clearOverlay");
@@ -33,7 +31,7 @@ export function resetView(viewer: Viewer): void {
33
31
  viewer.executeCommand("clearSelected");
34
32
  viewer.executeCommand("showAll");
35
33
  viewer.executeCommand("explode", 0);
36
- viewer.executeCommand("zoomToExtents", true);
34
+ viewer.executeCommand("zoomExtents");
37
35
 
38
36
  viewer.emit({ type: "resetview" });
39
37
  }
@@ -0,0 +1,36 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2026, Open Design Alliance (the "Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2026 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+
24
+ import type { Viewer } from "../Viewer";
25
+ import { toHandles } from "./ToHandles";
26
+
27
+ export function select(viewer: Viewer, handles: string | string[] = []): void {
28
+ handles = toHandles(viewer, handles);
29
+
30
+ viewer.show(handles);
31
+ viewer.selector.select(handles);
32
+
33
+ viewer.emitEvent({ type: "select" });
34
+ viewer.emitEvent({ type: "select2" }); // @deprecated
35
+ viewer.update();
36
+ }
@@ -21,28 +21,25 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
25
 
26
26
  export function selectModel(viewer: Viewer, handle: string): void {
27
- if (!viewer.visualizeJs) return;
27
+ let handles: string[] = [];
28
28
 
29
29
  const visViewer = viewer.visViewer();
30
- const activeView = visViewer.activeView;
31
30
 
32
31
  const modelItr = visViewer.getModelIterator();
33
- for (; !modelItr.done(); modelItr.step()) {
34
- const modelPtr = modelItr.getModel();
35
- if (modelPtr.getDatabaseHandle() === handle) {
36
- const selectionSet = activeView.selectCrossing([0, 9999, 9999, 0], modelPtr);
37
- visViewer.setSelected(selectionSet);
38
-
39
- viewer.update();
40
- viewer.emitEvent({ type: "select", handles: viewer.getSelected() });
41
- viewer.emitEvent({ type: "select2", handles: viewer.getSelected2() });
42
-
43
- selectionSet.delete();
32
+ while (!modelItr.done()) {
33
+ const model = modelItr.getModel();
34
+ if (model.getDatabaseHandle() === handle) {
35
+ const entityItr = model.getEntitiesIterator();
36
+ handles = viewer.models[0].getHandlesByEntityIterator(entityItr);
37
+ entityItr.delete();
44
38
  break;
45
39
  }
40
+ modelItr.step();
46
41
  }
47
42
  modelItr.delete();
43
+
44
+ viewer.setSelected(handles);
48
45
  }
@@ -21,27 +21,16 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
+ import { toHandles } from "./ToHandles";
25
26
 
26
- export function setSelected(viewer: Viewer, handles2: string[] = []): void {
27
- if (!viewer.visualizeJs) return;
27
+ export function setSelected(viewer: Viewer, handles: string | string[] = []): void {
28
+ handles = toHandles(viewer, handles);
28
29
 
29
- const handles = handles2.map((handle) => handle.slice(handle.indexOf(":") + 1));
30
-
31
- const visLib = viewer.visLib();
32
- const visViewer = viewer.visViewer();
33
-
34
- const selectionSet = new visLib.OdTvSelectionSet();
35
- handles.forEach((handle) => {
36
- const entityId = visViewer.getEntityByOriginalHandle(handle + "");
37
- if (!entityId.isNull()) selectionSet.appendEntity(entityId);
38
- });
39
-
40
- visViewer.setSelected(selectionSet);
30
+ viewer.show(handles);
31
+ viewer.selector.setSelected(handles);
41
32
 
33
+ viewer.emitEvent({ type: "select" });
34
+ viewer.emitEvent({ type: "select2" }); // @deprecated
42
35
  viewer.update();
43
- viewer.emitEvent({ type: "select", data: selectionSet, handles });
44
- viewer.emitEvent({ type: "select2", data: selectionSet, handles: handles2 });
45
-
46
- selectionSet.delete();
47
36
  }
@@ -21,19 +21,11 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
25
 
26
- export function setSelected2(viewer: Viewer, handles2: string[] = []): void {
27
- const handles: string[] = [];
28
-
29
- handles2.forEach((handle) => {
30
- if (!handle.includes(":")) {
31
- handles.push(handle);
32
- } else
33
- viewer.models.forEach((model) => {
34
- if (handle.split(":", 1)[0] === model.id + "") handles.push(handle);
35
- });
36
- });
37
-
38
- return viewer.executeCommand("setSelected", handles);
26
+ export function setSelected2(viewer: Viewer, handles2: string | string[] = []): void {
27
+ console.warn(
28
+ "setSelected2 command has been deprecated since 27.11 and will be removed in a future release, use setSelected instead"
29
+ );
30
+ return viewer.executeCommand("setSelected", handles2);
39
31
  }
@@ -0,0 +1,34 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2026, Open Design Alliance ("the Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2026 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+
24
+ import type { Viewer } from "../Viewer";
25
+ import { toHandles } from "./ToHandles";
26
+
27
+ export function show(viewer: Viewer, handles: string | string[]): void {
28
+ handles = toHandles(viewer, handles);
29
+
30
+ viewer.visibilityManager.show(handles);
31
+
32
+ viewer.emitEvent({ type: "show" });
33
+ viewer.update();
34
+ }
@@ -21,14 +21,11 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
25
 
26
26
  export function showAll(viewer: Viewer): void {
27
- if (!viewer.visualizeJs) return;
27
+ viewer.visibilityManager.showAll();
28
28
 
29
- const visViewer = viewer.visViewer();
30
- visViewer.unisolateSelectedObjects(false);
31
-
32
- viewer.update();
33
29
  viewer.emitEvent({ type: "showall" });
30
+ viewer.update();
34
31
  }
@@ -0,0 +1,35 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2026, Open Design Alliance ("the Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2026 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+
24
+ import type { Viewer } from "../Viewer";
25
+
26
+ export function toHandles(viewer: Viewer, handles2: string | string[]): string[] {
27
+ if (!Array.isArray(handles2)) handles2 = [handles2];
28
+
29
+ if (handles2.length === 0) return handles2;
30
+ if (!handles2[0].includes(":")) return handles2;
31
+
32
+ const handles = handles2.map((handle) => handle.slice(handle.indexOf(":") + 1));
33
+
34
+ return handles;
35
+ }
@@ -0,0 +1,36 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2026, Open Design Alliance ("the Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2026 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+
24
+ import type { Viewer } from "../Viewer";
25
+
26
+ export function toHandles2(viewer: Viewer, handles: string | string[]): string[] {
27
+ if (!Array.isArray(handles)) handles = [handles];
28
+
29
+ if (handles.length === 0) return handles;
30
+ if (handles[0].includes(":")) return handles;
31
+
32
+ const model = viewer.models[0];
33
+ const handles2 = handles.map((handle) => `${model.id}:${handle}`);
34
+
35
+ return handles2;
36
+ }
@@ -0,0 +1,40 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2026, Open Design Alliance (the "Alliance").
3
+ // All rights reserved.
4
+ //
5
+ // This software and its documentation and related materials are owned by
6
+ // the Alliance. The software may only be incorporated into application
7
+ // programs owned by members of the Alliance, subject to a signed
8
+ // Membership Agreement and Supplemental Software License Agreement with the
9
+ // Alliance. The structure and organization of this software are the valuable
10
+ // trade secrets of the Alliance and its suppliers. The software is also
11
+ // protected by copyright law and international treaty provisions. Application
12
+ // programs incorporating this software must include the following statement
13
+ // with their copyright notices:
14
+ //
15
+ // This application incorporates Open Design Alliance software pursuant to a
16
+ // license agreement with Open Design Alliance.
17
+ // Open Design Alliance Copyright (C) 2002-2026 by Open Design Alliance.
18
+ // All rights reserved.
19
+ //
20
+ // By use of this software, its documentation or related materials, you
21
+ // acknowledge and accept the above terms.
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+
24
+ import type { Viewer } from "../Viewer";
25
+ import { toHandles } from "./ToHandles";
26
+
27
+ export function toggleSelection(viewer: Viewer, handles: string | string[] = []): void {
28
+ handles = toHandles(viewer, handles);
29
+
30
+ if (viewer.selector.selected.has(handles[0])) {
31
+ viewer.selector.deselect(handles);
32
+ } else {
33
+ viewer.show(handles);
34
+ viewer.selector.select(handles);
35
+ }
36
+
37
+ viewer.emitEvent({ type: "select" });
38
+ viewer.emitEvent({ type: "select2" }); // @deprecated
39
+ viewer.update();
40
+ }
@@ -23,16 +23,10 @@
23
23
 
24
24
  import { Viewer } from "../Viewer";
25
25
 
26
- export function zoomToExtents(viewer: Viewer, force = false, animate = viewer.options.cameraAnimation): void {
27
- if (!viewer.visualizeJs) return;
28
-
26
+ export function zoomExtents(viewer: Viewer): void {
29
27
  const visViewer = viewer.visViewer();
30
- const saveEnableAmination = visViewer.getEnableAnimation();
31
28
 
32
- visViewer.setEnableAnimation(animate);
33
- visViewer.zoomExtents(force);
34
- visViewer.update();
35
- visViewer.setEnableAnimation(saveEnableAmination);
29
+ visViewer.zoomExtents(true);
36
30
 
37
31
  viewer.deviceAutoRegeneration();
38
32
  viewer.update();
@@ -21,25 +21,20 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
+ import { toHandles } from "./ToHandles";
25
26
 
26
- export function zoomToObjects(viewer: Viewer, handles: string[] = []): void {
27
- if (!viewer.visualizeJs) return;
27
+ export function zoomTo(viewer: Viewer, handles: string | string[] = []): void {
28
+ handles = toHandles(viewer, handles);
28
29
 
29
- const visLib = viewer.visLib();
30
30
  const visViewer = viewer.visViewer();
31
31
 
32
- const selectionSet = new visLib.OdTvSelectionSet();
33
- handles.forEach((handle) => {
34
- const entityId = visViewer.getEntityByOriginalHandle(handle + "");
35
- if (!entityId.isNull()) selectionSet.appendEntity(entityId);
36
- });
37
-
38
- visViewer.zoomToObjects?.(selectionSet);
32
+ const selectionSet = viewer.models[0].getSelectionSetByHandles(handles);
33
+ if (selectionSet.numItems() > 0) visViewer.zoomToObjects?.(selectionSet);
34
+ else visViewer.zoomExtents(false);
35
+ selectionSet.delete();
39
36
 
40
37
  viewer.deviceAutoRegeneration();
41
38
  viewer.update();
42
39
  viewer.emitEvent({ type: "zoom" });
43
-
44
- selectionSet.delete();
45
40
  }
@@ -21,17 +21,9 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Viewer } from "../Viewer";
24
+ import type { Viewer } from "../Viewer";
25
+ import { zoomTo } from "./ZoomTo";
25
26
 
26
27
  export function zoomToSelected(viewer: Viewer): void {
27
- if (!viewer.visualizeJs) return;
28
-
29
- const visViewer = viewer.visViewer();
30
-
31
- const selectionSet = visViewer.getSelected();
32
- visViewer.zoomToObjects?.(selectionSet);
33
-
34
- viewer.deviceAutoRegeneration();
35
- viewer.update();
36
- viewer.emitEvent({ type: "zoom" });
28
+ zoomTo(viewer, viewer.getSelected(false));
37
29
  }
@@ -27,26 +27,36 @@ import { applyModelTransform } from "./ApplyModelTransform";
27
27
  import { clearMarkup } from "./ClearMarkup";
28
28
  import { clearSelected } from "./ClearSelected";
29
29
  import { clearSlices } from "./ClearSlices";
30
- import { getSnapshot } from "./GetSnapshot";
30
+ import { deselect } from "./Deselect";
31
31
  import { explode, collect } from "./Explode";
32
32
  import { getDefaultViewPositions } from "./GetDefaultViewPositions";
33
+ import { getHidden } from "./GetHidden";
34
+ import { getIsolated } from "./GetIsolated";
33
35
  import { getModels } from "./GetModels";
34
36
  import { getSelected } from "./GetSelected";
35
37
  import { getSelected2 } from "./GetSelected2";
38
+ import { getSnapshot } from "./GetSnapshot";
39
+ import { hide } from "./Hide";
40
+ import { hideAll } from "./HideAll";
36
41
  import { hideSelected } from "./HideSelected";
42
+ import { isolate } from "./Isolate";
37
43
  import { isolateSelected } from "./IsolateSelected";
38
44
  import { regenerateAll } from "./RegenerateAll";
39
45
  import { resetView } from "./ResetView";
46
+ import { select } from "./Select";
40
47
  import { selectModel } from "./SelectModel";
41
48
  import { setActiveDragger } from "./SetActiveDragger";
42
49
  import { setDefaultViewPosition } from "./SetDefaultViewPosition";
43
50
  import { setMarkupColor } from "./SetMarkupColor";
44
51
  import { setSelected } from "./SetSelected";
45
52
  import { setSelected2 } from "./SetSelected2";
53
+ import { show } from "./Show";
46
54
  import { showAll } from "./ShowAll";
47
- import { zoomToExtents } from "./ZoomToExtents";
48
- import { zoomToObjects } from "./ZoomToObjects";
55
+ import { toggleSelection } from "./ToggleSelection";
56
+ import { zoomExtents } from "./ZoomExtents";
57
+ import { zoomTo } from "./ZoomTo";
49
58
  import { zoomToSelected } from "./ZoomToSelected";
59
+
50
60
  import { autoTransformAllModelsToCentralPoint } from "./AutoTransformAllModelsToCentralPoint";
51
61
 
52
62
  /**
@@ -83,27 +93,37 @@ commands.registerCommand("applyModelTransform", applyModelTransform);
83
93
  commands.registerCommand("clearMarkup", clearMarkup);
84
94
  commands.registerCommand("clearSelected", clearSelected);
85
95
  commands.registerCommand("clearSlices", clearSlices);
86
- commands.registerCommand("getSnapshot", getSnapshot);
87
- commands.registerCommand("explode", explode);
88
96
  commands.registerCommand("collect", collect);
97
+ commands.registerCommand("deselect", deselect);
98
+ commands.registerCommand("explode", explode);
99
+ commands.registerCommand("getSnapshot", getSnapshot);
89
100
  commands.registerCommand("getDefaultViewPositions", getDefaultViewPositions);
101
+ commands.registerCommand("getHidden", getHidden);
102
+ commands.registerCommand("getIsolated", getIsolated);
90
103
  commands.registerCommand("getModels", getModels);
91
104
  commands.registerCommand("getSelected", getSelected);
92
105
  commands.registerCommand("getSelected2", getSelected2);
106
+ commands.registerCommand("hide", hide);
107
+ commands.registerCommand("hideAll", hideAll);
93
108
  commands.registerCommand("hideSelected", hideSelected);
109
+ commands.registerCommand("isolate", isolate);
94
110
  commands.registerCommand("isolateSelected", isolateSelected);
95
111
  commands.registerCommand("regenerateAll", regenerateAll);
96
112
  commands.registerCommand("resetView", resetView);
113
+ commands.registerCommand("select", select);
97
114
  commands.registerCommand("selectModel", selectModel);
98
115
  commands.registerCommand("setActiveDragger", setActiveDragger);
99
116
  commands.registerCommand("setDefaultViewPosition", setDefaultViewPosition);
100
117
  commands.registerCommand("setMarkupColor", setMarkupColor);
101
118
  commands.registerCommand("setSelected", setSelected);
102
119
  commands.registerCommand("setSelected2", setSelected2);
120
+ commands.registerCommand("show", show);
103
121
  commands.registerCommand("showAll", showAll);
104
- commands.registerCommand("zoomToExtents", zoomToExtents);
105
- commands.registerCommand("zoomToObjects", zoomToObjects);
122
+ commands.registerCommand("toggleSelection", toggleSelection);
123
+ commands.registerCommand("zoomExtents", zoomExtents);
124
+ commands.registerCommand("zoomTo", zoomTo);
106
125
  commands.registerCommand("zoomToSelected", zoomToSelected);
126
+
107
127
  commands.registerCommand("autoTransformAllModelsToCentralPoint", autoTransformAllModelsToCentralPoint);
108
128
 
109
129
  commands.registerCommand("top", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
@@ -120,7 +140,8 @@ commands.registerCommand("nw", (viewer) => setDefaultViewPosition(viewer, "k3DVi
120
140
  commands.registerCommandAlias("clearMarkup", "clearOverlay");
121
141
  commands.registerCommandAlias("clearSelected", "unselect");
122
142
  commands.registerCommandAlias("getSnapshot", "createPreview");
123
- commands.registerCommandAlias("zoomToExtents", "zoomExtents");
143
+ commands.registerCommandAlias("zoomExtents", "zoomToExtents");
144
+ commands.registerCommandAlias("zoomTo", "zoomToObjects");
124
145
 
125
146
  commands.registerCommandAlias("top", "k3DViewTop");
126
147
  commands.registerCommandAlias("bottom", "k3DViewBottom");
@@ -63,7 +63,7 @@ import { ResetComponent } from "./ResetComponent";
63
63
  * }
64
64
  *
65
65
  * onGeometryEnd = (event: MouseEvent) => {
66
- * this.viewer.executeCommand("zoomToExtents");
66
+ * this.viewer.zoomExtents();
67
67
  * };
68
68
  *
69
69
  * }