@inweb/viewer-visualize 25.3.13

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 (164) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +63 -0
  3. package/dist/viewer-visualize.js +16982 -0
  4. package/dist/viewer-visualize.js.map +1 -0
  5. package/dist/viewer-visualize.min.js +1 -0
  6. package/dist/viewer-visualize.module.js +5267 -0
  7. package/dist/viewer-visualize.module.js.map +1 -0
  8. package/lib/Viewer/Commands/ApplyModelTransform.d.ts +1 -0
  9. package/lib/Viewer/Commands/ClearMarkup.d.ts +1 -0
  10. package/lib/Viewer/Commands/ClearSlices.d.ts +1 -0
  11. package/lib/Viewer/Commands/CreatePreview.d.ts +1 -0
  12. package/lib/Viewer/Commands/Explode.d.ts +1 -0
  13. package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +1 -0
  14. package/lib/Viewer/Commands/GetModels.d.ts +1 -0
  15. package/lib/Viewer/Commands/GetSelected.d.ts +1 -0
  16. package/lib/Viewer/Commands/HideSelected.d.ts +1 -0
  17. package/lib/Viewer/Commands/IsolateSelected.d.ts +1 -0
  18. package/lib/Viewer/Commands/RegenerateAll.d.ts +1 -0
  19. package/lib/Viewer/Commands/ResetView.d.ts +1 -0
  20. package/lib/Viewer/Commands/SelectModel.d.ts +1 -0
  21. package/lib/Viewer/Commands/SetActiveDragger.d.ts +1 -0
  22. package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +1 -0
  23. package/lib/Viewer/Commands/SetMarkupColor.d.ts +1 -0
  24. package/lib/Viewer/Commands/SetSelected.d.ts +1 -0
  25. package/lib/Viewer/Commands/ShowAll.d.ts +1 -0
  26. package/lib/Viewer/Commands/Unselect.d.ts +1 -0
  27. package/lib/Viewer/Commands/ZoomToExtents.d.ts +1 -0
  28. package/lib/Viewer/Commands/ZoomToObjects.d.ts +1 -0
  29. package/lib/Viewer/Commands/ZoomToSelected.d.ts +1 -0
  30. package/lib/Viewer/Commands/index.d.ts +22 -0
  31. package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +21 -0
  32. package/lib/Viewer/Draggers/Actions/PanAction.d.ts +17 -0
  33. package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +7 -0
  34. package/lib/Viewer/Draggers/Common/Geometry.d.ts +114 -0
  35. package/lib/Viewer/Draggers/Common/GestureManager.d.ts +40 -0
  36. package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +53 -0
  37. package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +29 -0
  38. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +30 -0
  39. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +19 -0
  40. package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +23 -0
  41. package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +26 -0
  42. package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +7 -0
  43. package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +7 -0
  44. package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +7 -0
  45. package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +14 -0
  46. package/lib/Viewer/Draggers/OdPanDragger.d.ts +11 -0
  47. package/lib/Viewer/Draggers/OdZoomDragger.d.ts +11 -0
  48. package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +10 -0
  49. package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +18 -0
  50. package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +13 -0
  51. package/lib/Viewer/Draggers/OdaLineDragger.d.ts +14 -0
  52. package/lib/Viewer/Draggers/OdaTextDragger.d.ts +15 -0
  53. package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +29 -0
  54. package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +18 -0
  55. package/lib/Viewer/Loaders/BaseLoader.d.ts +10 -0
  56. package/lib/Viewer/Loaders/LoaderFactory.d.ts +10 -0
  57. package/lib/Viewer/Loaders/TCSLoader.d.ts +4 -0
  58. package/lib/Viewer/Loaders/UpdaterController.d.ts +14 -0
  59. package/lib/Viewer/Loaders/VsfXLoader.d.ts +4 -0
  60. package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +4 -0
  61. package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +4 -0
  62. package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +21 -0
  63. package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +14 -0
  64. package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +4 -0
  65. package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +14 -0
  66. package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +14 -0
  67. package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +12 -0
  68. package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +11 -0
  69. package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +14 -0
  70. package/lib/Viewer/Markup/Api/IMarkupText.d.ts +12 -0
  71. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +46 -0
  72. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaCloud.d.ts +35 -0
  73. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +40 -0
  74. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +36 -0
  75. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +36 -0
  76. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +38 -0
  77. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +37 -0
  78. package/lib/Viewer/Markup/IMarkup.d.ts +39 -0
  79. package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +70 -0
  80. package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +18 -0
  81. package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +33 -0
  82. package/lib/Viewer/Markup/MarkupFactory.d.ts +6 -0
  83. package/lib/Viewer/Viewer.d.ts +346 -0
  84. package/lib/Viewer/utils.d.ts +3 -0
  85. package/lib/index.d.ts +3 -0
  86. package/package.json +44 -0
  87. package/src/Viewer/Commands/ApplyModelTransform.ts +69 -0
  88. package/src/Viewer/Commands/ClearMarkup.ts +28 -0
  89. package/src/Viewer/Commands/ClearSlices.ts +27 -0
  90. package/src/Viewer/Commands/CreatePreview.ts +33 -0
  91. package/src/Viewer/Commands/Explode.ts +38 -0
  92. package/src/Viewer/Commands/GetDefaultViewPositions.ts +36 -0
  93. package/src/Viewer/Commands/GetModels.ts +43 -0
  94. package/src/Viewer/Commands/GetSelected.ts +58 -0
  95. package/src/Viewer/Commands/HideSelected.ts +37 -0
  96. package/src/Viewer/Commands/IsolateSelected.ts +37 -0
  97. package/src/Viewer/Commands/RegenerateAll.ts +37 -0
  98. package/src/Viewer/Commands/ResetView.ts +43 -0
  99. package/src/Viewer/Commands/SelectModel.ts +52 -0
  100. package/src/Viewer/Commands/SetActiveDragger.ts +29 -0
  101. package/src/Viewer/Commands/SetDefaultViewPosition.ts +50 -0
  102. package/src/Viewer/Commands/SetMarkupColor.ts +29 -0
  103. package/src/Viewer/Commands/SetSelected.ts +47 -0
  104. package/src/Viewer/Commands/ShowAll.ts +37 -0
  105. package/src/Viewer/Commands/Unselect.ts +37 -0
  106. package/src/Viewer/Commands/ZoomToExtents.ts +43 -0
  107. package/src/Viewer/Commands/ZoomToObjects.ts +47 -0
  108. package/src/Viewer/Commands/ZoomToSelected.ts +39 -0
  109. package/src/Viewer/Commands/index.ts +45 -0
  110. package/src/Viewer/Draggers/Actions/OrbitAction.ts +250 -0
  111. package/src/Viewer/Draggers/Actions/PanAction.ts +102 -0
  112. package/src/Viewer/Draggers/Actions/ZoomAction.ts +45 -0
  113. package/src/Viewer/Draggers/Common/Geometry.ts +152 -0
  114. package/src/Viewer/Draggers/Common/GestureManager.ts +263 -0
  115. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +270 -0
  116. package/src/Viewer/Draggers/Common/OdaGeAction.ts +146 -0
  117. package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +248 -0
  118. package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +182 -0
  119. package/src/Viewer/Draggers/MeasureLineDragger/index.ts +166 -0
  120. package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +182 -0
  121. package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +53 -0
  122. package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +53 -0
  123. package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +53 -0
  124. package/src/Viewer/Draggers/OdOrbitDragger.ts +70 -0
  125. package/src/Viewer/Draggers/OdPanDragger.ts +62 -0
  126. package/src/Viewer/Draggers/OdZoomDragger.ts +59 -0
  127. package/src/Viewer/Draggers/OdZoomWheelDragger.ts +103 -0
  128. package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +123 -0
  129. package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +75 -0
  130. package/src/Viewer/Draggers/OdaLineDragger.ts +80 -0
  131. package/src/Viewer/Draggers/OdaTextDragger.ts +118 -0
  132. package/src/Viewer/Draggers/OdaWalkDragger.ts +278 -0
  133. package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +184 -0
  134. package/src/Viewer/Loaders/BaseLoader.ts +40 -0
  135. package/src/Viewer/Loaders/LoaderFactory.ts +48 -0
  136. package/src/Viewer/Loaders/TCSLoader.ts +82 -0
  137. package/src/Viewer/Loaders/UpdaterController.ts +36 -0
  138. package/src/Viewer/Loaders/VsfXLoader.ts +65 -0
  139. package/src/Viewer/Loaders/VsfXPartialLoader.ts +208 -0
  140. package/src/Viewer/Loaders/VsfXStreamingLoader.ts +87 -0
  141. package/src/Viewer/Markup/Api/IMarkupArrow.ts +12 -0
  142. package/src/Viewer/Markup/Api/IMarkupCloud.ts +15 -0
  143. package/src/Viewer/Markup/Api/IMarkupColorable.ts +4 -0
  144. package/src/Viewer/Markup/Api/IMarkupEllipse.ts +15 -0
  145. package/src/Viewer/Markup/Api/IMarkupImage.ts +15 -0
  146. package/src/Viewer/Markup/Api/IMarkupLine.ts +13 -0
  147. package/src/Viewer/Markup/Api/IMarkupObject.ts +15 -0
  148. package/src/Viewer/Markup/Api/IMarkupRectangle.ts +15 -0
  149. package/src/Viewer/Markup/Api/IMarkupText.ts +12 -0
  150. package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +117 -0
  151. package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +208 -0
  152. package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +118 -0
  153. package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +123 -0
  154. package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +131 -0
  155. package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +119 -0
  156. package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +110 -0
  157. package/src/Viewer/Markup/IMarkup.ts +42 -0
  158. package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +1144 -0
  159. package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +39 -0
  160. package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +229 -0
  161. package/src/Viewer/Markup/MarkupFactory.ts +32 -0
  162. package/src/Viewer/Viewer.ts +1183 -0
  163. package/src/Viewer/utils.ts +74 -0
  164. package/src/index.ts +26 -0
