@inweb/client 25.3.11 → 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 (206) hide show
  1. package/README.md +17 -35
  2. package/dist/client.js +33 -17365
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.min.js +1 -1
  5. package/dist/client.module.js +9 -5552
  6. package/dist/client.module.js.map +1 -1
  7. package/lib/Api/Assembly.d.ts +0 -1
  8. package/lib/Api/ClashTest.d.ts +0 -1
  9. package/lib/Api/Client.d.ts +1 -2
  10. package/lib/Api/ClientEvents.d.ts +0 -1
  11. package/lib/Api/File.d.ts +0 -1
  12. package/lib/Api/HttpClient.d.ts +0 -1
  13. package/lib/Api/IAssembly.d.ts +0 -1
  14. package/lib/Api/IFile.d.ts +0 -1
  15. package/lib/Api/IHttpClient.d.ts +0 -1
  16. package/lib/Api/IUser.d.ts +0 -1
  17. package/lib/Api/Job.d.ts +0 -1
  18. package/lib/Api/Member.d.ts +0 -1
  19. package/lib/Api/Model.d.ts +13 -1
  20. package/lib/Api/Permission.d.ts +0 -1
  21. package/lib/Api/Project.d.ts +0 -1
  22. package/lib/Api/Role.d.ts +0 -1
  23. package/lib/Api/User.d.ts +0 -1
  24. package/lib/Api/impl/FetchError.d.ts +0 -1
  25. package/lib/Api/impl/Utils.d.ts +0 -1
  26. package/lib/Api/impl/http.d.ts +0 -1
  27. package/lib/ConvetMath.d.ts +0 -1
  28. package/lib/index.d.ts +1 -13
  29. package/package.json +5 -11
  30. package/src/Api/Client.ts +2 -1
  31. package/src/Api/Model.ts +19 -0
  32. package/src/index.ts +1 -13
  33. package/lib/Viewer/CanvasEvents.d.ts +0 -2
  34. package/lib/Viewer/Commands/ApplyModelTransform.d.ts +0 -2
  35. package/lib/Viewer/Commands/ClearMarkup.d.ts +0 -2
  36. package/lib/Viewer/Commands/ClearSlices.d.ts +0 -2
  37. package/lib/Viewer/Commands/CreatePreview.d.ts +0 -2
  38. package/lib/Viewer/Commands/Explode.d.ts +0 -2
  39. package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +0 -2
  40. package/lib/Viewer/Commands/GetModels.d.ts +0 -2
  41. package/lib/Viewer/Commands/GetSelected.d.ts +0 -2
  42. package/lib/Viewer/Commands/HideSelected.d.ts +0 -2
  43. package/lib/Viewer/Commands/IsolateSelected.d.ts +0 -2
  44. package/lib/Viewer/Commands/RegenerateAll.d.ts +0 -2
  45. package/lib/Viewer/Commands/ResetView.d.ts +0 -2
  46. package/lib/Viewer/Commands/SelectModel.d.ts +0 -2
  47. package/lib/Viewer/Commands/SetActiveDragger.d.ts +0 -2
  48. package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +0 -2
  49. package/lib/Viewer/Commands/SetMarkupColor.d.ts +0 -2
  50. package/lib/Viewer/Commands/SetSelected.d.ts +0 -2
  51. package/lib/Viewer/Commands/ShowAll.d.ts +0 -2
  52. package/lib/Viewer/Commands/Unselect.d.ts +0 -2
  53. package/lib/Viewer/Commands/ZoomToExtents.d.ts +0 -2
  54. package/lib/Viewer/Commands/ZoomToObjects.d.ts +0 -2
  55. package/lib/Viewer/Commands/ZoomToSelected.d.ts +0 -2
  56. package/lib/Viewer/Commands.d.ts +0 -3
  57. package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +0 -22
  58. package/lib/Viewer/Draggers/Actions/PanAction.d.ts +0 -18
  59. package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +0 -8
  60. package/lib/Viewer/Draggers/Common/Geometry.d.ts +0 -115
  61. package/lib/Viewer/Draggers/Common/GestureManager.d.ts +0 -41
  62. package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +0 -54
  63. package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +0 -30
  64. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +0 -31
  65. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +0 -20
  66. package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +0 -24
  67. package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +0 -27
  68. package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +0 -8
  69. package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +0 -8
  70. package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +0 -8
  71. package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +0 -15
  72. package/lib/Viewer/Draggers/OdPanDragger.d.ts +0 -12
  73. package/lib/Viewer/Draggers/OdZoomDragger.d.ts +0 -12
  74. package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +0 -11
  75. package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +0 -19
  76. package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +0 -14
  77. package/lib/Viewer/Draggers/OdaLineDragger.d.ts +0 -15
  78. package/lib/Viewer/Draggers/OdaTextDragger.d.ts +0 -16
  79. package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +0 -30
  80. package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +0 -19
  81. package/lib/Viewer/EventEmitter2.d.ts +0 -54
  82. package/lib/Viewer/ICommands.d.ts +0 -25
  83. package/lib/Viewer/IEventEmitter2.d.ts +0 -13
  84. package/lib/Viewer/IViewer.d.ts +0 -30
  85. package/lib/Viewer/Loaders/BaseLoader.d.ts +0 -11
  86. package/lib/Viewer/Loaders/LoaderFactory.d.ts +0 -11
  87. package/lib/Viewer/Loaders/TCSLoader.d.ts +0 -5
  88. package/lib/Viewer/Loaders/UpdaterController.d.ts +0 -15
  89. package/lib/Viewer/Loaders/VsfXLoader.d.ts +0 -5
  90. package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +0 -5
  91. package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +0 -5
  92. package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +0 -22
  93. package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +0 -15
  94. package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +0 -5
  95. package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +0 -15
  96. package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +0 -15
  97. package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +0 -13
  98. package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +0 -12
  99. package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +0 -15
  100. package/lib/Viewer/Markup/Api/IMarkupText.d.ts +0 -13
  101. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +0 -47
  102. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaCloud.d.ts +0 -36
  103. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +0 -41
  104. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +0 -37
  105. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +0 -37
  106. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +0 -39
  107. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +0 -38
  108. package/lib/Viewer/Markup/IMarkup.d.ts +0 -40
  109. package/lib/Viewer/Markup/IViewpoint.d.ts +0 -129
  110. package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +0 -72
  111. package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +0 -19
  112. package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +0 -34
  113. package/lib/Viewer/Markup/MarkupFactory.d.ts +0 -7
  114. package/lib/Viewer/Options.d.ts +0 -239
  115. package/lib/Viewer/OptionsEvents.d.ts +0 -26
  116. package/lib/Viewer/Viewer.d.ts +0 -354
  117. package/lib/Viewer/ViewerCommands.d.ts +0 -23
  118. package/lib/Viewer/ViewerEvents.d.ts +0 -601
  119. package/lib/Viewer/utils.d.ts +0 -4
  120. package/src/Viewer/CanvasEvents.ts +0 -41
  121. package/src/Viewer/Commands/ApplyModelTransform.ts +0 -70
  122. package/src/Viewer/Commands/ClearMarkup.ts +0 -28
  123. package/src/Viewer/Commands/ClearSlices.ts +0 -27
  124. package/src/Viewer/Commands/CreatePreview.ts +0 -33
  125. package/src/Viewer/Commands/Explode.ts +0 -38
  126. package/src/Viewer/Commands/GetDefaultViewPositions.ts +0 -36
  127. package/src/Viewer/Commands/GetModels.ts +0 -43
  128. package/src/Viewer/Commands/GetSelected.ts +0 -58
  129. package/src/Viewer/Commands/HideSelected.ts +0 -37
  130. package/src/Viewer/Commands/IsolateSelected.ts +0 -37
  131. package/src/Viewer/Commands/RegenerateAll.ts +0 -37
  132. package/src/Viewer/Commands/ResetView.ts +0 -43
  133. package/src/Viewer/Commands/SelectModel.ts +0 -52
  134. package/src/Viewer/Commands/SetActiveDragger.ts +0 -29
  135. package/src/Viewer/Commands/SetDefaultViewPosition.ts +0 -50
  136. package/src/Viewer/Commands/SetMarkupColor.ts +0 -29
  137. package/src/Viewer/Commands/SetSelected.ts +0 -47
  138. package/src/Viewer/Commands/ShowAll.ts +0 -37
  139. package/src/Viewer/Commands/Unselect.ts +0 -37
  140. package/src/Viewer/Commands/ZoomToExtents.ts +0 -43
  141. package/src/Viewer/Commands/ZoomToObjects.ts +0 -47
  142. package/src/Viewer/Commands/ZoomToSelected.ts +0 -39
  143. package/src/Viewer/Commands.ts +0 -81
  144. package/src/Viewer/Draggers/Actions/OrbitAction.ts +0 -250
  145. package/src/Viewer/Draggers/Actions/PanAction.ts +0 -102
  146. package/src/Viewer/Draggers/Actions/ZoomAction.ts +0 -45
  147. package/src/Viewer/Draggers/Common/Geometry.ts +0 -152
  148. package/src/Viewer/Draggers/Common/GestureManager.ts +0 -263
  149. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +0 -270
  150. package/src/Viewer/Draggers/Common/OdaGeAction.ts +0 -146
  151. package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +0 -248
  152. package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +0 -182
  153. package/src/Viewer/Draggers/MeasureLineDragger/index.ts +0 -166
  154. package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +0 -182
  155. package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +0 -53
  156. package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +0 -53
  157. package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +0 -53
  158. package/src/Viewer/Draggers/OdOrbitDragger.ts +0 -70
  159. package/src/Viewer/Draggers/OdPanDragger.ts +0 -62
  160. package/src/Viewer/Draggers/OdZoomDragger.ts +0 -59
  161. package/src/Viewer/Draggers/OdZoomWheelDragger.ts +0 -103
  162. package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +0 -123
  163. package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +0 -75
  164. package/src/Viewer/Draggers/OdaLineDragger.ts +0 -80
  165. package/src/Viewer/Draggers/OdaTextDragger.ts +0 -118
  166. package/src/Viewer/Draggers/OdaWalkDragger.ts +0 -278
  167. package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +0 -184
  168. package/src/Viewer/EventEmitter2.ts +0 -116
  169. package/src/Viewer/ICommands.ts +0 -53
  170. package/src/Viewer/IEventEmitter2.ts +0 -36
  171. package/src/Viewer/IViewer.ts +0 -59
  172. package/src/Viewer/Loaders/BaseLoader.ts +0 -40
  173. package/src/Viewer/Loaders/LoaderFactory.ts +0 -47
  174. package/src/Viewer/Loaders/TCSLoader.ts +0 -82
  175. package/src/Viewer/Loaders/UpdaterController.ts +0 -36
  176. package/src/Viewer/Loaders/VsfXLoader.ts +0 -65
  177. package/src/Viewer/Loaders/VsfXPartialLoader.ts +0 -208
  178. package/src/Viewer/Loaders/VsfXStreamingLoader.ts +0 -87
  179. package/src/Viewer/Markup/Api/IMarkupArrow.ts +0 -12
  180. package/src/Viewer/Markup/Api/IMarkupCloud.ts +0 -15
  181. package/src/Viewer/Markup/Api/IMarkupColorable.ts +0 -4
  182. package/src/Viewer/Markup/Api/IMarkupEllipse.ts +0 -15
  183. package/src/Viewer/Markup/Api/IMarkupImage.ts +0 -15
  184. package/src/Viewer/Markup/Api/IMarkupLine.ts +0 -13
  185. package/src/Viewer/Markup/Api/IMarkupObject.ts +0 -15
  186. package/src/Viewer/Markup/Api/IMarkupRectangle.ts +0 -15
  187. package/src/Viewer/Markup/Api/IMarkupText.ts +0 -12
  188. package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +0 -117
  189. package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +0 -208
  190. package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +0 -118
  191. package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +0 -123
  192. package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +0 -131
  193. package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +0 -119
  194. package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +0 -110
  195. package/src/Viewer/Markup/IMarkup.ts +0 -41
  196. package/src/Viewer/Markup/IViewpoint.ts +0 -146
  197. package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +0 -1144
  198. package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +0 -39
  199. package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +0 -228
  200. package/src/Viewer/Markup/MarkupFactory.ts +0 -32
  201. package/src/Viewer/Options.ts +0 -527
  202. package/src/Viewer/OptionsEvents.ts +0 -28
  203. package/src/Viewer/Viewer.ts +0 -1180
  204. package/src/Viewer/ViewerCommands.ts +0 -45
  205. package/src/Viewer/ViewerEvents.ts +0 -700
  206. package/src/Viewer/utils.ts +0 -74
