@inweb/client 25.3.12 → 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 (205) hide show
  1. package/README.md +17 -35
  2. package/dist/client.js +16 -17365
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.min.js +1 -1
  5. package/dist/client.module.js +3 -5553
  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 +0 -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/index.ts +1 -13
  32. package/lib/Viewer/CanvasEvents.d.ts +0 -2
  33. package/lib/Viewer/Commands/ApplyModelTransform.d.ts +0 -2
  34. package/lib/Viewer/Commands/ClearMarkup.d.ts +0 -2
  35. package/lib/Viewer/Commands/ClearSlices.d.ts +0 -2
  36. package/lib/Viewer/Commands/CreatePreview.d.ts +0 -2
  37. package/lib/Viewer/Commands/Explode.d.ts +0 -2
  38. package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +0 -2
  39. package/lib/Viewer/Commands/GetModels.d.ts +0 -2
  40. package/lib/Viewer/Commands/GetSelected.d.ts +0 -2
  41. package/lib/Viewer/Commands/HideSelected.d.ts +0 -2
  42. package/lib/Viewer/Commands/IsolateSelected.d.ts +0 -2
  43. package/lib/Viewer/Commands/RegenerateAll.d.ts +0 -2
  44. package/lib/Viewer/Commands/ResetView.d.ts +0 -2
  45. package/lib/Viewer/Commands/SelectModel.d.ts +0 -2
  46. package/lib/Viewer/Commands/SetActiveDragger.d.ts +0 -2
  47. package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +0 -2
  48. package/lib/Viewer/Commands/SetMarkupColor.d.ts +0 -2
  49. package/lib/Viewer/Commands/SetSelected.d.ts +0 -2
  50. package/lib/Viewer/Commands/ShowAll.d.ts +0 -2
  51. package/lib/Viewer/Commands/Unselect.d.ts +0 -2
  52. package/lib/Viewer/Commands/ZoomToExtents.d.ts +0 -2
  53. package/lib/Viewer/Commands/ZoomToObjects.d.ts +0 -2
  54. package/lib/Viewer/Commands/ZoomToSelected.d.ts +0 -2
  55. package/lib/Viewer/Commands.d.ts +0 -3
  56. package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +0 -22
  57. package/lib/Viewer/Draggers/Actions/PanAction.d.ts +0 -18
  58. package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +0 -8
  59. package/lib/Viewer/Draggers/Common/Geometry.d.ts +0 -115
  60. package/lib/Viewer/Draggers/Common/GestureManager.d.ts +0 -41
  61. package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +0 -54
  62. package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +0 -30
  63. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +0 -31
  64. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +0 -20
  65. package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +0 -24
  66. package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +0 -27
  67. package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +0 -8
  68. package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +0 -8
  69. package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +0 -8
  70. package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +0 -15
  71. package/lib/Viewer/Draggers/OdPanDragger.d.ts +0 -12
  72. package/lib/Viewer/Draggers/OdZoomDragger.d.ts +0 -12
  73. package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +0 -11
  74. package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +0 -19
  75. package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +0 -14
  76. package/lib/Viewer/Draggers/OdaLineDragger.d.ts +0 -15
  77. package/lib/Viewer/Draggers/OdaTextDragger.d.ts +0 -16
  78. package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +0 -30
  79. package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +0 -19
  80. package/lib/Viewer/EventEmitter2.d.ts +0 -54
  81. package/lib/Viewer/ICommands.d.ts +0 -25
  82. package/lib/Viewer/IEventEmitter2.d.ts +0 -13
  83. package/lib/Viewer/IViewer.d.ts +0 -30
  84. package/lib/Viewer/Loaders/BaseLoader.d.ts +0 -11
  85. package/lib/Viewer/Loaders/LoaderFactory.d.ts +0 -11
  86. package/lib/Viewer/Loaders/TCSLoader.d.ts +0 -5
  87. package/lib/Viewer/Loaders/UpdaterController.d.ts +0 -15
  88. package/lib/Viewer/Loaders/VsfXLoader.d.ts +0 -5
  89. package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +0 -5
  90. package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +0 -5
  91. package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +0 -22
  92. package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +0 -15
  93. package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +0 -5
  94. package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +0 -15
  95. package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +0 -15
  96. package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +0 -13
  97. package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +0 -12
  98. package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +0 -15
  99. package/lib/Viewer/Markup/Api/IMarkupText.d.ts +0 -13
  100. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +0 -47
  101. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaCloud.d.ts +0 -36
  102. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +0 -41
  103. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +0 -37
  104. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +0 -37
  105. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +0 -39
  106. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +0 -38
  107. package/lib/Viewer/Markup/IMarkup.d.ts +0 -40
  108. package/lib/Viewer/Markup/IViewpoint.d.ts +0 -129
  109. package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +0 -72
  110. package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +0 -19
  111. package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +0 -34
  112. package/lib/Viewer/Markup/MarkupFactory.d.ts +0 -7
  113. package/lib/Viewer/Options.d.ts +0 -239
  114. package/lib/Viewer/OptionsEvents.d.ts +0 -26
  115. package/lib/Viewer/Viewer.d.ts +0 -354
  116. package/lib/Viewer/ViewerCommands.d.ts +0 -23
  117. package/lib/Viewer/ViewerEvents.d.ts +0 -602
  118. package/lib/Viewer/utils.d.ts +0 -4
  119. package/src/Viewer/CanvasEvents.ts +0 -41
  120. package/src/Viewer/Commands/ApplyModelTransform.ts +0 -70
  121. package/src/Viewer/Commands/ClearMarkup.ts +0 -28
  122. package/src/Viewer/Commands/ClearSlices.ts +0 -27
  123. package/src/Viewer/Commands/CreatePreview.ts +0 -33
  124. package/src/Viewer/Commands/Explode.ts +0 -38
  125. package/src/Viewer/Commands/GetDefaultViewPositions.ts +0 -36
  126. package/src/Viewer/Commands/GetModels.ts +0 -43
  127. package/src/Viewer/Commands/GetSelected.ts +0 -58
  128. package/src/Viewer/Commands/HideSelected.ts +0 -37
  129. package/src/Viewer/Commands/IsolateSelected.ts +0 -37
  130. package/src/Viewer/Commands/RegenerateAll.ts +0 -37
  131. package/src/Viewer/Commands/ResetView.ts +0 -43
  132. package/src/Viewer/Commands/SelectModel.ts +0 -52
  133. package/src/Viewer/Commands/SetActiveDragger.ts +0 -29
  134. package/src/Viewer/Commands/SetDefaultViewPosition.ts +0 -50
  135. package/src/Viewer/Commands/SetMarkupColor.ts +0 -29
  136. package/src/Viewer/Commands/SetSelected.ts +0 -47
  137. package/src/Viewer/Commands/ShowAll.ts +0 -37
  138. package/src/Viewer/Commands/Unselect.ts +0 -37
  139. package/src/Viewer/Commands/ZoomToExtents.ts +0 -43
  140. package/src/Viewer/Commands/ZoomToObjects.ts +0 -47
  141. package/src/Viewer/Commands/ZoomToSelected.ts +0 -39
  142. package/src/Viewer/Commands.ts +0 -81
  143. package/src/Viewer/Draggers/Actions/OrbitAction.ts +0 -250
  144. package/src/Viewer/Draggers/Actions/PanAction.ts +0 -102
  145. package/src/Viewer/Draggers/Actions/ZoomAction.ts +0 -45
  146. package/src/Viewer/Draggers/Common/Geometry.ts +0 -152
  147. package/src/Viewer/Draggers/Common/GestureManager.ts +0 -263
  148. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +0 -270
  149. package/src/Viewer/Draggers/Common/OdaGeAction.ts +0 -146
  150. package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +0 -248
  151. package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +0 -182
  152. package/src/Viewer/Draggers/MeasureLineDragger/index.ts +0 -166
  153. package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +0 -182
  154. package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +0 -53
  155. package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +0 -53
  156. package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +0 -53
  157. package/src/Viewer/Draggers/OdOrbitDragger.ts +0 -70
  158. package/src/Viewer/Draggers/OdPanDragger.ts +0 -62
  159. package/src/Viewer/Draggers/OdZoomDragger.ts +0 -59
  160. package/src/Viewer/Draggers/OdZoomWheelDragger.ts +0 -103
  161. package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +0 -123
  162. package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +0 -75
  163. package/src/Viewer/Draggers/OdaLineDragger.ts +0 -80
  164. package/src/Viewer/Draggers/OdaTextDragger.ts +0 -118
  165. package/src/Viewer/Draggers/OdaWalkDragger.ts +0 -278
  166. package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +0 -184
  167. package/src/Viewer/EventEmitter2.ts +0 -116
  168. package/src/Viewer/ICommands.ts +0 -53
  169. package/src/Viewer/IEventEmitter2.ts +0 -36
  170. package/src/Viewer/IViewer.ts +0 -59
  171. package/src/Viewer/Loaders/BaseLoader.ts +0 -40
  172. package/src/Viewer/Loaders/LoaderFactory.ts +0 -47
  173. package/src/Viewer/Loaders/TCSLoader.ts +0 -82
  174. package/src/Viewer/Loaders/UpdaterController.ts +0 -36
  175. package/src/Viewer/Loaders/VsfXLoader.ts +0 -65
  176. package/src/Viewer/Loaders/VsfXPartialLoader.ts +0 -208
  177. package/src/Viewer/Loaders/VsfXStreamingLoader.ts +0 -87
  178. package/src/Viewer/Markup/Api/IMarkupArrow.ts +0 -12
  179. package/src/Viewer/Markup/Api/IMarkupCloud.ts +0 -15
  180. package/src/Viewer/Markup/Api/IMarkupColorable.ts +0 -4
  181. package/src/Viewer/Markup/Api/IMarkupEllipse.ts +0 -15
  182. package/src/Viewer/Markup/Api/IMarkupImage.ts +0 -15
  183. package/src/Viewer/Markup/Api/IMarkupLine.ts +0 -13
  184. package/src/Viewer/Markup/Api/IMarkupObject.ts +0 -15
  185. package/src/Viewer/Markup/Api/IMarkupRectangle.ts +0 -15
  186. package/src/Viewer/Markup/Api/IMarkupText.ts +0 -12
  187. package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +0 -117
  188. package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +0 -208
  189. package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +0 -118
  190. package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +0 -123
  191. package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +0 -131
  192. package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +0 -119
  193. package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +0 -110
  194. package/src/Viewer/Markup/IMarkup.ts +0 -41
  195. package/src/Viewer/Markup/IViewpoint.ts +0 -146
  196. package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +0 -1144
  197. package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +0 -39
  198. package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +0 -228
  199. package/src/Viewer/Markup/MarkupFactory.ts +0 -32
  200. package/src/Viewer/Options.ts +0 -527
  201. package/src/Viewer/OptionsEvents.ts +0 -28
  202. package/src/Viewer/Viewer.ts +0 -1182
  203. package/src/Viewer/ViewerCommands.ts +0 -45
  204. package/src/Viewer/ViewerEvents.ts +0 -705
  205. package/src/Viewer/utils.ts +0 -74