@@ -0,0 +1,36 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function getDefaultViewPositions(viewer: Viewer): string[] {
28
+ if (!viewer.visualizeJs) return [];
29
+
30
+ const visLib = viewer.visLib();
31
+
32
+ const defViewPos = visLib.DefaultViewPosition;
33
+ return Object.keys(defViewPos).filter((x) => x !== "values");
34
+ }
35
+
36
+ commands("VisualizeJS").registerCommand("getDefaultViewPositions", getDefaultViewPositions);
@@ -0,0 +1,43 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function getModels(viewer: Viewer): string[] {
28
+ if (!viewer.visualizeJs) return [];
29
+
30
+ const visViewer = viewer.visViewer();
31
+
32
+ const handles: string[] = [];
33
+ const modelItr = visViewer.getModelIterator();
34
+ for (; !modelItr.done(); modelItr.step()) {
35
+ const modelPtr = modelItr.getModel();
36
+ if (modelPtr.getName()[0] !== "$") handles.push(modelPtr.getDatabaseHandle());
37
+ }
38
+ modelItr.delete();
39
+
40
+ return handles;
41
+ }
42
+
43
+ commands("VisualizeJS").registerCommand("getModels", getModels);
@@ -0,0 +1,58 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function getSelected(viewer: Viewer): string[] {
28
+ if (!viewer.visualizeJs) return [];
29
+
30
+ const visViewer = viewer.visViewer();
31
+
32
+ const handles: string[] = [];
33
+ const selectionSet = visViewer.getSelected();
34
+ if (!selectionSet.isNull() && selectionSet.numItems() !== 0) {
35
+ const itr = selectionSet.getIterator();
36
+ for (; !itr.done(); itr.step()) {
37
+ const entityId = itr.getEntity();
38
+
39
+ const entityPtr =
40
+ entityId.getType() === 1
41
+ ? entityId.openObject()
42
+ : entityId.getType() === 2
43
+ ? entityId.openObjectAsInsert()
44
+ : null;
45
+
46
+ if (entityPtr) {
47
+ const handle = entityPtr.getNativeDatabaseHandle();
48
+ if (handle !== "-1") handles.push(handle);
49
+ entityPtr.delete();
50
+ }
51
+ }
52
+ itr.delete();
53
+ }
54
+
55
+ return handles;
56
+ }
57
+
58
+ commands("VisualizeJS").registerCommand("getSelected", getSelected);
@@ -0,0 +1,37 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function hideSelected(viewer: Viewer): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visViewer = viewer.visViewer();
31
+ visViewer.hideSelectedObjects(false);
32
+
33
+ viewer.update();
34
+ viewer.emit({ type: "hide" });
35
+ }
36
+
37
+ commands("VisualizeJS").registerCommand("hideSelected", hideSelected);
@@ -0,0 +1,37 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function isolateSelected(viewer: Viewer): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visViewer = viewer.visViewer();
31
+ visViewer.isolateSelectedObjects(false);
32
+
33
+ viewer.update();
34
+ viewer.emit({ type: "isolate" });
35
+ }
36
+
37
+ commands("VisualizeJS").registerCommand("isolateSelected", isolateSelected);
@@ -0,0 +1,37 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function regenerateAll(viewer: Viewer): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visViewer = viewer.visViewer();
31
+ visViewer.regenAll();
32
+
33
+ viewer.update();
34
+ viewer.emit({ type: "regenerateall" });
35
+ }
36
+
37
+ commands("VisualizeJS").registerCommand("regenerateAll", regenerateAll);
@@ -0,0 +1,43 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function resetView(viewer: Viewer): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ viewer.executeCommand("setActiveDragger", "");
31
+ viewer.executeCommand("clearSlices");
32
+ viewer.executeCommand("clearOverlay");
33
+ viewer.executeCommand("setMarkupColor");
34
+ viewer.executeCommand("unselect");
35
+ viewer.executeCommand("showAll");
36
+ viewer.executeCommand("explode", 0);
37
+ viewer.executeCommand("zoomToExtents", true);
38
+ viewer.executeCommand("k3DViewSW");
39
+
40
+ viewer.emit({ type: "resetview" });
41
+ }
42
+
43
+ commands("VisualizeJS").registerCommand("resetView", resetView);
@@ -0,0 +1,52 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function selectModel(viewer: Viewer, handle: string): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visViewer = viewer.visViewer();
31
+ const activeView = visViewer.activeView;
32
+
33
+ const modelItr = visViewer.getModelIterator();
34
+ for (; !modelItr.done(); modelItr.step()) {
35
+ const modelPtr = modelItr.getModel();
36
+ if (modelPtr.getDatabaseHandle() === handle) {
37
+ const selectionSet = activeView.selectCrossing([0, 9999, 9999, 0], modelPtr);
38
+
39
+ visViewer.setSelected(selectionSet);
40
+ const handles = viewer.getSelected();
41
+
42
+ viewer.update();
43
+ viewer.emitEvent({ type: "select", data: selectionSet, handles });
44
+
45
+ selectionSet.delete();
46
+ break;
47
+ }
48
+ }
49
+ modelItr.delete();
50
+ }
51
+
52
+ commands("VisualizeJS").registerCommand("selectModel", selectModel);
@@ -0,0 +1,29 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ commands("VisualizeJS").registerCommand("setActiveDragger", (viewer: Viewer, dragger = "") => {
28
+ viewer.setActiveDragger(dragger);
29
+ });
@@ -0,0 +1,50 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function setDefaultViewPosition(viewer: Viewer, position = ""): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visLib = viewer.visLib();
31
+ const visViewer = viewer.visViewer();
32
+
33
+ const defViewPos = visLib.DefaultViewPosition;
34
+ visViewer.setDefaultViewPositionWithAnimation(defViewPos[position]);
35
+
36
+ viewer.update();
37
+ viewer.emit({ type: "viewposition", data: position });
38
+ }
39
+
40
+ commands("VisualizeJS").registerCommand("setDefaultViewPosition", setDefaultViewPosition);
41
+ commands("VisualizeJS").registerCommand("k3DViewTop", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
42
+ commands("VisualizeJS").registerCommand("k3DViewBottom", (viewer) => setDefaultViewPosition(viewer, "k3DViewBottom"));
43
+ commands("VisualizeJS").registerCommand("k3DViewLeft", (viewer) => setDefaultViewPosition(viewer, "k3DViewLeft"));
44
+ commands("VisualizeJS").registerCommand("k3DViewRight", (viewer) => setDefaultViewPosition(viewer, "k3DViewRight"));
45
+ commands("VisualizeJS").registerCommand("k3DViewFront", (viewer) => setDefaultViewPosition(viewer, "k3DViewFront"));
46
+ commands("VisualizeJS").registerCommand("k3DViewBack", (viewer) => setDefaultViewPosition(viewer, "k3DViewBack"));
47
+ commands("VisualizeJS").registerCommand("k3DViewSE", (viewer) => setDefaultViewPosition(viewer, "k3DViewSE"));
48
+ commands("VisualizeJS").registerCommand("k3DViewSW", (viewer) => setDefaultViewPosition(viewer, "k3DViewSW"));
49
+ commands("VisualizeJS").registerCommand("k3DViewNE", (viewer) => setDefaultViewPosition(viewer, "k3DViewNE"));
50
+ commands("VisualizeJS").registerCommand("k3DViewNW", (viewer) => setDefaultViewPosition(viewer, "k3DViewNW"));
@@ -0,0 +1,29 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ commands("VisualizeJS").registerCommand("setMarkupColor", (viewer: Viewer, r = 255, g = 0, b = 0) => {
28
+ viewer.setMarkupColor(r, g, b);
29
+ });
@@ -0,0 +1,47 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function setSelected(viewer: Viewer, handles: string[] = []): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visLib = viewer.visLib();
31
+ const visViewer = visLib.getViewer();
32
+
33
+ const selectionSet = new visLib.OdTvSelectionSet();
34
+ handles?.forEach((handle) => {
35
+ const entityId = visViewer.getEntityByOriginalHandle(handle + "");
36
+ if (!entityId.isNull()) selectionSet.appendEntity(entityId);
37
+ });
38
+
39
+ visViewer.setSelected(selectionSet);
40
+
41
+ viewer.update();
42
+ viewer.emitEvent({ type: "select", data: selectionSet, handles });
43
+
44
+ selectionSet.delete();
45
+ }
46
+
47
+ commands("VisualizeJS").registerCommand("setSelected", setSelected);
@@ -0,0 +1,37 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function showAll(viewer: Viewer): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visViewer = viewer.visViewer();
31
+ visViewer.unisolateSelectedObjects(false);
32
+
33
+ viewer.update();
34
+ viewer.emit({ type: "showall" });
35
+ }
36
+
37
+ commands("VisualizeJS").registerCommand("showAll", showAll);
@@ -0,0 +1,37 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function unselect(viewer: Viewer): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visViewer = viewer.visViewer();
31
+ visViewer.unselect();
32
+
33
+ viewer.update();
34
+ viewer.emitEvent({ type: "select", data: visViewer.getSelected(), handles: [] });
35
+ }
36
+
37
+ commands("VisualizeJS").registerCommand("unselect", unselect);
@@ -0,0 +1,43 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2002-2023, 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-2021 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 { commands } from "@inweb/viewer-core";
25
+ import { Viewer } from "../Viewer";
26
+
27
+ function zoomToExtents(viewer: Viewer, force = false, animate = viewer.options.cameraAnimation): void {
28
+ if (!viewer.visualizeJs) return;
29
+
30
+ const visViewer = viewer.visViewer();
31
+ const saveEnableAmination = visViewer.getEnableAnimation();
32
+
33
+ visViewer.setEnableAnimation(animate);
34
+ visViewer.zoomExtents(force);
35
+ visViewer.update();
36
+ visViewer.setEnableAnimation(saveEnableAmination);
37
+
38
+ viewer.update();
39
+ viewer.emitEvent({ type: "zoom" });
40
+ }
41
+
42
+ commands("VisualizeJS").registerCommand("zoomToExtents", zoomToExtents);
43
+ commands("VisualizeJS").registerCommandAlias("zoomToExtents", "zoomExtents");