@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,182 +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
- import { Point2d } from "../Common/Geometry";
24
-
25
- export function createHtmlElementIfNeed(
26
- element: HTMLElement,
27
- targetElement: HTMLElement,
28
- dataTestId: string
29
- ): HTMLElement {
30
- if (!element) {
31
- element = document.createElement("div");
32
- element.setAttribute("data-testid", dataTestId);
33
-
34
- targetElement.appendChild(element);
35
- }
36
- return element;
37
- }
38
-
39
- export function destroyHtmlElement(element: HTMLElement, targetElement: HTMLElement) {
40
- if (element) {
41
- targetElement.removeChild(element);
42
- }
43
- return null;
44
- }
45
-
46
- export function worldToScreen(gePoint: number[], moduleInstance, viewer): Point2d {
47
- const worldPoint = moduleInstance.Point3d.createFromArray(gePoint);
48
- const avp = viewer.activeView;
49
- const mtx = avp.worldToDeviceMatrix;
50
-
51
- const devicePoint = worldPoint.transformBy(mtx);
52
-
53
- const res = { x: devicePoint.x / window.devicePixelRatio, y: devicePoint.y / window.devicePixelRatio };
54
-
55
- mtx.delete();
56
- worldPoint.delete();
57
- devicePoint.delete();
58
- avp.delete();
59
- return res;
60
- }
61
-
62
- export function getDistance(gePoint1: number[], gePoint2: number[], moduleInstance: any) {
63
- const tvPoint1 = moduleInstance.Point3d.createFromArray(gePoint1);
64
- const tvPoint2 = moduleInstance.Point3d.createFromArray(gePoint2);
65
-
66
- const distance = tvPoint1.distanceTo(tvPoint2).toFixed(2);
67
-
68
- tvPoint1.delete();
69
- tvPoint2.delete();
70
-
71
- return distance;
72
- }
73
-
74
- export function getAngle(geStart: number[], geOrigin: number[], geEnd: number[], moduleInstance: any): number {
75
- const tvStart = moduleInstance.Point3d.createFromArray(geStart);
76
- const tvOrigin = moduleInstance.Point3d.createFromArray(geOrigin);
77
- const tvEnd = moduleInstance.Point3d.createFromArray(geEnd);
78
-
79
- const s1 = tvStart.sub(tvOrigin);
80
- const s2 = tvEnd.sub(tvOrigin);
81
-
82
- const v1 = s1.asVector();
83
- const v2 = s2.asVector();
84
-
85
- const angle = (180 * v1.angleTo(v2)) / Math.PI;
86
-
87
- return angle;
88
- }
89
-
90
- export function getDataForDrawLine(p1: Point2d, p2: Point2d) {
91
- const dx = p2.x - p1.x;
92
- const dy = p2.y - p1.y;
93
- let angle = (180 * Math.atan(dy / dx)) / Math.PI;
94
- if (dx < 0) {
95
- angle -= 180;
96
- }
97
- const width = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
98
- return { angle, width };
99
- }
100
-
101
- function normalizeFloat(value: number): number {
102
- return value < 0 ? Math.ceil(value) : Math.floor(value);
103
- }
104
-
105
- const lineSegmentsIntersect = (p1: Point2d, p2: Point2d, p3: Point2d, p4: Point2d): false | Point2d => {
106
- const a_dx = p2.x - p1.x;
107
- const a_dy = p2.y - p1.y;
108
- const b_dx = p4.x - p3.x;
109
- const b_dy = p4.y - p3.y;
110
- const s = (-a_dy * (p1.x - p3.x) + a_dx * (p1.y - p3.y)) / (-b_dx * a_dy + a_dx * b_dy);
111
- const t = (+b_dx * (p1.y - p3.y) - b_dy * (p1.x - p3.x)) / (-b_dx * a_dy + a_dx * b_dy);
112
- return s >= 0 && s <= 1 && t >= 0 && t <= 1
113
- ? {
114
- x: normalizeFloat(p1.x + t * a_dx),
115
- y: normalizeFloat(p1.y + t * a_dy),
116
- }
117
- : false;
118
- };
119
-
120
- function checkSegmentsIntersect(p1: Point2d, p2: Point2d, p3: Point2d, p4: Point2d, res: Point2d[]): void {
121
- const r = lineSegmentsIntersect(p1, p2, p3, p4);
122
- if (r) {
123
- res.push(r);
124
- }
125
- }
126
-
127
- export function isInsideRect(p: Point2d, width: number, height: number): boolean {
128
- return p.x <= width && p.x >= 0 && p.y <= height && p.y >= 0;
129
- }
130
-
131
- export function getDataForDrawLineWithFixed(p1: Point2d, p2: Point2d, width: number, height: number) {
132
- const pLU = { x: 0, y: 0 };
133
- const pRU = { x: width, y: 0 };
134
-
135
- const pLB = { x: 0, y: height };
136
- const pRB = { x: width, y: height };
137
-
138
- const intersects: Point2d[] = [];
139
-
140
- checkSegmentsIntersect(p1, p2, pLU, pRU, intersects);
141
- checkSegmentsIntersect(p1, p2, pLU, pLB, intersects);
142
- checkSegmentsIntersect(p1, p2, pLB, pRB, intersects);
143
- checkSegmentsIntersect(p1, p2, pRB, pRU, intersects);
144
-
145
- let fixedP1: Point2d = null;
146
- let fixedP2: Point2d = null;
147
-
148
- if (intersects.length === 0) {
149
- fixedP1 = p1;
150
- fixedP2 = p2;
151
- } else if (intersects.length === 1) {
152
- if (isInsideRect(p1, width, height)) {
153
- fixedP1 = p1;
154
- fixedP2 = intersects[0];
155
- } else {
156
- fixedP1 = intersects[0];
157
- fixedP2 = p2;
158
- }
159
- } else {
160
- fixedP1 = intersects[0];
161
- fixedP2 = intersects[1];
162
- }
163
-
164
- const dx = fixedP2.x - fixedP1.x;
165
- const dy = fixedP2.y - fixedP1.y;
166
- let angle = (180 * Math.atan(dy / dx)) / Math.PI;
167
- if (dx < 0) {
168
- angle -= 180;
169
- }
170
- const size = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
171
- return { angle, width: size, p1: fixedP1, p2: fixedP2 };
172
- }
173
-
174
- export function onSetCallback(element: HTMLElement, cb: () => void): void {
175
- if (element) {
176
- element.onclick = cb ? () => cb() : () => {};
177
- }
178
- }
179
-
180
- export function onSetSelectivity(element: HTMLElement, enable: boolean): void {
181
- element.style.pointerEvents = enable ? "auto" : "none";
182
- }
@@ -1,166 +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
- import { Viewer } from "../../Viewer";
24
- import { OdBaseDragger } from "../Common/OdBaseDragger";
25
- import { MeasureLineItem } from "./MeasureLineItem";
26
-
27
- function renameUnit(table, unit) {
28
- return table[unit] || unit;
29
- }
30
-
31
- export class MeasureLineDragger extends OdBaseDragger {
32
- protected lineThickness: number;
33
- protected gripingRadius: number;
34
- protected firstPoint: number[];
35
- protected secondPoint: number[];
36
- protected renameUnitTable: any;
37
- protected items: MeasureLineItem[];
38
- protected m_overlayElement: HTMLElement;
39
- protected previewMeasureLine: MeasureLineItem;
40
-
41
- constructor(subject: Viewer) {
42
- super(subject);
43
- this.lineThickness = 2;
44
- this.press = false;
45
- this.gripingRadius = 5.0;
46
- this.firstPoint = null;
47
- this.secondPoint = null;
48
-
49
- this.renameUnitTable = {
50
- Millimeters: "mm",
51
- Centimeters: "cm",
52
- Meters: "m",
53
- Feet: "ft",
54
- Inches: "in",
55
- Yards: "yd",
56
- Kilometers: "km",
57
- Miles: "mi",
58
- Micrometers: "µm",
59
- MicroInches: "µin",
60
- Undefined: " ",
61
- };
62
-
63
- this.items = [];
64
-
65
- this.canvasEvents.push("resize");
66
- }
67
-
68
- override initialize(): void {
69
- super.initialize();
70
-
71
- this.m_overlayElement = document.createElement("div");
72
- this.m_overlayElement.style.background = "rgba(0,0,0,0)";
73
- this.m_overlayElement.style.position = "fixed";
74
- this.m_overlayElement.style.zIndex = "1";
75
- this.m_overlayElement.style.pointerEvents = "none";
76
- document.body.appendChild(this.m_overlayElement);
77
-
78
- this.resize();
79
- }
80
-
81
- override dispose(): void {
82
- super.dispose();
83
- this.m_overlayElement.remove();
84
- }
85
-
86
- override updatePreview(): void {
87
- this.items.forEach((item) => item.update());
88
- }
89
-
90
- resize(): void {
91
- const rect = this.m_module.canvas.getBoundingClientRect();
92
-
93
- this.m_overlayElement.style.top = `${rect.top}px`;
94
- this.m_overlayElement.style.left = `${rect.left}px`;
95
- this.m_overlayElement.style.width = `${rect.width}px`;
96
- this.m_overlayElement.style.height = `${rect.height}px`;
97
- }
98
-
99
- getSnapPointRadius(): number {
100
- const view = this.getViewer().activeView;
101
- const corners = view.viewDcCorners();
102
-
103
- const pt1 = corners.lowerLeft;
104
- const pt2 = corners.upperRight;
105
-
106
- pt2[0] -= pt1[0];
107
- pt2[1] -= pt1[1];
108
-
109
- return Math.min(pt2[0], pt2[1]) / 120;
110
- }
111
-
112
- override drag(x: number, y: number): void {
113
- this.createNewMeasureIfNeed();
114
- const point = this.getViewer().getSnapPoint(x, y, this.gripingRadius);
115
-
116
- if (this.isDragging) {
117
- if (point) {
118
- if (this.firstPoint) {
119
- this.secondPoint = point;
120
- this.previewMeasureLine.setStartPoint(this.firstPoint);
121
- this.previewMeasureLine.setEndPoint(this.secondPoint, true);
122
- } else {
123
- this.firstPoint = point;
124
- this.previewMeasureLine.setStartPoint(this.firstPoint);
125
- }
126
- } else {
127
- this.secondPoint = null;
128
- this.previewMeasureLine.clear();
129
- this.previewMeasureLine.setStartPoint(this.firstPoint);
130
- this.previewMeasureLine.setEndPoint(this.getViewer().screenToWorld(x, y), false);
131
- }
132
- } else {
133
- if (point) {
134
- this.previewMeasureLine.setStartPoint(point);
135
- } else {
136
- this.previewMeasureLine.clear();
137
- }
138
- }
139
- }
140
-
141
- override end(): void {
142
- if (this.firstPoint && this.secondPoint) {
143
- const newLineMeasure = this.createMeasureLine();
144
- newLineMeasure.setStartPoint(this.firstPoint);
145
- newLineMeasure.setEndPoint(this.secondPoint, true);
146
- }
147
- this.firstPoint = null;
148
- this.secondPoint = null;
149
- this.previewMeasureLine.clear();
150
- }
151
-
152
- createNewMeasureIfNeed(): void {
153
- if (!this.previewMeasureLine) {
154
- this.previewMeasureLine = this.createMeasureLine();
155
- }
156
- }
157
-
158
- createMeasureLine(): MeasureLineItem {
159
- const viewer = this.m_module.getViewer();
160
- const item = new MeasureLineItem(this.m_overlayElement, viewer, this.m_module);
161
- item.lineThickness = this.lineThickness || item.lineThickness;
162
- item.setUnit(renameUnit(this.renameUnitTable, viewer.getUnit()));
163
- this.items.push(item);
164
- return item;
165
- }
166
- }
@@ -1,182 +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
- import { Viewer } from "../Viewer";
24
- import { Point2d, Point3d } from "./Common/Geometry";
25
- import { OdBaseDragger } from "./Common/OdBaseDragger";
26
-
27
- export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
28
- protected m_size_x: number;
29
- protected m_size_y: number;
30
- protected m_size_z: number;
31
- protected m_center: Point3d;
32
- protected m_normal: number[];
33
- protected index: number;
34
- protected m_model: any;
35
- protected m_entity: any;
36
- protected planePreview: any;
37
- protected m_last: Point3d;
38
- protected m_click: Point2d;
39
-
40
- constructor(subject: Viewer) {
41
- super(subject);
42
- this.press = false;
43
-
44
- //this.getViewer().getMarkupController().clear();
45
-
46
- const ext = this.getViewer().getActiveExtents();
47
- const min = ext.min();
48
- const max = ext.max();
49
-
50
- this.m_size_x = Math.abs(max[0] - min[0]) / 2;
51
- this.m_size_y = Math.abs(max[1] - min[1]) / 2;
52
- this.m_size_z = Math.abs(max[2] - min[2]) / 2;
53
-
54
- this.m_center = this.toPoint(ext.center());
55
- this.m_normal = this.createNormal();
56
-
57
- const avp = this.getViewer().activeView;
58
- const plane = this.createPlane();
59
- plane.set(this.toGePoint(this.m_center), this.m_normal);
60
-
61
- avp.addCuttingPlane(plane);
62
- this.index = avp.numCuttingPlanes() - 1;
63
-
64
- const { red, green, blue } = this.subject.options.cuttingPlaneFillColor;
65
- avp.setEnableCuttingPlaneFill(true, red, green, blue);
66
- avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kHorizontalBars, 0x0, 0x0, 0x0);
67
-
68
- this.m_model = this.getModel();
69
- this.createPreview();
70
-
71
- this.deleteAll([ext, avp, plane]);
72
- }
73
-
74
- override dispose(): void {
75
- super.dispose();
76
-
77
- if (this.m_entity) {
78
- this.m_model.removeEntity(this.m_entity);
79
- this.deleteAll([this.m_model, this.m_entity, this.planePreview, this.m_center]);
80
- this.m_entity = null;
81
- this.planePreview = null;
82
- this.subject.update();
83
- }
84
- }
85
-
86
- createNormal(): number[] {
87
- return [0, 0, 0];
88
- }
89
-
90
- handleDelta(delta: Point3d): Point3d {
91
- return delta;
92
- }
93
-
94
- getPlanePreviewCoordinate(): any[] {
95
- return [];
96
- }
97
-
98
- override start(x: number, y: number): void {
99
- this.press = true;
100
- this.m_last = this.screenToWorld(x, y);
101
- this.m_click = { x, y };
102
- }
103
-
104
- override drag(x: number, y: number): void {
105
- if (this.press) {
106
- const point = this.screenToWorld(x, y);
107
- const delta = this.handleDelta(point.sub(this.m_last));
108
-
109
- const oldCenter = this.m_center;
110
- this.m_center = oldCenter.add(delta);
111
-
112
- const oldLast = this.m_last;
113
- this.m_last = point;
114
-
115
- const avp = this.getViewer().activeView;
116
- const plane = this.createPlane();
117
- const newPlane = plane.set(this.toGePoint(this.m_center), this.m_normal);
118
- const newCutting = avp.updateCuttingPlane(this.index, plane);
119
-
120
- this.drawPreview();
121
-
122
- this.deleteAll([avp, plane, oldCenter, delta, oldLast, newPlane, newCutting]);
123
-
124
- const device = this.getViewer().getActiveDevice();
125
- device.invalidate(device.getSize());
126
- }
127
- }
128
-
129
- override end(x: number, y: number): void {
130
- this.press = false;
131
- if (x === this.m_click.x && y === this.m_click.y) {
132
- this.m_normal = [this.m_normal[0] * -1, this.m_normal[1] * -1, this.m_normal[2] * -1];
133
-
134
- const avp = this.getViewer().activeView;
135
- const plane = this.createPlane();
136
- plane.set(this.toGePoint(this.m_center), this.m_normal);
137
- avp.updateCuttingPlane(this.index, plane);
138
-
139
- this.deleteAll([avp, plane, this.m_last]);
140
-
141
- const device = this.getViewer().getActiveDevice();
142
- device.invalidate(device.getSize());
143
- }
144
- }
145
-
146
- createPreview(): void {
147
- this.m_entity = this.m_model.appendEntity("&CuttingPlanePreview");
148
-
149
- const GeometryTypes = this.m_module.GeometryTypes;
150
-
151
- const transparencyDef = new this.m_module.OdTvTransparencyDef();
152
- const colorDef = new this.m_module.OdTvColorDef(112, 112, 112); //0x53, 0x72, 0xAE
153
-
154
- transparencyDef.setValue(0.9);
155
-
156
- const entityPtr = this.m_entity.openObject();
157
- entityPtr.setColor(colorDef, GeometryTypes.kFaces.value);
158
-
159
- colorDef.setColor(112, 112, 112); //0xcd, 0xe2, 0xff
160
- entityPtr.setColor(colorDef, GeometryTypes.kEdges.value);
161
-
162
- entityPtr.setLineWeight(5);
163
-
164
- entityPtr.setTransparency(transparencyDef, GeometryTypes.kFaces);
165
- transparencyDef.setValue(1.0);
166
- entityPtr.setTransparency(transparencyDef, GeometryTypes.kEdges);
167
-
168
- this.planePreview = entityPtr.appendPolygon(this.getPlanePreviewCoordinate());
169
- const polygonPtr = this.planePreview.openAsPolygon();
170
- polygonPtr.setFilled(true);
171
-
172
- this.deleteAll([transparencyDef, colorDef, entityPtr, polygonPtr, GeometryTypes]);
173
- this.subject.syncOverlay();
174
- }
175
-
176
- drawPreview(): void {
177
- const polygonPtr = this.planePreview.openAsPolygon();
178
- polygonPtr.setPoints(this.getPlanePreviewCoordinate());
179
- this.deleteAll([polygonPtr]);
180
- this.subject.syncOverlay();
181
- }
182
- }
@@ -1,53 +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
- import { Point3d } from "./Common/Geometry";
24
- import { OdBaseCuttingPlaneDragger } from "./OdBaseCuttingPlaneDragger";
25
-
26
- export class OdCuttingPlaneXAxisDragger extends OdBaseCuttingPlaneDragger {
27
- override createNormal(): number[] {
28
- return [1, 0, 0];
29
- }
30
-
31
- override handleDelta(delta: Point3d): Point3d {
32
- delta.y = 0.0;
33
- delta.z = 0.0;
34
- return delta;
35
- }
36
-
37
- override getPlanePreviewCoordinate(): number[] {
38
- return [
39
- this.m_center.x,
40
- this.m_center.y - this.m_size_y,
41
- this.m_center.z - this.m_size_z,
42
- this.m_center.x,
43
- this.m_center.y + this.m_size_y,
44
- this.m_center.z - this.m_size_z,
45
- this.m_center.x,
46
- this.m_center.y + this.m_size_y,
47
- this.m_center.z + this.m_size_z,
48
- this.m_center.x,
49
- this.m_center.y - this.m_size_y,
50
- this.m_center.z + this.m_size_z,
51
- ];
52
- }
53
- }
@@ -1,53 +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
- import { Point3d } from "./Common/Geometry";
24
- import { OdBaseCuttingPlaneDragger } from "./OdBaseCuttingPlaneDragger";
25
-
26
- export class OdCuttingPlaneYAxisDragger extends OdBaseCuttingPlaneDragger {
27
- override createNormal(): number[] {
28
- return [0, 1, 0];
29
- }
30
-
31
- override handleDelta(delta: Point3d): Point3d {
32
- delta.x = 0.0;
33
- delta.z = 0.0;
34
- return delta;
35
- }
36
-
37
- override getPlanePreviewCoordinate(): number[] {
38
- return [
39
- this.m_center.x - this.m_size_x,
40
- this.m_center.y,
41
- this.m_center.z - this.m_size_z,
42
- this.m_center.x + this.m_size_x,
43
- this.m_center.y,
44
- this.m_center.z - this.m_size_z,
45
- this.m_center.x + this.m_size_x,
46
- this.m_center.y,
47
- this.m_center.z + this.m_size_z,
48
- this.m_center.x - this.m_size_x,
49
- this.m_center.y,
50
- this.m_center.z + this.m_size_z,
51
- ];
52
- }
53
- }