@@ -1,53 +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
-
26
- export interface ICommandService {
27
- executeCommand(id: string, ...args: any[]): any;
28
- }
29
-
30
- export type ICommandsMap = Map<string, ICommand>;
31
-
32
- export interface ICommandHandler {
33
- (viewer: any, ...args: any[]): any;
34
- }
35
-
36
- export interface ICommand {
37
- id: string;
38
- handler: ICommandHandler;
39
- thisArg?: any;
40
- description?: ICommandDescription;
41
- }
42
-
43
- export interface ICommandDescription {
44
- readonly description: string;
45
- }
46
-
47
- export interface ICommands {
48
- registerCommand(id: string, handler: ICommandHandler, description?: ICommandDescription, thisArg?: any): void;
49
- registerCommandAlias(id: string, alias: string): void;
50
- getCommands(): ICommandsMap;
51
- getCommand(id: string): ICommand | undefined;
52
- executeCommand(id: string, viewer: IViewer, ...args: any[]): any;
53
- }
@@ -1,36 +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
- export interface IEvent {
25
- type: string;
26
- }
27
-
28
- export interface IEventEmitter {
29
- addEventListener(type: string, listener: (event: IEvent) => void): this;
30
- removeEventListener(type: string, listener: (event: IEvent) => void): this;
31
- removeAllListeners(type?: string): this;
32
- emitEvent(event: IEvent): boolean;
33
- on(type: string, listener: (event: object) => void): this;
34
- off(type: string, listener: (event: object) => void): this;
35
- emit(event: string | object, ...args: any[]): boolean;
36
- }
@@ -1,59 +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 { IEventEmitter } from "./IEventEmitter2";
25
- import { ICommandService } from "./ICommands";
26
- import { Options } from "./Options";
27
- import { Client } from "../Api/Client";
28
- import { File } from "../Api/File";
29
- import { Assembly } from "../Api/Assembly";
30
- import { Model } from "../Api/Model";
31
- import { IViewpoint } from "./Markup/IViewpoint";
32
-
33
- export interface IViewer extends IEventEmitter, ICommandService {
34
- client: Client | undefined;
35
- options: Options;
36
- canvas: HTMLCanvasElement | undefined;
37
- canvasEvents: string[];
38
- draggers: string[];
39
-
40
- initialize(canvas: HTMLCanvasElement, onProgress?: (event: ProgressEvent) => void): Promise<this>;
41
- dispose(): this;
42
- isInitialized(): boolean;
43
-
44
- update(forder?: boolean): void;
45
-
46
- activeDragger(): any | null;
47
- setActiveDragger(name: string): any;
48
- resetActiveDragger(): void;
49
-
50
- is3D(): boolean;
51
-
52
- drawViewpoint(viewpoint: IViewpoint): void;
53
- createViewpoint(): IViewpoint;
54
-
55
- loadReferences(model: Model | File | Assembly): Promise<this>;
56
- open(model: Model | File | Assembly): Promise<this>;
57
- cancel(): this;
58
- clear(): this;
59
- }
@@ -1,40 +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 { Model } from "../../Api/Model";
25
- import { OptionsData } from "../Options";
26
- import { Viewer } from "../Viewer";
27
-
28
- export class BaseLoader {
29
- protected viewer: Viewer;
30
- protected model: Model;
31
- protected options: OptionsData;
32
-
33
- constructor(viewer: Viewer, model: Model, options: OptionsData) {
34
- this.viewer = viewer;
35
- this.model = model;
36
- this.options = options;
37
- }
38
-
39
- async load(): Promise<void> {}
40
- }
@@ -1,47 +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 { TCSLoader } from "./TCSLoader";
25
- import { VsfXStreamingLoader } from "./VsfXStreamingLoader";
26
- import { VsfXPartialLoader } from "./VsfXPartialLoader";
27
- import { Viewer } from "../Viewer";
28
- import { Model } from "../../Api/Model";
29
- import { OptionsData } from "../Options";
30
- import { VsfXLoader } from "./VsfXLoader";
31
-
32
- export class LoaderFactory {
33
- create(viewer: Viewer, model: Model, options: OptionsData) {
34
- const geometryType = model.database.split(".").pop();
35
-
36
- if (model.geometry.length === 0 && geometryType === "vsfx") {
37
- if (!options.enableStreamingMode) return new VsfXLoader(viewer, model, options);
38
- else if (options.enablePartialMode) return new VsfXPartialLoader(viewer, model, options);
39
- else return new VsfXStreamingLoader(viewer, model, options);
40
- }
41
-
42
- if (geometryType === "data") {
43
- return new TCSLoader(viewer, model, options);
44
- }
45
- throw new Error(`Unknown geometry type: ${geometryType}`);
46
- }
47
- }
@@ -1,82 +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 { BaseLoader } from "./BaseLoader";
25
-
26
- export class TCSLoader extends BaseLoader {
27
- override async load(): Promise<void> {
28
- if (!this.viewer.visualizeJs) return;
29
-
30
- const visLib = this.viewer.visLib();
31
- const visViewer = visLib.getViewer();
32
- const abortController = new AbortController();
33
-
34
- const listFileForDownload = [this.model.database, ...this.model.geometry];
35
- const chunksProgress = listFileForDownload.map(() => 0);
36
-
37
- const calcProgress = (index, progress) => {
38
- chunksProgress[index] = progress;
39
- const fileProgress = chunksProgress.reduce((acc, progress) => (acc += progress)) / (chunksProgress.length || 1);
40
- this.viewer.emitEvent({ type: "geometryprogress", data: fileProgress, model: this.model });
41
- };
42
-
43
- this.viewer._abortController = abortController;
44
-
45
- try {
46
- this.viewer.emitEvent({ type: "geometrystart", model: this.model });
47
-
48
- for (let i = 0; i < listFileForDownload.length; i++) {
49
- const chunk = listFileForDownload[i];
50
-
51
- const progressCb = (progress) => calcProgress(i, progress);
52
- const arrayBuffer = await this.model.downloadResource(chunk, progressCb, abortController.signal);
53
-
54
- if (abortController.signal.aborted) {
55
- await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
56
- }
57
-
58
- visViewer.parseStream(new Uint8Array(arrayBuffer));
59
- this.viewer.update();
60
-
61
- const data = new Uint8Array(arrayBuffer);
62
-
63
- if (i === 0) {
64
- this.viewer.update(true);
65
-
66
- this.viewer.syncOpenCloudVisualStyle(false);
67
- this.viewer.syncOptions();
68
- this.viewer.resize();
69
-
70
- this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
71
- } else {
72
- this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
73
- }
74
- }
75
-
76
- this.viewer.emitEvent({ type: "geometryend", model: this.model });
77
- } catch (error) {
78
- this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
79
- throw error;
80
- }
81
- }
82
- }
@@ -1,36 +0,0 @@
1
- import { Viewer } from "../Viewer";
2
-
3
- const DELAY_TIME_MULTIPLEXER = 2.0;
4
- const START_UPDATE_TIME = 1000;
5
-
6
- export enum UpdateType {
7
- kDelay,
8
- kNormal,
9
- kForce,
10
- }
11
-
12
- export class UpdaterController {
13
- private lastUpdate: number;
14
- private viewer: Viewer;
15
- public delayUpdateTime: number;
16
-
17
- constructor() {
18
- this.delayUpdateTime = START_UPDATE_TIME;
19
- }
20
-
21
- initialize(viewer: Viewer) {
22
- this.viewer = viewer;
23
- this.lastUpdate = performance.now();
24
- }
25
-
26
- update(type: UpdateType) {
27
- const isNeedUpdate = type !== UpdateType.kDelay || performance.now() - this.lastUpdate >= this.delayUpdateTime;
28
- const isForce = type === UpdateType.kForce;
29
-
30
- if (isNeedUpdate) {
31
- this.viewer.update(isForce);
32
- this.lastUpdate = performance.now();
33
- this.delayUpdateTime *= DELAY_TIME_MULTIPLEXER;
34
- }
35
- }
36
- }
@@ -1,65 +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 { BaseLoader } from "./BaseLoader";
25
-
26
- export class VsfXLoader extends BaseLoader {
27
- override async load(): Promise<void> {
28
- if (!this.viewer.visualizeJs) return;
29
-
30
- const visLib = this.viewer.visLib();
31
- const visViewer = visLib.getViewer();
32
- const abortController = new AbortController();
33
-
34
- this.viewer._abortController = abortController;
35
-
36
- console.time("File load time");
37
- try {
38
- this.viewer.emitEvent({ type: "geometrystart", model: this.model });
39
-
40
- const progressCb = (progress) =>
41
- this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
42
- const arrayBuffer = await this.model.downloadResource(this.model.database, progressCb, abortController.signal);
43
-
44
- if (abortController.signal.aborted) {
45
- await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
46
- }
47
-
48
- if (this.viewer.visualizeJs) {
49
- visViewer.parseVsfx(new Uint8Array(arrayBuffer));
50
- this.viewer.update(true);
51
-
52
- this.viewer.syncOpenCloudVisualStyle(false);
53
- this.viewer.syncOptions();
54
- this.viewer.resize();
55
- }
56
-
57
- console.timeEnd("File load time");
58
-
59
- this.viewer.emitEvent({ type: "geometryend", model: this.model });
60
- } catch (error) {
61
- this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
62
- throw error;
63
- }
64
- }
65
- }
@@ -1,208 +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 { BaseLoader } from "./BaseLoader";
25
- import { UpdaterController, UpdateType } from "./UpdaterController";
26
-
27
- export class VsfXPartialLoader extends BaseLoader {
28
- override async load(): Promise<void> {
29
- if (!this.viewer.visualizeJs) return;
30
-
31
- const visLib = this.viewer.visLib();
32
- const visViewer = visLib.getViewer();
33
- const abortController = new AbortController();
34
- const abortControllerForRequestMap = new Map();
35
- let servicePartAborted = false;
36
-
37
- const pendingRequestsMap = new Map();
38
- const PENDING_REQUESTS_SIZE = 50;
39
- const PENDING_REQUESTS_TIMEOUT = 250;
40
- let pendingRequestsTimerId = 0;
41
- const pendingRequestsAbortHandler = () => clearTimeout(pendingRequestsTimerId);
42
-
43
- const pendingRequestsAbortController = new AbortController();
44
- abortControllerForRequestMap.set(0, pendingRequestsAbortController);
45
-
46
- const updaterController = new UpdaterController();
47
- updaterController.initialize(this.viewer);
48
-
49
- this.viewer._abortController = abortController;
50
- this.viewer._abortControllerForRequestMap = abortControllerForRequestMap;
51
-
52
- visViewer.memoryLimit = this.options.memoryLimit;
53
-
54
- const requestLoadHandler = (progress, data, requestId) => {
55
- if (!this.viewer.visualizeJs) return;
56
-
57
- const state = visViewer.parseVsfxInPartialMode(requestId, data);
58
- updaterController.update(UpdateType.kDelay);
59
-
60
- this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
61
-
62
- if (state) {
63
- updaterController.update(UpdateType.kForce);
64
-
65
- this.viewer.syncOpenCloudVisualStyle(false);
66
- this.viewer.syncOptions();
67
- this.viewer.resize();
68
-
69
- this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
70
- } else {
71
- this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
72
- }
73
- };
74
-
75
- const downloadPartOfFile = async (requestId, records, dataId, isMultipleParts = false) => {
76
- const abortCtrl = new AbortController();
77
- abortControllerForRequestMap.set(requestId, abortCtrl);
78
- try {
79
- await this.model.downloadFileRange(requestId, records, dataId, requestLoadHandler, abortCtrl.signal);
80
- } catch (error) {
81
- this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
82
- } finally {
83
- const requests = isMultipleParts ? [...new Set(records.map((item) => item.reqId))] : [requestId];
84
- requests.forEach((requestId) => visViewer.onRequestResponseComplete(requestId));
85
- abortControllerForRequestMap.delete(requestId);
86
- updaterController.update(UpdateType.kNormal);
87
- }
88
- };
89
-
90
- const recordsToArray = (requestId, records) => {
91
- const res = [];
92
- for (let i = 0; i < records.size(); i++) {
93
- const record = records.get(i);
94
- res.push({
95
- reqId: requestId,
96
- begin: record.begin,
97
- end: record.end,
98
- size: parseInt(record.end, 10) - parseInt(record.begin, 10),
99
- });
100
- record.delete();
101
- }
102
- return res;
103
- };
104
-
105
- const objectHandler = {
106
- onServicePartReceived: (bHasIndex) => {
107
- if (bHasIndex) {
108
- servicePartAborted = true;
109
- abortController.abort();
110
- }
111
- },
112
-
113
- onRequest: (requestId, records) => {
114
- downloadPartOfFile(requestId, records, this.model.database);
115
- },
116
-
117
- onFullLoaded: () => {
118
- updaterController.update(UpdateType.kNormal);
119
- console.timeEnd("File load time");
120
- },
121
-
122
- onRequestResponseParsed: (requestId) => {
123
- abortControllerForRequestMap.delete(requestId);
124
- updaterController.update(UpdateType.kNormal);
125
- },
126
-
127
- onRequestAborted: (requestId) => {
128
- const abortCtrl = abortControllerForRequestMap.get(requestId);
129
- if (abortCtrl) abortCtrl.abort();
130
- },
131
-
132
- onRequestResourceFile: async (requestId, _, records) => {
133
- const dataId = `${this.model.fileId}${this.model.file.type}`;
134
-
135
- let pendingRequests = [];
136
- let recNumber = 0;
137
- const pendingRequestsRecord = pendingRequestsMap.get(dataId);
138
- if (pendingRequestsRecord) {
139
- pendingRequests = pendingRequestsRecord.array;
140
- recNumber = pendingRequestsRecord.number;
141
- }
142
-
143
- // first several records of each file are processed without grouping (they usually require to be processed sequentially)
144
- if (recNumber < 6) {
145
- pendingRequestsMap.set(dataId, { array: pendingRequests, number: recNumber + 1 });
146
- await downloadPartOfFile(requestId, records, dataId);
147
- return;
148
- }
149
-
150
- // group requests to each file to launch a combined server request
151
- if (pendingRequests.length >= PENDING_REQUESTS_SIZE) {
152
- if (pendingRequestsTimerId) {
153
- window.clearTimeout(pendingRequestsTimerId);
154
- pendingRequestsTimerId = 0;
155
- }
156
-
157
- downloadPartOfFile(requestId, pendingRequests, dataId, true);
158
- pendingRequests = [...recordsToArray(requestId, records)];
159
- } else {
160
- pendingRequests = [...pendingRequests, ...recordsToArray(requestId, records)];
161
- }
162
-
163
- pendingRequestsMap.set(dataId, { array: pendingRequests, number: recNumber + 1 });
164
-
165
- // set timeout to wait for the new requests, after that process the remaining requests
166
- if (pendingRequestsTimerId === 0) {
167
- pendingRequestsTimerId = window.setTimeout(() => {
168
- pendingRequestsAbortController.signal.removeEventListener("abort", pendingRequestsAbortHandler);
169
- pendingRequestsTimerId = 0;
170
-
171
- pendingRequestsMap.forEach((requestsRecord, keyFileName) => {
172
- const array = requestsRecord.array;
173
- if (array.length > 0) {
174
- downloadPartOfFile(requestId, array, keyFileName, true);
175
- pendingRequestsMap.set(keyFileName, { array: [], number: requestsRecord.number + 1 });
176
- }
177
- });
178
- }, PENDING_REQUESTS_TIMEOUT);
179
-
180
- pendingRequestsAbortController.signal.addEventListener("abort", pendingRequestsAbortHandler, { once: true });
181
- }
182
- },
183
- };
184
-
185
- visViewer.attachPartialResolver(objectHandler);
186
-
187
- console.time("File load time");
188
- try {
189
- this.viewer.emitEvent({ type: "geometrystart", model: this.model });
190
-
191
- await this.model
192
- .downloadFileRange(0, null, this.model.database, requestLoadHandler, abortController.signal)
193
- .catch((error) => {
194
- if (!servicePartAborted) throw error;
195
- });
196
-
197
- this.viewer.emitEvent({ type: "geometryend", model: this.model });
198
- } catch (error) {
199
- if (pendingRequestsTimerId) {
200
- window.clearTimeout(pendingRequestsTimerId);
201
- pendingRequestsTimerId = 0;
202
- }
203
-
204
- this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
205
- throw error;
206
- }
207
- }
208
- }