@@ -1,47 +0,0 @@
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 { Viewer } from "../Viewer";
25
- import { commands } from "../Commands";
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);
@@ -1,37 +0,0 @@
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 { Viewer } from "../Viewer";
25
- import { commands } from "../Commands";
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);
@@ -1,37 +0,0 @@
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 { Viewer } from "../Viewer";
25
- import { commands } from "../Commands";
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);
@@ -1,43 +0,0 @@
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 { Viewer } from "../Viewer";
25
- import { commands } from "../Commands";
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");
@@ -1,47 +0,0 @@
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 { Viewer } from "../Viewer";
25
- import { commands } from "../Commands";
26
-
27
- function zoomToObjects(viewer: Viewer, handles: string[] = []): void {
28
- if (!viewer.visualizeJs) return;
29
-
30
- const visLib = viewer.visLib();
31
- const visViewer = viewer.visViewer();
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.zoomToObjects?.(selectionSet);
40
-
41
- viewer.update();
42
- viewer.emitEvent({ type: "zoom" });
43
-
44
- selectionSet.delete();
45
- }
46
-
47
- commands("VisualizeJS").registerCommand("zoomToObjects", zoomToObjects);
@@ -1,39 +0,0 @@
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 { Viewer } from "../Viewer";
25
- import { commands } from "../Commands";
26
-
27
- function zoomToSelected(viewer: Viewer): void {
28
- if (!viewer.visualizeJs) return;
29
-
30
- const visViewer = viewer.visViewer();
31
-
32
- const selectionSet = visViewer.getSelected();
33
- visViewer.zoomToObjects?.(selectionSet);
34
-
35
- viewer.update();
36
- viewer.emitEvent({ type: "zoom" });
37
- }
38
-
39
- commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
@@ -1,81 +0,0 @@
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 { IViewer } from "./IViewer";
25
- import { ICommand, ICommandHandler, ICommandDescription, ICommandsMap, ICommands } from "./ICommands";
26
-
27
- class Commands implements ICommands {
28
- private readonly _commands = new Map<string, ICommand>();
29
-
30
- registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void {
31
- this._commands.set(id, { id, handler, thisArg, description });
32
- }
33
-
34
- registerCommandAlias(id: string, alias: string): void {
35
- this.registerCommand(alias, (viewer: IViewer, ...args) => this.executeCommand(id, viewer, ...args));
36
- }
37
-
38
- getCommand(id: string): ICommand | undefined {
39
- return this._commands.get(id);
40
- }
41
-
42
- getCommands(): ICommandsMap {
43
- const map = new Map<string, ICommand>();
44
- this._commands.forEach((value, key) => map.set(key, value));
45
- return map;
46
- }
47
-
48
- executeCommand(id: string, viewer: IViewer, ...args: any[]): any {
49
- const command = this._commands.get(id);
50
- if (!command) {
51
- if (viewer) {
52
- const isDraggerCommand = viewer.draggers.includes(id);
53
- if (isDraggerCommand) return viewer.setActiveDragger(id);
54
- }
55
-
56
- console.warn(`Command '${id}' not found`);
57
- return undefined;
58
- }
59
-
60
- const { handler, thisArg } = command;
61
- const result = handler.apply(thisArg, [viewer, ...args]);
62
-
63
- viewer?.emit({ type: "command", data: id, args });
64
-
65
- return result;
66
- }
67
- }
68
-
69
- const _commands = new Map<string, Commands>();
70
-
71
- export function commands(viewerType: string): ICommands {
72
- let result = _commands.get(viewerType);
73
- if (!result) {
74
- result = new Commands();
75
- _commands.set(viewerType, result);
76
- }
77
- return result;
78
- }
79
-
80
- commands("VisualizeJS").registerCommand("noop", () => {});
81
- commands("ThreeJS").registerCommand("noop", () => {});
@@ -1,250 +0,0 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2002-2021, 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 { Point2d, Point3d, Vector3d } from "../Common/Geometry";
25
- import { Viewer } from "../../Viewer";
26
-
27
- export class OrbitAction {
28
- private _m_module: any;
29
- private _subject: Viewer;
30
- private _beginInteractivity: () => void;
31
- private _endInteractivity: () => void;
32
- private m_viewCenter: any;
33
- private m_startPoint: Point2d;
34
-
35
- constructor(m_module: any, subject: Viewer, beginInteractivity: () => void, endInteractivity: () => void) {
36
- this._m_module = m_module;
37
- this._subject = subject;
38
- this._beginInteractivity = beginInteractivity;
39
- this._endInteractivity = endInteractivity;
40
- }
41
-
42
- public beginAction(x: number, y: number) {
43
- this.m_viewCenter = this.getCenter();
44
- this.m_startPoint = { x, y };
45
-
46
- const view = this.getViewer().activeView;
47
-
48
- view.delete();
49
- this._beginInteractivity();
50
- }
51
-
52
- public action(x: number, y: number) {
53
- const view = this.getViewer().activeView;
54
-
55
- const corners = view.vportRect;
56
-
57
- const size = Math.max(Math.abs(corners[2] - corners[0]), Math.abs(corners[3] - corners[1]));
58
-
59
- const distX = ((this.m_startPoint.x - x) * Math.PI) / size;
60
- const distY = ((this.m_startPoint.y - y) * Math.PI) / size;
61
-
62
- this.m_startPoint.x = x;
63
- this.m_startPoint.y = y;
64
-
65
- const xOrbit = distY;
66
- const yOrbit = distX;
67
-
68
- const viewParams = {
69
- position: view.viewPosition,
70
- target: view.viewTarget,
71
- upVector: view.upVector,
72
- viewFieldWidth: view.viewFieldWidth,
73
- viewFieldHeight: view.viewFieldHeight,
74
- perspective: view.perspective,
75
- };
76
-
77
- view.delete();
78
-
79
- const sideVector = this.getSideVector(viewParams);
80
-
81
- if (xOrbit !== 0.0) {
82
- this.calculateXOrbit(viewParams, -xOrbit, sideVector);
83
- }
84
-
85
- if (yOrbit !== 0.0) {
86
- this.calculateYOrbit(viewParams, yOrbit, sideVector);
87
- }
88
-
89
- sideVector.delete();
90
-
91
- const extView = this.getViewer().getActiveTvExtendedView();
92
-
93
- extView.setView(
94
- viewParams.position,
95
- viewParams.target,
96
- viewParams.upVector,
97
- viewParams.viewFieldWidth,
98
- viewParams.viewFieldHeight,
99
- viewParams.perspective
100
- );
101
- extView.delete();
102
-
103
- this._subject.activeDragger()?.updatePreview();
104
- }
105
-
106
- public endAction() {
107
- this._endInteractivity();
108
- }
109
-
110
- private getSideVector(viewParams: any): any {
111
- const pUpV = this.toVector(viewParams.upVector);
112
- const pTarget = this.toPoint(viewParams.target);
113
- const pPosition = this.toPoint(viewParams.position);
114
-
115
- const direct = pTarget.sub(pPosition);
116
- const vDirect = direct.asVector();
117
-
118
- const vCross = pUpV.crossProduct(vDirect);
119
- const sideVector = vCross.normalize();
120
-
121
- this.deleteAll([direct, pUpV, pTarget, pPosition, vDirect, vCross]);
122
-
123
- return sideVector;
124
- }
125
-
126
- private calculateXOrbit(viewParams: any, delta: number, sideVector: Vector3d): void {
127
- {
128
- const pPoint = this.toPoint(viewParams.position);
129
- const pCenter = this.toPoint(this.m_viewCenter);
130
-
131
- const rotatePoint = pPoint.rotateByBasePoint(delta, sideVector, pCenter);
132
- viewParams.position = rotatePoint.toArray();
133
-
134
- this.deleteAll([pPoint, pCenter, rotatePoint]);
135
- }
136
-
137
- {
138
- const pTarget = this.toPoint(viewParams.target);
139
- const pCenter = this.toPoint(this.m_viewCenter);
140
-
141
- const rotatePoint = pTarget.rotateByBasePoint(delta, sideVector, pCenter);
142
- viewParams.target = rotatePoint.toArray();
143
-
144
- this.deleteAll([pTarget, pCenter, rotatePoint]);
145
- }
146
-
147
- {
148
- const pPoint = this.toPoint(viewParams.position);
149
- const pTarget = this.toPoint(viewParams.target);
150
- const pCenter = this.toPoint(this.m_viewCenter);
151
-
152
- const pUp = pTarget.sub(pPoint);
153
- const vUp = pUp.asVector();
154
-
155
- const crossProduct = vUp.crossProduct(sideVector);
156
- const crossProductNormal = crossProduct.normalize();
157
-
158
- viewParams.upVector = crossProductNormal.toArray();
159
-
160
- this.deleteAll([pPoint, pTarget, pCenter, pUp, vUp, crossProduct, crossProductNormal]);
161
- }
162
- }
163
-
164
- private calculateYOrbit(viewParams: any, delta: number, sideVector: any): void {
165
- {
166
- const pPoint = this.toPoint(viewParams.position);
167
- const pCenter = this.toPoint(this.m_viewCenter);
168
-
169
- const zAxis = this.toVector(this._m_module.Vector3d.kZAxis);
170
-
171
- const rotatePoint = pPoint.rotateByBasePoint(delta, zAxis, pCenter);
172
- viewParams.position = rotatePoint.toArray();
173
-
174
- this.deleteAll([zAxis, pPoint, pCenter, rotatePoint]);
175
- }
176
-
177
- {
178
- const pTarget = this.toPoint(viewParams.target);
179
- const pCenter = this.toPoint(this.m_viewCenter);
180
-
181
- const zAxis = this.toVector(this._m_module.Vector3d.kZAxis);
182
-
183
- const rotatePoint = pTarget.rotateByBasePoint(delta, zAxis, pCenter);
184
- viewParams.target = rotatePoint.toArray();
185
-
186
- this.deleteAll([zAxis, pTarget, pCenter, rotatePoint]);
187
- }
188
-
189
- {
190
- const zAxis = this.toVector(this._m_module.Vector3d.kZAxis);
191
- const pTarget = this.toPoint(viewParams.target);
192
- const pPoint = this.toPoint(viewParams.position);
193
-
194
- const side = sideVector.rotateBy(delta, zAxis);
195
-
196
- const pUp = pTarget.sub(pPoint);
197
- const vUp = pUp.asVector();
198
-
199
- const cross = vUp.crossProduct(side);
200
- const crossNormal = cross.normalize();
201
-
202
- viewParams.upVector = crossNormal.toArray();
203
-
204
- this.deleteAll([zAxis, pTarget, pPoint, side, pUp, vUp, cross, crossNormal]);
205
- }
206
- }
207
-
208
- private getCenter(): any {
209
- const viewer = this.getViewer();
210
- let center;
211
-
212
- const pSet = viewer.getSelected();
213
- if (!pSet.isNull() && pSet.numItems() !== 0) {
214
- const itr = pSet.getIterator();
215
- let ext, entId, extSelected;
216
- for (; !itr.done(); itr.step()) {
217
- entId = itr.getEntity();
218
- ext = entId.getWCSExtents();
219
- if (extSelected) extSelected.addExt(ext);
220
- else extSelected = ext;
221
- }
222
- center = extSelected.center();
223
-
224
- extSelected.delete();
225
- itr.delete();
226
- } else {
227
- center = viewer.getActiveExtents().center();
228
- }
229
-
230
- return center;
231
- }
232
-
233
- private getViewer(): any {
234
- return this._m_module.getViewer();
235
- }
236
-
237
- private toVector(geVector): Vector3d {
238
- return this._m_module.Vector3d.createFromArray(geVector);
239
- }
240
-
241
- private toPoint(gePoint: number[]): Point3d {
242
- return this._m_module.Point3d.createFromArray(gePoint);
243
- }
244
-
245
- private deleteAll(objects): void {
246
- for (const obj of objects) {
247
- obj?.delete?.();
248
- }
249
- }
250
- }