@inweb/client 25.2.2 → 25.2.8

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 (224) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +70 -70
  3. package/dist/client.js +12369 -11952
  4. package/dist/client.js.map +1 -1
  5. package/dist/client.min.js +1 -1
  6. package/dist/client.module.js +714 -235
  7. package/dist/client.module.js.map +1 -1
  8. package/lib/Api/Assembly.d.ts +338 -338
  9. package/lib/Api/ClashTest.d.ts +175 -175
  10. package/lib/Api/Client.d.ts +451 -451
  11. package/lib/Api/ClientEvents.d.ts +28 -28
  12. package/lib/Api/File.d.ts +567 -567
  13. package/lib/Api/HttpClient.d.ts +12 -12
  14. package/lib/Api/IAssembly.d.ts +13 -13
  15. package/lib/Api/IFile.d.ts +45 -45
  16. package/lib/Api/IHttpClient.d.ts +10 -10
  17. package/lib/Api/IUser.d.ts +10 -10
  18. package/lib/Api/Job.d.ts +141 -141
  19. package/lib/Api/Member.d.ts +84 -84
  20. package/lib/Api/Model.d.ts +146 -146
  21. package/lib/Api/Permission.d.ts +92 -92
  22. package/lib/Api/Project.d.ts +246 -246
  23. package/lib/Api/Role.d.ts +81 -81
  24. package/lib/Api/User.d.ts +196 -196
  25. package/lib/Api/impl/FetchError.d.ts +17 -17
  26. package/lib/Api/impl/Utils.d.ts +32 -32
  27. package/lib/Api/impl/http.d.ts +66 -66
  28. package/lib/ConvetMath.d.ts +28 -28
  29. package/lib/Viewer/CanvasEvents.d.ts +1 -1
  30. package/lib/Viewer/Commands/ApplyModelTransform.d.ts +1 -1
  31. package/lib/Viewer/Commands/ClearMarkup.d.ts +1 -1
  32. package/lib/Viewer/Commands/ClearSlices.d.ts +1 -1
  33. package/lib/Viewer/Commands/CreatePreview.d.ts +1 -1
  34. package/lib/Viewer/Commands/Explode.d.ts +1 -1
  35. package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +1 -1
  36. package/lib/Viewer/Commands/GetModels.d.ts +1 -1
  37. package/lib/Viewer/Commands/GetSelected.d.ts +1 -1
  38. package/lib/Viewer/Commands/HideSelected.d.ts +1 -1
  39. package/lib/Viewer/Commands/IsolateSelected.d.ts +1 -1
  40. package/lib/Viewer/Commands/RegenerateAll.d.ts +1 -1
  41. package/lib/Viewer/Commands/ResetView.d.ts +1 -1
  42. package/lib/Viewer/Commands/SelectModel.d.ts +1 -1
  43. package/lib/Viewer/Commands/SetActiveDragger.d.ts +1 -1
  44. package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +1 -1
  45. package/lib/Viewer/Commands/SetMarkupColor.d.ts +1 -1
  46. package/lib/Viewer/Commands/SetSelected.d.ts +1 -1
  47. package/lib/Viewer/Commands/ShowAll.d.ts +1 -1
  48. package/lib/Viewer/Commands/Unselect.d.ts +1 -1
  49. package/lib/Viewer/Commands/ZoomToExtents.d.ts +1 -1
  50. package/lib/Viewer/Commands/ZoomToObjects.d.ts +1 -1
  51. package/lib/Viewer/Commands/ZoomToSelected.d.ts +1 -1
  52. package/lib/Viewer/Commands.d.ts +2 -2
  53. package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +21 -21
  54. package/lib/Viewer/Draggers/Actions/PanAction.d.ts +17 -17
  55. package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +7 -7
  56. package/lib/Viewer/Draggers/Common/Geometry.d.ts +114 -114
  57. package/lib/Viewer/Draggers/Common/GestureManager.d.ts +40 -40
  58. package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +53 -53
  59. package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +29 -29
  60. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +30 -30
  61. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +19 -19
  62. package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +23 -23
  63. package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +26 -26
  64. package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +7 -7
  65. package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +7 -7
  66. package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +7 -7
  67. package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +14 -14
  68. package/lib/Viewer/Draggers/OdPanDragger.d.ts +11 -11
  69. package/lib/Viewer/Draggers/OdZoomDragger.d.ts +11 -11
  70. package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +10 -10
  71. package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +18 -18
  72. package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +13 -13
  73. package/lib/Viewer/Draggers/OdaLineDragger.d.ts +14 -14
  74. package/lib/Viewer/Draggers/OdaTextDragger.d.ts +15 -15
  75. package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +29 -29
  76. package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +18 -18
  77. package/lib/Viewer/EventEmitter2.d.ts +53 -53
  78. package/lib/Viewer/ICommands.d.ts +24 -24
  79. package/lib/Viewer/IEventEmitter2.d.ts +12 -12
  80. package/lib/Viewer/IViewer.d.ts +28 -26
  81. package/lib/Viewer/Loaders/BaseLoader.d.ts +10 -10
  82. package/lib/Viewer/Loaders/LoaderFactory.d.ts +10 -9
  83. package/lib/Viewer/Loaders/TCSLoader.d.ts +4 -4
  84. package/lib/Viewer/Loaders/UpdaterController.d.ts +14 -14
  85. package/lib/Viewer/Loaders/VsfXLoader.d.ts +4 -4
  86. package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +4 -4
  87. package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +5 -0
  88. package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +21 -11
  89. package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +15 -0
  90. package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +4 -4
  91. package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +14 -14
  92. package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +14 -14
  93. package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +18 -10
  94. package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +11 -11
  95. package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +14 -14
  96. package/lib/Viewer/Markup/Api/IMarkupText.d.ts +12 -12
  97. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +46 -31
  98. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaCloud.d.ts +36 -0
  99. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +40 -39
  100. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +36 -35
  101. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +35 -31
  102. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +38 -37
  103. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +37 -36
  104. package/lib/Viewer/Markup/IMarkup.d.ts +38 -37
  105. package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +71 -62
  106. package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +18 -18
  107. package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +33 -32
  108. package/lib/Viewer/Markup/MarkupFactory.d.ts +6 -6
  109. package/lib/Viewer/Options.d.ts +238 -227
  110. package/lib/Viewer/OptionsEvents.d.ts +25 -25
  111. package/lib/Viewer/Viewer.d.ts +358 -352
  112. package/lib/Viewer/ViewerCommands.d.ts +22 -22
  113. package/lib/Viewer/ViewerEvents.d.ts +600 -600
  114. package/lib/Viewer/utils.d.ts +3 -3
  115. package/lib/index.d.ts +23 -23
  116. package/package.json +38 -32
  117. package/src/Api/Assembly.ts +678 -678
  118. package/src/Api/ClashTest.ts +290 -290
  119. package/src/Api/Client.ts +816 -816
  120. package/src/Api/ClientEvents.ts +31 -31
  121. package/src/Api/File.ts +962 -962
  122. package/src/Api/HttpClient.ts +73 -73
  123. package/src/Api/IAssembly.ts +37 -37
  124. package/src/Api/IFile.ts +74 -74
  125. package/src/Api/IHttpClient.ts +50 -50
  126. package/src/Api/IUser.ts +33 -33
  127. package/src/Api/Job.ts +253 -253
  128. package/src/Api/Member.ts +161 -161
  129. package/src/Api/Model.ts +259 -259
  130. package/src/Api/Permission.ts +173 -173
  131. package/src/Api/Project.ts +479 -479
  132. package/src/Api/Role.ts +158 -158
  133. package/src/Api/User.ts +357 -357
  134. package/src/Api/impl/FetchError.ts +48 -48
  135. package/src/Api/impl/Utils.ts +367 -367
  136. package/src/Api/impl/http.ts +92 -92
  137. package/src/ConvetMath.ts +372 -372
  138. package/src/Viewer/CanvasEvents.ts +41 -41
  139. package/src/Viewer/Commands/ApplyModelTransform.ts +70 -70
  140. package/src/Viewer/Commands/ClearMarkup.ts +28 -28
  141. package/src/Viewer/Commands/ClearSlices.ts +27 -27
  142. package/src/Viewer/Commands/CreatePreview.ts +33 -33
  143. package/src/Viewer/Commands/Explode.ts +38 -38
  144. package/src/Viewer/Commands/GetDefaultViewPositions.ts +36 -36
  145. package/src/Viewer/Commands/GetModels.ts +43 -43
  146. package/src/Viewer/Commands/GetSelected.ts +58 -58
  147. package/src/Viewer/Commands/HideSelected.ts +37 -37
  148. package/src/Viewer/Commands/IsolateSelected.ts +37 -37
  149. package/src/Viewer/Commands/RegenerateAll.ts +37 -37
  150. package/src/Viewer/Commands/ResetView.ts +43 -43
  151. package/src/Viewer/Commands/SelectModel.ts +52 -52
  152. package/src/Viewer/Commands/SetActiveDragger.ts +29 -29
  153. package/src/Viewer/Commands/SetDefaultViewPosition.ts +50 -50
  154. package/src/Viewer/Commands/SetMarkupColor.ts +29 -29
  155. package/src/Viewer/Commands/SetSelected.ts +47 -47
  156. package/src/Viewer/Commands/ShowAll.ts +37 -37
  157. package/src/Viewer/Commands/Unselect.ts +37 -37
  158. package/src/Viewer/Commands/ZoomToExtents.ts +43 -43
  159. package/src/Viewer/Commands/ZoomToObjects.ts +47 -47
  160. package/src/Viewer/Commands/ZoomToSelected.ts +39 -39
  161. package/src/Viewer/Commands.ts +81 -81
  162. package/src/Viewer/Draggers/Actions/OrbitAction.ts +250 -250
  163. package/src/Viewer/Draggers/Actions/PanAction.ts +102 -102
  164. package/src/Viewer/Draggers/Actions/ZoomAction.ts +45 -45
  165. package/src/Viewer/Draggers/Common/Geometry.ts +152 -152
  166. package/src/Viewer/Draggers/Common/GestureManager.ts +263 -263
  167. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +270 -270
  168. package/src/Viewer/Draggers/Common/OdaGeAction.ts +146 -146
  169. package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +248 -248
  170. package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +182 -182
  171. package/src/Viewer/Draggers/MeasureLineDragger/index.ts +166 -166
  172. package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +182 -182
  173. package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +53 -53
  174. package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +53 -53
  175. package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +53 -53
  176. package/src/Viewer/Draggers/OdOrbitDragger.ts +70 -70
  177. package/src/Viewer/Draggers/OdPanDragger.ts +62 -62
  178. package/src/Viewer/Draggers/OdZoomDragger.ts +59 -59
  179. package/src/Viewer/Draggers/OdZoomWheelDragger.ts +103 -103
  180. package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +123 -123
  181. package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +75 -75
  182. package/src/Viewer/Draggers/OdaLineDragger.ts +80 -80
  183. package/src/Viewer/Draggers/OdaTextDragger.ts +118 -118
  184. package/src/Viewer/Draggers/OdaWalkDragger.ts +278 -278
  185. package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +184 -184
  186. package/src/Viewer/EventEmitter2.ts +116 -116
  187. package/src/Viewer/ICommands.ts +53 -53
  188. package/src/Viewer/IEventEmitter2.ts +36 -36
  189. package/src/Viewer/IViewer.ts +58 -55
  190. package/src/Viewer/Loaders/BaseLoader.ts +40 -40
  191. package/src/Viewer/Loaders/LoaderFactory.ts +47 -44
  192. package/src/Viewer/Loaders/TCSLoader.ts +82 -82
  193. package/src/Viewer/Loaders/UpdaterController.ts +36 -36
  194. package/src/Viewer/Loaders/VsfXLoader.ts +65 -87
  195. package/src/Viewer/Loaders/VsfXPartialLoader.ts +208 -208
  196. package/src/Viewer/Loaders/VsfXStreamingLoader.ts +87 -0
  197. package/src/Viewer/Markup/Api/IMarkupArrow.ts +12 -15
  198. package/src/Viewer/Markup/Api/IMarkupCloud.ts +15 -0
  199. package/src/Viewer/Markup/Api/IMarkupColorable.ts +4 -4
  200. package/src/Viewer/Markup/Api/IMarkupEllipse.ts +15 -15
  201. package/src/Viewer/Markup/Api/IMarkupImage.ts +15 -15
  202. package/src/Viewer/Markup/Api/IMarkupLine.ts +20 -10
  203. package/src/Viewer/Markup/Api/IMarkupObject.ts +15 -15
  204. package/src/Viewer/Markup/Api/IMarkupRectangle.ts +15 -15
  205. package/src/Viewer/Markup/Api/IMarkupText.ts +12 -12
  206. package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +117 -119
  207. package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +208 -0
  208. package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +118 -113
  209. package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +123 -121
  210. package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +130 -99
  211. package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +119 -113
  212. package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +110 -104
  213. package/src/Viewer/Markup/IMarkup.ts +40 -39
  214. package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +1144 -872
  215. package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +39 -39
  216. package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +231 -273
  217. package/src/Viewer/Markup/MarkupFactory.ts +32 -32
  218. package/src/Viewer/Options.ts +522 -502
  219. package/src/Viewer/OptionsEvents.ts +28 -28
  220. package/src/Viewer/Viewer.ts +1191 -1109
  221. package/src/Viewer/ViewerCommands.ts +45 -45
  222. package/src/Viewer/ViewerEvents.ts +700 -700
  223. package/src/Viewer/utils.ts +74 -74
  224. package/src/index.ts +48 -48
@@ -872,6 +872,7 @@ class Options {
872
872
  cameraAxisXSpeed: 4,
873
873
  cameraAxisYSpeed: 1,
874
874
  ambientOcclusion: false,
875
+ enableStreamingMode: true,
875
876
  enablePartialMode: false,
876
877
  memoryLimit: 3294967296,
877
878
  cuttingPlaneFillColor: {
@@ -1018,6 +1019,13 @@ class Options {
1018
1019
  this._data.ambientOcclusion = value;
1019
1020
  this.notifierChangeEvent();
1020
1021
  }
1022
+ get enableStreamingMode() {
1023
+ return this._data.enableStreamingMode;
1024
+ }
1025
+ set enableStreamingMode(value) {
1026
+ this._data.enableStreamingMode = value;
1027
+ this.notifierChangeEvent();
1028
+ }
1021
1029
  get enablePartialMode() {
1022
1030
  return this._data.enablePartialMode;
1023
1031
  }
@@ -2069,7 +2077,7 @@ class Client extends EventEmitter2 {
2069
2077
  return this._httpClient.get("/version").then((response => response.json())).then((data => ({
2070
2078
  ...data,
2071
2079
  server: data.version,
2072
- client: "25.2.2"
2080
+ client: "25.2.8"
2073
2081
  })));
2074
2082
  }
2075
2083
  registerUser(email, password, userName) {
@@ -4339,7 +4347,7 @@ class UpdaterController {
4339
4347
  }
4340
4348
  }
4341
4349
 
4342
- class VsfXLoader extends BaseLoader {
4350
+ class VsfXStreamingLoader extends BaseLoader {
4343
4351
  async load() {
4344
4352
  if (!this.viewer.visualizeJs) return;
4345
4353
  const visLib = this.viewer.visLib();
@@ -4587,11 +4595,56 @@ class VsfXPartialLoader extends BaseLoader {
4587
4595
  }
4588
4596
  }
4589
4597
 
4598
+ class VsfXLoader extends BaseLoader {
4599
+ async load() {
4600
+ if (!this.viewer.visualizeJs) return;
4601
+ const visLib = this.viewer.visLib();
4602
+ const visViewer = visLib.getViewer();
4603
+ const abortController = new AbortController;
4604
+ this.viewer._abortController = abortController;
4605
+ console.time("File load time");
4606
+ try {
4607
+ this.viewer.emitEvent({
4608
+ type: "geometrystart",
4609
+ model: this.model
4610
+ });
4611
+ const progressCb = progress => this.viewer.emitEvent({
4612
+ type: "geometryprogress",
4613
+ data: progress,
4614
+ model: this.model
4615
+ });
4616
+ const arrayBuffer = await this.model.downloadResource(this.model.database, progressCb, abortController.signal);
4617
+ if (abortController.signal.aborted) {
4618
+ await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
4619
+ }
4620
+ if (this.viewer.visualizeJs) {
4621
+ visViewer.parseVsfx(new Uint8Array(arrayBuffer));
4622
+ this.viewer.update(true);
4623
+ this.viewer.syncOpenCloudVisualStyle(false);
4624
+ this.viewer.syncOptions();
4625
+ this.viewer.resize();
4626
+ }
4627
+ console.timeEnd("File load time");
4628
+ this.viewer.emitEvent({
4629
+ type: "geometryend",
4630
+ model: this.model
4631
+ });
4632
+ } catch (error) {
4633
+ this.viewer.emitEvent({
4634
+ type: "geometryerror",
4635
+ data: error,
4636
+ model: this.model
4637
+ });
4638
+ throw error;
4639
+ }
4640
+ }
4641
+ }
4642
+
4590
4643
  class LoaderFactory {
4591
4644
  create(viewer, model, options) {
4592
4645
  const geometryType = model.database.split(".").pop();
4593
4646
  if (model.geometry.length === 0 && geometryType === "vsfx") {
4594
- return options.enablePartialMode ? new VsfXPartialLoader(viewer, model, options) : new VsfXLoader(viewer, model, options);
4647
+ if (!options.enableStreamingMode) return new VsfXLoader(viewer, model, options); else if (options.enablePartialMode) return new VsfXPartialLoader(viewer, model, options); else return new VsfXStreamingLoader(viewer, model, options);
4595
4648
  }
4596
4649
  if (geometryType === "data") {
4597
4650
  return new TCSLoader(viewer, model, options);
@@ -4617,6 +4670,7 @@ var MarkupMode;
4617
4670
  MarkupMode["Ellipse"] = "Ellipse";
4618
4671
  MarkupMode["Arrow"] = "Arrow";
4619
4672
  MarkupMode["Image"] = "Image";
4673
+ MarkupMode["Cloud"] = "Cloud";
4620
4674
  })(MarkupMode || (MarkupMode = {}));
4621
4675
 
4622
4676
  class MarkupColor {
@@ -4648,12 +4702,22 @@ class MarkupColor {
4648
4702
  }
4649
4703
  }
4650
4704
 
4705
+ var LineType;
4706
+
4707
+ (function(LineType) {
4708
+ LineType[LineType["Unknown"] = 0] = "Unknown";
4709
+ LineType["Solid"] = "solid";
4710
+ LineType["Dot"] = "dot";
4711
+ LineType["Dash"] = "dash";
4712
+ })(LineType || (LineType = {}));
4713
+
4714
+ const LineTypeSpecs = new Map([ [ LineType.Solid, [] ], [ LineType.Dot, [ 30, 30, .001, 30 ] ], [ LineType.Dash, [ 30, 30 ] ] ]);
4715
+
4651
4716
  class KonvaLine {
4652
4717
  constructor(params, ref = null) {
4653
4718
  var _a, _b;
4654
4719
  if (ref) {
4655
4720
  this._ref = ref;
4656
- this._ref.id(this._ref._id.toString());
4657
4721
  return;
4658
4722
  }
4659
4723
  if (!params.points) return;
@@ -4667,7 +4731,8 @@ class KonvaLine {
4667
4731
  lineJoin: "round",
4668
4732
  points: konvaPoints,
4669
4733
  draggable: true,
4670
- strokeScaleEnabled: false
4734
+ strokeScaleEnabled: false,
4735
+ dash: LineTypeSpecs.get(params.type) || []
4671
4736
  });
4672
4737
  this._ref.id(this._ref._id.toString());
4673
4738
  }
@@ -4706,7 +4771,7 @@ class KonvaLine {
4706
4771
  this._ref = null;
4707
4772
  }
4708
4773
  getPoints() {
4709
- return this._ref.attrs.points;
4774
+ return this._ref.points();
4710
4775
  }
4711
4776
  setLineWidth(size) {
4712
4777
  this._ref.strokeWidth(size);
@@ -4714,6 +4779,27 @@ class KonvaLine {
4714
4779
  getLineWidth() {
4715
4780
  return this._ref.strokeWidth();
4716
4781
  }
4782
+ getLineType() {
4783
+ const typeSpecs = this._ref.dash() || [];
4784
+ let type = "solid";
4785
+ switch (typeSpecs) {
4786
+ case LineTypeSpecs.get(LineType.Dot):
4787
+ type = "dot";
4788
+ break;
4789
+
4790
+ case LineTypeSpecs.get(LineType.Dash):
4791
+ type = "dash";
4792
+ break;
4793
+ }
4794
+ return type;
4795
+ }
4796
+ setLineType(type) {
4797
+ const lineType = LineType[type];
4798
+ if (lineType) {
4799
+ const specs = LineTypeSpecs.get(lineType);
4800
+ if (specs) this._ref.dash(specs);
4801
+ }
4802
+ }
4717
4803
  addPoints(points) {
4718
4804
  let newPoints = this._ref.points();
4719
4805
  points.forEach((point => {
@@ -4729,7 +4815,6 @@ class KonvaText {
4729
4815
  this.TEXT_FONT_FAMILY = "Calibri";
4730
4816
  if (ref) {
4731
4817
  this._ref = ref;
4732
- this._ref.id(this._ref._id.toString());
4733
4818
  return;
4734
4819
  }
4735
4820
  if (!params || !params.text) return;
@@ -4808,18 +4893,17 @@ class KonvaRectangle {
4808
4893
  var _a, _b;
4809
4894
  if (ref) {
4810
4895
  this._ref = ref;
4811
- this._ref.id(this._ref._id.toString());
4812
4896
  return;
4813
4897
  }
4814
- if (!params.pos) return;
4898
+ if (!params.position) return;
4815
4899
  this._ref = new Konva.Rect({
4816
4900
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
4817
4901
  strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
4818
4902
  globalCompositeOperation: "source-over",
4819
4903
  lineCap: "round",
4820
4904
  lineJoin: "round",
4821
- x: params.pos.x,
4822
- y: params.pos.y,
4905
+ x: params.position.x,
4906
+ y: params.position.y,
4823
4907
  width: params.width,
4824
4908
  height: params.height,
4825
4909
  draggable: true,
@@ -4895,18 +4979,17 @@ class KonvaEllipse {
4895
4979
  var _a, _b;
4896
4980
  if (ref) {
4897
4981
  this._ref = ref;
4898
- this._ref.id(this._ref._id.toString());
4899
4982
  return;
4900
4983
  }
4901
- if (!params.pos) return;
4984
+ if (!params.position) return;
4902
4985
  this._ref = new Konva.Ellipse({
4903
4986
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
4904
4987
  strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
4905
4988
  globalCompositeOperation: "source-over",
4906
4989
  lineCap: "round",
4907
4990
  lineJoin: "round",
4908
- x: params.pos.x,
4909
- y: params.pos.y,
4991
+ x: params.position.x,
4992
+ y: params.position.y,
4910
4993
  radiusX: params.radius.x,
4911
4994
  radiusY: params.radius.y,
4912
4995
  draggable: true,
@@ -4985,23 +5068,20 @@ class KonvaEllipse {
4985
5068
 
4986
5069
  class KonvaArrow {
4987
5070
  constructor(params, ref = null) {
4988
- var _a, _b, _c;
5071
+ var _a, _b;
4989
5072
  if (ref) {
4990
5073
  this._ref = ref;
4991
- this._ref.id(this._ref._id.toString());
4992
5074
  return;
4993
5075
  }
4994
- if (!params.points) return;
5076
+ if (!params.start || !params.end) return;
4995
5077
  this._ref = new Konva.Arrow({
4996
5078
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
4997
5079
  fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
4998
- strokeWidth: (_c = params.lineWidth) !== null && _c !== void 0 ? _c : 4,
5080
+ strokeWidth: 4,
4999
5081
  globalCompositeOperation: "source-over",
5000
5082
  lineCap: "round",
5001
5083
  lineJoin: "round",
5002
- points: params.points,
5003
- pointerWidth: params.pointerWidth,
5004
- pointerLength: params.pointerLength,
5084
+ points: [ params.start.x, params.start.y, params.end.x, params.end.y ],
5005
5085
  draggable: true,
5006
5086
  strokeScaleEnabled: false
5007
5087
  });
@@ -5042,28 +5122,41 @@ class KonvaArrow {
5042
5122
  this._ref = null;
5043
5123
  }
5044
5124
  getPoints() {
5045
- return this._ref.attrs.points;
5125
+ const points = this._ref.points();
5126
+ return [ {
5127
+ x: points[0],
5128
+ y: points[1]
5129
+ }, {
5130
+ x: points[2],
5131
+ y: points[3]
5132
+ } ];
5046
5133
  }
5047
5134
  setPoints(points) {
5048
- this._ref.points(points);
5049
- }
5050
- getPointerWidth() {
5051
- return this._ref.pointerWidth();
5052
- }
5053
- setPointerWidth(w) {
5054
- this._ref.pointerWidth(w);
5135
+ if (points.length === 2) {
5136
+ this._ref.points([ points[0].x, points[0].y, points[1].x, points[1].y ]);
5137
+ }
5055
5138
  }
5056
- getPointerLength() {
5057
- return this._ref.pointerLength();
5139
+ getStartPoint() {
5140
+ const points = this._ref.points();
5141
+ return {
5142
+ x: points[0],
5143
+ y: points[1]
5144
+ };
5058
5145
  }
5059
- setPointerLength(l) {
5060
- this._ref.pointerLength(l);
5146
+ setStartPoint(x, y) {
5147
+ const points = this._ref.points();
5148
+ this._ref.points([ x, y, points[2], points[3] ]);
5061
5149
  }
5062
- getLineWidth() {
5063
- return this._ref.strokeWidth();
5150
+ getEndPoint() {
5151
+ const points = this._ref.points();
5152
+ return {
5153
+ x: points[2],
5154
+ y: points[3]
5155
+ };
5064
5156
  }
5065
- setLineWidth(size) {
5066
- this._ref.strokeWidth(size);
5157
+ setEndPoint(x, y) {
5158
+ const points = this._ref.points();
5159
+ this._ref.points([ points[0], points[1], x, y ]);
5067
5160
  }
5068
5161
  }
5069
5162
 
@@ -5074,7 +5167,6 @@ class KonvaImage {
5074
5167
  if (ref.height() === 0 || ref.width() === 0) return;
5075
5168
  this._ref = ref;
5076
5169
  this._canvasImage = ref.image();
5077
- this._ref.id(this._ref._id.toString());
5078
5170
  this._ratio = this._ref.height() / this._ref.width();
5079
5171
  return;
5080
5172
  }
@@ -5154,6 +5246,181 @@ class KonvaImage {
5154
5246
  }
5155
5247
  }
5156
5248
 
5249
+ class KonvaCloud {
5250
+ constructor(params, ref = null) {
5251
+ var _a, _b, _c, _d;
5252
+ if (ref) {
5253
+ this._ref = ref;
5254
+ return;
5255
+ }
5256
+ if (!params.position || !params.width || !params.height) return;
5257
+ const arcRadius = 16;
5258
+ this._ref = new Konva.Shape({
5259
+ x: params.position.x,
5260
+ y: params.position.y,
5261
+ width: (_a = params.width) !== null && _a !== void 0 ? _a : 200,
5262
+ height: (_b = params.height) !== null && _b !== void 0 ? _b : 200,
5263
+ stroke: (_c = params.color) !== null && _c !== void 0 ? _c : "#ff0000",
5264
+ strokeWidth: (_d = params.lineWidth) !== null && _d !== void 0 ? _d : 5,
5265
+ draggable: true,
5266
+ strokeScaleEnabled: false,
5267
+ globalCompositeOperation: "source-over",
5268
+ sceneFunc: (context, shape) => {
5269
+ function calculateMidpoint(position, width, height) {
5270
+ const midX = position.x + width / 2;
5271
+ const midY = position.y + height / 2;
5272
+ return {
5273
+ x: midX,
5274
+ y: midY
5275
+ };
5276
+ }
5277
+ const points = [ {
5278
+ x: 0,
5279
+ y: 0
5280
+ }, {
5281
+ x: 0 + this._ref.width(),
5282
+ y: 0
5283
+ }, {
5284
+ x: 0 + this._ref.width(),
5285
+ y: 0 + this._ref.height()
5286
+ }, {
5287
+ x: 0,
5288
+ y: 0 + this._ref.height()
5289
+ }, {
5290
+ x: 0,
5291
+ y: 0
5292
+ } ];
5293
+ const midPoint = calculateMidpoint({
5294
+ x: 0,
5295
+ y: 0
5296
+ }, this._ref.width(), this._ref.height());
5297
+ const baseArcLength = 30;
5298
+ context.beginPath();
5299
+ for (let iPoint = 0; iPoint < points.length - 1; iPoint++) {
5300
+ let approxArcLength = baseArcLength;
5301
+ const dx = points[iPoint + 1].x - points[iPoint].x;
5302
+ const dy = points[iPoint + 1].y - points[iPoint].y;
5303
+ const length = Math.sqrt(dx * dx + dy * dy);
5304
+ const arcCount = Math.floor(length / approxArcLength);
5305
+ const lengthMod = length % approxArcLength;
5306
+ approxArcLength = baseArcLength + arcCount / lengthMod;
5307
+ let pX = points[iPoint].x + dx / arcCount / 2;
5308
+ let pY = points[iPoint].y + dy / arcCount / 2;
5309
+ const pEndX = points[iPoint + 1].x;
5310
+ const pEndY = points[iPoint + 1].y;
5311
+ const endAngle = Math.atan((pEndY - pY) / (pEndX - pX));
5312
+ const startAngle = endAngle + Math.PI;
5313
+ const counterClockwise = pX > midPoint.x && pY > midPoint.y;
5314
+ for (let iArc = 0; iArc < arcCount; iArc++) {
5315
+ if (counterClockwise) {
5316
+ context.arc(pX, pY, arcRadius, endAngle, startAngle);
5317
+ } else {
5318
+ context.arc(pX, pY, arcRadius, startAngle, endAngle);
5319
+ }
5320
+ pX += dx / arcCount;
5321
+ pY += dy / arcCount;
5322
+ }
5323
+ }
5324
+ context.closePath();
5325
+ context.fillStrokeShape(shape);
5326
+ }
5327
+ });
5328
+ this._ref.className = "Cloud";
5329
+ this._ref.on("transform", (e => {
5330
+ const attrs = e.target.attrs;
5331
+ const minWidth = 100;
5332
+ const minHeight = 100;
5333
+ const newWidth = this._ref.width() * attrs.scaleX;
5334
+ const newHeight = this._ref.height() * attrs.scaleY;
5335
+ if (newWidth < minWidth || newHeight < minHeight) {
5336
+ this._ref.scale({
5337
+ x: 1,
5338
+ y: 1
5339
+ });
5340
+ return;
5341
+ }
5342
+ if (Math.abs(attrs.scaleX - 1) > 1e-5) {
5343
+ this._ref.width(newWidth);
5344
+ }
5345
+ if (Math.abs(attrs.scaleY - 1) > 1e-5) {
5346
+ this._ref.height(newHeight);
5347
+ }
5348
+ this._ref.scale({
5349
+ x: 1,
5350
+ y: 1
5351
+ });
5352
+ }));
5353
+ this._ref.getSelfRect = () => ({
5354
+ x: 0 - arcRadius,
5355
+ y: 0 - arcRadius,
5356
+ width: this._ref.width() + 2 * arcRadius,
5357
+ height: this._ref.height() + 2 * arcRadius
5358
+ });
5359
+ this._ref.id(this._ref._id.toString());
5360
+ }
5361
+ ref() {
5362
+ return this._ref;
5363
+ }
5364
+ id() {
5365
+ return this._ref.id();
5366
+ }
5367
+ enableMouseEditing(value) {
5368
+ this._ref.draggable(value);
5369
+ }
5370
+ type() {
5371
+ return "cloud";
5372
+ }
5373
+ getColor() {
5374
+ return this._ref.stroke();
5375
+ }
5376
+ setColor(hex) {
5377
+ this._ref.stroke(hex);
5378
+ }
5379
+ getRotation() {
5380
+ return this._ref.rotation();
5381
+ }
5382
+ setRotation(degrees) {
5383
+ this._ref.rotation(degrees);
5384
+ }
5385
+ getZIndex() {
5386
+ return this._ref.zIndex();
5387
+ }
5388
+ setZIndex(zIndex) {
5389
+ this._ref.zIndex(zIndex);
5390
+ }
5391
+ delete() {
5392
+ this._ref.destroy();
5393
+ this._ref = null;
5394
+ }
5395
+ getPosition() {
5396
+ return this._ref.position();
5397
+ }
5398
+ setPosition(x, y) {
5399
+ this._ref.position({
5400
+ x: x,
5401
+ y: y
5402
+ });
5403
+ }
5404
+ getWidth() {
5405
+ return this._ref.width();
5406
+ }
5407
+ setWidth(w) {
5408
+ this._ref.width(w);
5409
+ }
5410
+ getHeigth() {
5411
+ return this._ref.height();
5412
+ }
5413
+ setHeight(h) {
5414
+ this._ref.height(h);
5415
+ }
5416
+ getLineWidth() {
5417
+ return this._ref.strokeWidth();
5418
+ }
5419
+ setLineWidth(size) {
5420
+ this._ref.strokeWidth(size);
5421
+ }
5422
+ }
5423
+
5157
5424
  const MarkupMode2Konva = new Map([ [ MarkupMode.Line, {
5158
5425
  name: "Line",
5159
5426
  initializer: ref => new KonvaLine(null, ref)
@@ -5172,6 +5439,9 @@ const MarkupMode2Konva = new Map([ [ MarkupMode.Line, {
5172
5439
  } ], [ MarkupMode.Image, {
5173
5440
  name: "Image",
5174
5441
  initializer: ref => new KonvaImage(null, ref)
5442
+ } ], [ MarkupMode.Cloud, {
5443
+ name: "Cloud",
5444
+ initializer: ref => new KonvaCloud(null, ref)
5175
5445
  } ] ]);
5176
5446
 
5177
5447
  class KonvaMarkup {
@@ -5272,106 +5542,33 @@ class KonvaMarkup {
5272
5542
  }));
5273
5543
  this._konvaLayer.draw();
5274
5544
  }
5275
- drawViewpoint(viewpoint) {
5276
- function getLogicalPoint3dAsArray(point3d) {
5277
- return [ point3d.x, point3d.y, point3d.z ];
5278
- }
5279
- if (!this._isInitialized) return;
5280
- if (!this._viewer.visualizeJs) return;
5281
- const visLib = this._viewer.visLib();
5282
- const visViewer = visLib.getViewer();
5283
- const activeView = visViewer.activeView;
5284
- this._viewer.resetActiveDragger();
5285
- this._viewer.clearSlices();
5286
- this._viewer.clearOverlay();
5287
- if (viewpoint.orthogonal_camera) {
5288
- activeView.setView(getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.view_point), getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.direction), getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.up_vector), viewpoint.orthogonal_camera.field_width, viewpoint.orthogonal_camera.field_height, true);
5289
- }
5290
- this._viewer.syncOverlay();
5545
+ setViewpoint(viewpoint) {
5291
5546
  const markupColor = viewpoint.custom_fields.markup_color || {
5292
5547
  r: 255,
5293
5548
  g: 0,
5294
5549
  b: 0
5295
5550
  };
5296
5551
  this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
5297
- if (viewpoint.clipping_planes) {
5298
- for (const plane of viewpoint.clipping_planes) {
5299
- const cuttingPlane = new visLib.OdTvPlane;
5300
- cuttingPlane.set(getLogicalPoint3dAsArray(plane.location), getLogicalPoint3dAsArray(plane.direction));
5301
- activeView.addCuttingPlane(cuttingPlane);
5302
- activeView.setEnableCuttingPlaneFill(true, 102, 102, 102);
5303
- }
5304
- }
5305
5552
  this.loadMarkup(viewpoint);
5306
- this._viewer.update();
5307
5553
  }
5308
- createViewpoint() {
5309
- function getLogicalPoint3dFromArray(array) {
5310
- return {
5311
- x: array[0],
5312
- y: array[1],
5313
- z: array[2]
5314
- };
5315
- }
5316
- if (!this._isInitialized) return {};
5554
+ getViewpoint() {
5317
5555
  if (!this._viewer.visualizeJs) return {};
5318
- const visLib = this._viewer.visLib();
5319
- const visViewer = visLib.getViewer();
5320
- const activeView = visViewer.activeView;
5321
5556
  const viewpoint = {
5322
5557
  lines: [],
5323
5558
  texts: [],
5324
- clipping_planes: []
5325
- };
5326
- viewpoint.orthogonal_camera = {
5327
- view_point: getLogicalPoint3dFromArray(activeView.viewPosition),
5328
- direction: getLogicalPoint3dFromArray(activeView.viewTarget),
5329
- up_vector: getLogicalPoint3dFromArray(activeView.upVector),
5330
- field_width: activeView.viewFieldWidth,
5331
- field_height: activeView.viewFieldHeight
5559
+ arrows: [],
5560
+ clouds: [],
5561
+ ellipses: [],
5562
+ images: [],
5563
+ rectangles: []
5332
5564
  };
5333
- for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
5334
- const cuttingPlane = activeView.getCuttingPlane(i);
5335
- const plane = {
5336
- location: getLogicalPoint3dFromArray(cuttingPlane.getOrigin()),
5337
- direction: getLogicalPoint3dFromArray(cuttingPlane.normal())
5338
- };
5339
- viewpoint.clipping_planes.push(plane);
5340
- }
5341
5565
  viewpoint.snapshot = {
5342
5566
  data: this.combineMarkupWithDrawing()
5343
5567
  };
5344
5568
  viewpoint.custom_fields = {
5345
5569
  markup_color: this.getMarkupColor()
5346
5570
  };
5347
- const markupLines = this.getMarkupLines();
5348
- if (markupLines && markupLines.length > 0) {
5349
- markupLines === null || markupLines === void 0 ? void 0 : markupLines.forEach((markupLine => {
5350
- const line = {
5351
- points: [],
5352
- color: markupLine.color || "ff0000",
5353
- width: markupLine.width || 3
5354
- };
5355
- for (const point of markupLine.points) {
5356
- line.points.push(getLogicalPoint3dFromArray(point));
5357
- }
5358
- viewpoint.lines.push(line);
5359
- }));
5360
- }
5361
- const markupTexts = this.getMarkupTexts();
5362
- if (markupTexts && markupTexts.length > 0) {
5363
- markupTexts === null || markupTexts === void 0 ? void 0 : markupTexts.forEach((markupText => {
5364
- var _a;
5365
- const text = {
5366
- position: getLogicalPoint3dFromArray(markupText.position),
5367
- text: markupText.text,
5368
- angle: (_a = markupText.rotation) !== null && _a !== void 0 ? _a : 0,
5369
- text_size: markupText.size,
5370
- color: markupText.color
5371
- };
5372
- viewpoint.texts.push(text);
5373
- }));
5374
- }
5571
+ this.fillViewpointShapes(viewpoint);
5375
5572
  viewpoint.description = (new Date).toDateString();
5376
5573
  return viewpoint;
5377
5574
  }
@@ -5407,6 +5604,11 @@ class KonvaMarkup {
5407
5604
  zIndex = 0;
5408
5605
  break;
5409
5606
 
5607
+ case "cloud":
5608
+ object = new KonvaCloud(params);
5609
+ zIndex = 1;
5610
+ break;
5611
+
5410
5612
  default:
5411
5613
  throw new Error("Markup CreateObject - unsupported type has been detected.");
5412
5614
  }
@@ -5435,6 +5637,9 @@ class KonvaMarkup {
5435
5637
  this.konvaLayerFind(MarkupMode.Image).forEach((image => {
5436
5638
  objects.push(new KonvaImage(null, image));
5437
5639
  }));
5640
+ this.konvaLayerFind(MarkupMode.Cloud).forEach((cloud => {
5641
+ objects.push(new KonvaCloud(null, cloud));
5642
+ }));
5438
5643
  return objects;
5439
5644
  }
5440
5645
  getSelectedObjects() {
@@ -5465,6 +5670,10 @@ class KonvaMarkup {
5465
5670
  case "Image":
5466
5671
  objects.push(new KonvaImage(null, obj));
5467
5672
  break;
5673
+
5674
+ case "Cloud":
5675
+ objects.push(new KonvaCloud(null, obj));
5676
+ break;
5468
5677
  }
5469
5678
  }));
5470
5679
  return objects;
@@ -5476,6 +5685,57 @@ class KonvaMarkup {
5476
5685
  clearSelected() {
5477
5686
  this._konvaTransformer.nodes([]);
5478
5687
  }
5688
+ getPoint3dFromArray(array) {
5689
+ return {
5690
+ x: array[0],
5691
+ y: array[1],
5692
+ z: array[2]
5693
+ };
5694
+ }
5695
+ fillViewpointShapes(viewpoint) {
5696
+ const markupLines = this.getMarkupLines();
5697
+ if (markupLines && markupLines.length > 0) {
5698
+ markupLines === null || markupLines === void 0 ? void 0 : markupLines.forEach((line => {
5699
+ viewpoint.lines.push(line);
5700
+ }));
5701
+ }
5702
+ const markupTexts = this.getMarkupTexts();
5703
+ if (markupTexts && markupTexts.length > 0) {
5704
+ markupTexts === null || markupTexts === void 0 ? void 0 : markupTexts.forEach((text => {
5705
+ viewpoint.texts.push(text);
5706
+ }));
5707
+ }
5708
+ const markupRectangles = this.getMarkupRectangles();
5709
+ if (markupRectangles && markupRectangles.length > 0) {
5710
+ markupRectangles === null || markupRectangles === void 0 ? void 0 : markupRectangles.forEach((rectangle => {
5711
+ viewpoint.rectangles.push(rectangle);
5712
+ }));
5713
+ }
5714
+ const markupEllipses = this.getMarkupEllipses();
5715
+ if (markupEllipses && markupEllipses.length > 0) {
5716
+ markupEllipses === null || markupEllipses === void 0 ? void 0 : markupEllipses.forEach((ellipse => {
5717
+ viewpoint.ellipses.push(ellipse);
5718
+ }));
5719
+ }
5720
+ const markupArrows = this.getMarkupArrows();
5721
+ if (markupArrows && markupArrows.length > 0) {
5722
+ markupArrows === null || markupArrows === void 0 ? void 0 : markupArrows.forEach((arrow => {
5723
+ viewpoint.arrows.push(arrow);
5724
+ }));
5725
+ }
5726
+ const markupImages = this.getMarkupImages();
5727
+ if (markupImages && markupImages.length > 0) {
5728
+ markupImages === null || markupImages === void 0 ? void 0 : markupImages.forEach((image => {
5729
+ viewpoint.images.push(image);
5730
+ }));
5731
+ }
5732
+ const markupClouds = this.getMarkupClouds();
5733
+ if (markupClouds && markupClouds.length > 0) {
5734
+ markupClouds === null || markupClouds === void 0 ? void 0 : markupClouds.forEach((cloud => {
5735
+ viewpoint.clouds.push(cloud);
5736
+ }));
5737
+ }
5738
+ }
5479
5739
  addObject(object) {
5480
5740
  this._konvaLayer.add(object.ref());
5481
5741
  }
@@ -5529,7 +5789,18 @@ class KonvaMarkup {
5529
5789
  y: 50
5530
5790
  });
5531
5791
  } else if (this._markupMode === MarkupMode.Arrow) {
5532
- this.addArrow([ pos.x, pos.y, pos.x + 50, pos.y + 50 ], 5, 5);
5792
+ this.addArrow({
5793
+ x: pos.x,
5794
+ y: pos.y
5795
+ }, {
5796
+ x: pos.x + 50,
5797
+ y: pos.y + 50
5798
+ });
5799
+ } else if (this._markupMode === MarkupMode.Cloud) {
5800
+ this.addCloud({
5801
+ x: pos.x,
5802
+ y: pos.y
5803
+ }, 200, 400);
5533
5804
  }
5534
5805
  }));
5535
5806
  stage.on("mouseup touchend", (e => {
@@ -5566,6 +5837,11 @@ class KonvaMarkup {
5566
5837
  } else {
5567
5838
  this.removeTextInput();
5568
5839
  }
5840
+ if (transformer.nodes().filter((x => x.className === "Cloud")).length > 0 || e.target.className === "Cloud") {
5841
+ transformer.rotateEnabled(false);
5842
+ } else {
5843
+ transformer.rotateEnabled(true);
5844
+ }
5569
5845
  const metaPressed = e.evt.shiftKey || e.evt.ctrlKey || e.evt.metaKey;
5570
5846
  const isSelected = transformer.nodes().indexOf(e.target) >= 0;
5571
5847
  if (!metaPressed && !isSelected) {
@@ -5606,7 +5882,7 @@ class KonvaMarkup {
5606
5882
  getMarkupLines() {
5607
5883
  const lines = [];
5608
5884
  this.konvaLayerFind(MarkupMode.Line).forEach((line => {
5609
- const linePoints = line.attrs.points;
5885
+ const linePoints = line.points();
5610
5886
  if (!linePoints) return;
5611
5887
  const worldPoints = [];
5612
5888
  const absoluteTransform = line.getAbsoluteTransform();
@@ -5620,9 +5896,11 @@ class KonvaMarkup {
5620
5896
  }
5621
5897
  const konvaLine = new KonvaLine(null, line);
5622
5898
  lines.push({
5623
- points: worldPoints,
5624
- color: konvaLine.getColor(),
5625
- width: konvaLine.getLineWidth()
5899
+ id: konvaLine.id(),
5900
+ points: worldPoints.map((p => this.getPoint3dFromArray(p))),
5901
+ color: konvaLine.getColor() || "ff0000",
5902
+ type: konvaLine.getLineType() || "solid",
5903
+ width: konvaLine.getLineWidth() || 3
5626
5904
  });
5627
5905
  }));
5628
5906
  return lines;
@@ -5634,36 +5912,174 @@ class KonvaMarkup {
5634
5912
  const projMtrx = this._viewer.visViewer().activeView.projectionMatrix;
5635
5913
  const mtrxNumber = projMtrx.get(1, 1);
5636
5914
  const tol = 1e-6;
5637
- if (!(mtrxNumber < tol && mtrxNumber > -tol)) {
5915
+ if (mtrxNumber > tol || mtrxNumber < -tol) {
5638
5916
  textScale = 1 / mtrxNumber;
5639
5917
  }
5640
5918
  this.konvaLayerFind(MarkupMode.Text).forEach((text => {
5641
5919
  if (!text) return;
5920
+ const position = this._viewer.visViewer().screenToWorld(text.x() * window.devicePixelRatio, text.y() * window.devicePixelRatio);
5921
+ const shape = new KonvaText(null, text);
5642
5922
  texts.push({
5643
- position: this._viewer.visViewer().screenToWorld(text.attrs.x * window.devicePixelRatio, text.attrs.y * window.devicePixelRatio),
5644
- text: text.attrs.text,
5645
- rotation: text.attrs.rotation && Math.abs(text.attrs.rotation) > tol ? text.attrs.rotation : 0,
5646
- size: textSize * textScale,
5647
- color: text.attrs.fill
5923
+ id: shape.id(),
5924
+ position: this.getPoint3dFromArray(position),
5925
+ text: shape.getText(),
5926
+ text_size: textSize * textScale,
5927
+ angle: shape.getRotation(),
5928
+ color: shape.getColor(),
5929
+ font_size: shape.getFontSize()
5648
5930
  });
5649
5931
  }));
5650
5932
  return texts;
5651
5933
  }
5934
+ getMarkupRectangles() {
5935
+ const rectangles = [];
5936
+ this.konvaLayerFind(MarkupMode.Rectangle).forEach((rect => {
5937
+ const position = rect.position();
5938
+ const worldPoint = this._viewer.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
5939
+ const shape = new KonvaRectangle(null, rect);
5940
+ rectangles.push({
5941
+ id: shape.id(),
5942
+ position: this.getPoint3dFromArray(worldPoint),
5943
+ width: shape.getWidth(),
5944
+ height: shape.getHeigth(),
5945
+ line_width: shape.getLineWidth(),
5946
+ color: shape.getColor()
5947
+ });
5948
+ }));
5949
+ return rectangles;
5950
+ }
5951
+ getMarkupEllipses() {
5952
+ const ellipses = [];
5953
+ this.konvaLayerFind(MarkupMode.Ellipse).forEach((ellipse => {
5954
+ const position = ellipse.position();
5955
+ const worldPoint = this._viewer.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
5956
+ const shape = new KonvaEllipse(null, ellipse);
5957
+ ellipses.push({
5958
+ id: shape.id(),
5959
+ position: this.getPoint3dFromArray(worldPoint),
5960
+ radius: {
5961
+ x: ellipse.getRadiusX(),
5962
+ y: ellipse.getRadiusY()
5963
+ },
5964
+ line_width: shape.getLineWidth(),
5965
+ color: shape.getColor()
5966
+ });
5967
+ }));
5968
+ return ellipses;
5969
+ }
5970
+ getMarkupArrows() {
5971
+ const arrows = [];
5972
+ this.konvaLayerFind(MarkupMode.Arrow).forEach((arrow => {
5973
+ const absoluteTransform = arrow.getAbsoluteTransform();
5974
+ const atStartPoint = absoluteTransform.point({
5975
+ x: arrow.points()[0],
5976
+ y: arrow.points()[1]
5977
+ });
5978
+ const worldStartPoint = this._viewer.visViewer().screenToWorld(atStartPoint.x * window.devicePixelRatio, atStartPoint.y * window.devicePixelRatio);
5979
+ const atEndPoint = absoluteTransform.point({
5980
+ x: arrow.points()[2],
5981
+ y: arrow.points()[3]
5982
+ });
5983
+ const worldEndPoint = this._viewer.visViewer().screenToWorld(atEndPoint.x * window.devicePixelRatio, atEndPoint.y * window.devicePixelRatio);
5984
+ const shape = new KonvaArrow(null, arrow);
5985
+ arrows.push({
5986
+ id: shape.id(),
5987
+ start: this.getPoint3dFromArray(worldStartPoint),
5988
+ end: this.getPoint3dFromArray(worldEndPoint),
5989
+ color: shape.getColor()
5990
+ });
5991
+ }));
5992
+ return arrows;
5993
+ }
5994
+ getMarkupImages() {
5995
+ const images = [];
5996
+ this.konvaLayerFind(MarkupMode.Image).forEach((image => {
5997
+ const position = image.position();
5998
+ const worldPoint = this._viewer.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
5999
+ const shape = new KonvaImage(null, image);
6000
+ images.push({
6001
+ id: shape.id(),
6002
+ position: this.getPoint3dFromArray(worldPoint),
6003
+ src: shape.getSrc(),
6004
+ width: shape.getWidth(),
6005
+ height: shape.getHeight()
6006
+ });
6007
+ }));
6008
+ return images;
6009
+ }
6010
+ getMarkupClouds() {
6011
+ const clouds = [];
6012
+ this.konvaLayerFind(MarkupMode.Cloud).forEach((cloud => {
6013
+ const position = cloud.position();
6014
+ const worldPoint = this._viewer.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
6015
+ const shape = new KonvaCloud(null, cloud);
6016
+ clouds.push({
6017
+ id: shape.id(),
6018
+ position: this.getPoint3dFromArray(worldPoint),
6019
+ width: shape.getWidth(),
6020
+ height: shape.getHeigth(),
6021
+ line_width: shape.getLineWidth(),
6022
+ color: shape.getColor()
6023
+ });
6024
+ }));
6025
+ return clouds;
6026
+ }
5652
6027
  loadMarkup(viewpoint) {
5653
- const vpLines = viewpoint.lines;
5654
- vpLines === null || vpLines === void 0 ? void 0 : vpLines.forEach((vpLine => {
6028
+ var _a, _b, _c, _d, _e, _f, _g;
6029
+ (_a = viewpoint.lines) === null || _a === void 0 ? void 0 : _a.forEach((vpLine => {
5655
6030
  const linePoints = [];
5656
6031
  vpLine.points.forEach((point => {
5657
6032
  const screenPoint = worldToScreen([ point.x, point.y, point.z ], this._viewer.visualizeJs, this._viewer.visViewer());
5658
6033
  linePoints.push(screenPoint.x);
5659
6034
  linePoints.push(screenPoint.y);
5660
6035
  }));
5661
- this.addLine(linePoints, vpLine.color, vpLine.width);
6036
+ this.addLine(linePoints, vpLine.color, vpLine.type, vpLine.width, vpLine.id);
5662
6037
  }));
5663
- const vpTexts = viewpoint.texts;
5664
- vpTexts === null || vpTexts === void 0 ? void 0 : vpTexts.forEach((vpText => {
6038
+ (_b = viewpoint.texts) === null || _b === void 0 ? void 0 : _b.forEach((vpText => {
5665
6039
  const screenPoint = worldToScreen([ vpText.position.x, vpText.position.y, vpText.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
5666
- this.addText(vpText.text, screenPoint, vpText.angle, vpText.color);
6040
+ this.addText(vpText.text, screenPoint, vpText.angle, vpText.color, vpText.text_size, vpText.font_size, vpText.id);
6041
+ }));
6042
+ (_c = viewpoint.rectangles) === null || _c === void 0 ? void 0 : _c.forEach((vpRect => {
6043
+ const screenPoint = worldToScreen([ vpRect.position.x, vpRect.position.y, vpRect.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6044
+ this.addRectangle({
6045
+ x: screenPoint.x,
6046
+ y: screenPoint.y
6047
+ }, vpRect.width, vpRect.height, vpRect.line_width, vpRect.color, vpRect.id);
6048
+ }));
6049
+ (_d = viewpoint.ellipses) === null || _d === void 0 ? void 0 : _d.forEach((vpEllipse => {
6050
+ const screenPoint = worldToScreen([ vpEllipse.position.x, vpEllipse.position.y, vpEllipse.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6051
+ this.addEllipse({
6052
+ x: screenPoint.x,
6053
+ y: screenPoint.y
6054
+ }, {
6055
+ x: vpEllipse.radius.x,
6056
+ y: vpEllipse.radius.y
6057
+ }, vpEllipse.line_width, vpEllipse.color, vpEllipse.id);
6058
+ }));
6059
+ (_e = viewpoint.arrows) === null || _e === void 0 ? void 0 : _e.forEach((vpArrow => {
6060
+ const startPoint = worldToScreen([ vpArrow.start.x, vpArrow.start.y, vpArrow.start.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6061
+ const endPoint = worldToScreen([ vpArrow.end.x, vpArrow.end.y, vpArrow.end.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6062
+ this.addArrow({
6063
+ x: startPoint.x,
6064
+ y: startPoint.y
6065
+ }, {
6066
+ x: endPoint.x,
6067
+ y: endPoint.y
6068
+ }, vpArrow.color, vpArrow.id);
6069
+ }));
6070
+ (_f = viewpoint.clouds) === null || _f === void 0 ? void 0 : _f.forEach((vpCloud => {
6071
+ const screenPoint = worldToScreen([ vpCloud.position.x, vpCloud.position.y, vpCloud.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6072
+ this.addCloud({
6073
+ x: screenPoint.x,
6074
+ y: screenPoint.y
6075
+ }, vpCloud.width, vpCloud.height, vpCloud.line_width, vpCloud.color, vpCloud.id);
6076
+ }));
6077
+ (_g = viewpoint.images) === null || _g === void 0 ? void 0 : _g.forEach((vpImage => {
6078
+ const screenPoint = worldToScreen([ vpImage.position.x, vpImage.position.y, vpImage.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6079
+ this.addImage({
6080
+ x: screenPoint.x,
6081
+ y: screenPoint.y
6082
+ }, vpImage.src, vpImage.width, vpImage.height, vpImage.id);
5667
6083
  }));
5668
6084
  }
5669
6085
  combineMarkupWithDrawing() {
@@ -5681,7 +6097,7 @@ class KonvaMarkup {
5681
6097
  }), 0, 0);
5682
6098
  return tempCanvas.toDataURL("image/jpeg", .25);
5683
6099
  }
5684
- addLine(linePoints, color, width) {
6100
+ addLine(linePoints, color, type, width, id) {
5685
6101
  if (!linePoints || linePoints.length === 0) return;
5686
6102
  const points = [];
5687
6103
  for (let i = 0; i < linePoints.length; i += 2) {
@@ -5693,7 +6109,9 @@ class KonvaMarkup {
5693
6109
  const konvaLine = new KonvaLine({
5694
6110
  points: points,
5695
6111
  color: color || this._markupColor.HexColor,
5696
- width: width || this.lineWidth
6112
+ type: type || LineType.Solid,
6113
+ width: width || this.lineWidth,
6114
+ id: id
5697
6115
  });
5698
6116
  const obj = konvaLine.ref();
5699
6117
  this._konvaLayer.add(obj);
@@ -5735,20 +6153,31 @@ class KonvaMarkup {
5735
6153
  this._textInputPos = null;
5736
6154
  this._textInputAngle = 0;
5737
6155
  }
5738
- addText(specifiedText, pos, angle, color) {
6156
+ addText(specifiedText, position, angle, color, textSize, fontSize, id) {
5739
6157
  if (specifiedText) {
5740
- const konvaText = new Konva.Text({
5741
- x: pos.x,
5742
- y: pos.y,
6158
+ const tol = 1e-6;
6159
+ if (textSize && textSize > tol && (!fontSize || fontSize < tol)) {
6160
+ const size = .02;
6161
+ let scale = 1;
6162
+ const projMtrx = this._viewer.visViewer().activeView.projectionMatrix;
6163
+ const mtrxNumber = projMtrx.get(1, 1);
6164
+ if (mtrxNumber > tol || mtrxNumber < -tol) {
6165
+ scale = 1 / mtrxNumber;
6166
+ }
6167
+ fontSize = textSize / (scale / size) / 34;
6168
+ }
6169
+ const konvaText = new KonvaText({
6170
+ position: {
6171
+ x: position.x,
6172
+ y: position.y
6173
+ },
5743
6174
  text: specifiedText,
5744
- fontSize: 34,
5745
- fontFamily: this.TEXT_FONT_FAMILY,
5746
- fill: color || this._markupColor.HexColor,
5747
- align: "left",
5748
- draggable: true,
5749
- rotation: angle
6175
+ fontSize: fontSize,
6176
+ color: color || this._markupColor.HexColor,
6177
+ rotation: angle,
6178
+ id: id
5750
6179
  });
5751
- this._konvaLayer.add(konvaText);
6180
+ this._konvaLayer.add(konvaText.ref());
5752
6181
  }
5753
6182
  const trNodes = this._konvaTransformer.nodes();
5754
6183
  if (trNodes.length > 0) {
@@ -5758,59 +6187,71 @@ class KonvaMarkup {
5758
6187
  this.removeTextInput();
5759
6188
  return;
5760
6189
  }
5761
- addRectangle(pos, width, height) {
5762
- if (!pos) return;
5763
- const konvaRectangle = new Konva.Rect({
5764
- stroke: this._markupColor.HexColor,
5765
- strokeWidth: this.lineWidth,
5766
- globalCompositeOperation: "source-over",
5767
- lineCap: "round",
5768
- lineJoin: "round",
5769
- x: pos.x,
5770
- y: pos.y,
6190
+ addRectangle(position, width, height, lineWidth, color, id) {
6191
+ if (!position) return;
6192
+ const konvaRectangle = new KonvaRectangle({
6193
+ position: position,
6194
+ color: color || this._markupColor.HexColor,
6195
+ lineWidth: lineWidth || this.lineWidth,
5771
6196
  width: width,
5772
6197
  height: height,
5773
- draggable: true,
5774
- strokeScaleEnabled: false
6198
+ id: id
5775
6199
  });
5776
- this._konvaLayer.add(konvaRectangle);
5777
- return konvaRectangle;
5778
- }
5779
- addEllipse(pos, radius) {
5780
- if (!pos) return;
5781
- const konvaEllipse = new Konva.Ellipse({
5782
- stroke: this._markupColor.HexColor,
5783
- strokeWidth: this.lineWidth,
5784
- globalCompositeOperation: "source-over",
5785
- lineCap: "round",
5786
- lineJoin: "round",
5787
- x: pos.x,
5788
- y: pos.y,
5789
- radiusX: radius.x,
5790
- radiusY: radius.y,
5791
- draggable: true,
5792
- strokeScaleEnabled: false
6200
+ const obj = konvaRectangle.ref();
6201
+ this._konvaLayer.add(obj);
6202
+ return obj;
6203
+ }
6204
+ addEllipse(position, radius, lineWidth, color, id) {
6205
+ if (!position) return;
6206
+ const konvaEllipse = new KonvaEllipse({
6207
+ position: position,
6208
+ radius: radius,
6209
+ lineWidth: lineWidth,
6210
+ color: color || this._markupColor.HexColor,
6211
+ id: id
5793
6212
  });
5794
- this._konvaLayer.add(konvaEllipse);
5795
- return konvaEllipse;
5796
- }
5797
- addArrow(points, pointerWidth, pointerLength) {
5798
- if (!points) return;
5799
- const konvaArrow = new Konva.Arrow({
5800
- stroke: this._markupColor.HexColor,
5801
- fill: this._markupColor.HexColor,
5802
- strokeWidth: this.lineWidth,
5803
- globalCompositeOperation: "source-over",
5804
- lineCap: "round",
5805
- lineJoin: "round",
5806
- points: points,
5807
- pointerWidth: pointerWidth,
5808
- pointerLength: pointerLength,
5809
- draggable: true,
5810
- strokeScaleEnabled: false
6213
+ const obj = konvaEllipse.ref();
6214
+ this._konvaLayer.add(obj);
6215
+ return obj;
6216
+ }
6217
+ addArrow(start, end, color, id) {
6218
+ if (!start || !end) return;
6219
+ const konvaArrow = new KonvaArrow({
6220
+ start: start,
6221
+ end: end,
6222
+ color: color || this._markupColor.HexColor,
6223
+ id: id
5811
6224
  });
5812
- this._konvaLayer.add(konvaArrow);
5813
- return konvaArrow;
6225
+ const obj = konvaArrow.ref();
6226
+ this._konvaLayer.add(obj);
6227
+ return obj;
6228
+ }
6229
+ addCloud(position, width, height, lineWidth, color, id) {
6230
+ if (!position || !width || !height) return;
6231
+ const konvaCloud = new KonvaCloud({
6232
+ position: position,
6233
+ width: width,
6234
+ height: height,
6235
+ color: color || this._markupColor.HexColor,
6236
+ lineWidth: lineWidth || this.lineWidth,
6237
+ id: id
6238
+ });
6239
+ const obj = konvaCloud.ref();
6240
+ this._konvaLayer.add(obj);
6241
+ return obj;
6242
+ }
6243
+ addImage(position, src, width, height, id) {
6244
+ if (!position || !width || !height) return;
6245
+ const konvaImage = new KonvaImage({
6246
+ position: position,
6247
+ src: src,
6248
+ width: width,
6249
+ height: height,
6250
+ id: id
6251
+ });
6252
+ const obj = konvaImage.ref();
6253
+ this._konvaLayer.add(obj);
6254
+ return obj;
5814
6255
  }
5815
6256
  }
5816
6257
 
@@ -5988,7 +6429,7 @@ class VisualizeMarkup {
5988
6429
  itr.delete();
5989
6430
  this._viewer.update();
5990
6431
  }
5991
- drawViewpoint(viewpoint) {
6432
+ setViewpoint(viewpoint) {
5992
6433
  function getLogicalPoint3dAsArray(point3d) {
5993
6434
  return [ point3d.x, point3d.y, point3d.z ];
5994
6435
  }
@@ -5999,12 +6440,6 @@ class VisualizeMarkup {
5999
6440
  const visLib = this._viewer.visLib();
6000
6441
  const visViewer = visLib.getViewer();
6001
6442
  const activeView = visViewer.activeView;
6002
- this._viewer.resetActiveDragger();
6003
- this._viewer.clearSlices();
6004
- this.clearOverlay();
6005
- if (viewpoint.orthogonal_camera) {
6006
- activeView.setView(getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.view_point), getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.direction), getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.up_vector), viewpoint.orthogonal_camera.field_width, viewpoint.orthogonal_camera.field_height, true);
6007
- }
6008
6443
  this._viewer.syncOverlay();
6009
6444
  const markupColor = viewpoint.custom_fields.markup_color || {
6010
6445
  r: 255,
@@ -6042,17 +6477,9 @@ class VisualizeMarkup {
6042
6477
  entityPtr.delete();
6043
6478
  }
6044
6479
  }
6045
- if (viewpoint.clipping_planes) {
6046
- for (const plane of viewpoint.clipping_planes) {
6047
- const cuttingPlane = new visLib.OdTvPlane;
6048
- cuttingPlane.set(getLogicalPoint3dAsArray(plane.location), getLogicalPoint3dAsArray(plane.direction));
6049
- activeView.addCuttingPlane(cuttingPlane);
6050
- activeView.setEnableCuttingPlaneFill(true, 102, 102, 102);
6051
- }
6052
- }
6053
6480
  this._viewer.update();
6054
6481
  }
6055
- createViewpoint() {
6482
+ getViewpoint() {
6056
6483
  function getLogicalPoint3dFromArray(array) {
6057
6484
  return {
6058
6485
  x: array[0],
@@ -6063,18 +6490,9 @@ class VisualizeMarkup {
6063
6490
  if (!this._viewer.visualizeJs) return {};
6064
6491
  const visLib = this._viewer.visLib();
6065
6492
  const visViewer = visLib.getViewer();
6066
- const activeView = visViewer.activeView;
6067
6493
  const viewpoint = {
6068
6494
  lines: [],
6069
- texts: [],
6070
- clipping_planes: []
6071
- };
6072
- viewpoint.orthogonal_camera = {
6073
- view_point: getLogicalPoint3dFromArray(activeView.viewPosition),
6074
- direction: getLogicalPoint3dFromArray(activeView.viewTarget),
6075
- up_vector: getLogicalPoint3dFromArray(activeView.upVector),
6076
- field_width: activeView.viewFieldWidth,
6077
- field_height: activeView.viewFieldHeight
6495
+ texts: []
6078
6496
  };
6079
6497
  const model = visViewer.getMarkupModel();
6080
6498
  const itr = model.getEntitiesIterator();
@@ -6114,14 +6532,6 @@ class VisualizeMarkup {
6114
6532
  entityPtr.delete();
6115
6533
  }
6116
6534
  itr.delete();
6117
- for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
6118
- const cuttingPlane = activeView.getCuttingPlane(i);
6119
- const plane = {
6120
- location: getLogicalPoint3dFromArray(cuttingPlane.getOrigin()),
6121
- direction: getLogicalPoint3dFromArray(cuttingPlane.normal())
6122
- };
6123
- viewpoint.clipping_planes.push(plane);
6124
- }
6125
6535
  viewpoint.snapshot = {
6126
6536
  data: visLib.canvas.toDataURL("image/jpeg", .25)
6127
6537
  };
@@ -6149,6 +6559,13 @@ class VisualizeMarkup {
6149
6559
  clearSelected() {
6150
6560
  throw new Error("Not implemented yet");
6151
6561
  }
6562
+ getPoint3dFromArray(array) {
6563
+ return {
6564
+ x: array[0],
6565
+ y: array[1],
6566
+ z: array[2]
6567
+ };
6568
+ }
6152
6569
  }
6153
6570
 
6154
6571
  class MarkupFactory {
@@ -6805,12 +7222,74 @@ class Viewer extends EventEmitter2 {
6805
7222
  return entityId;
6806
7223
  }
6807
7224
  drawViewpoint(viewpoint) {
6808
- this.markup.drawViewpoint(viewpoint);
7225
+ this.setOrthogonalCameraSettings(viewpoint);
7226
+ this.setClippingPlanes(viewpoint);
7227
+ this.markup.setViewpoint(viewpoint);
6809
7228
  }
6810
7229
  createViewpoint() {
6811
- const vp = this.markup.createViewpoint();
7230
+ const vp = this.markup.getViewpoint();
7231
+ vp.orthogonal_camera = this.getOrthogonalCameraSettings();
7232
+ vp.clipping_planes = this.getClippingPlanes();
6812
7233
  return vp;
6813
7234
  }
7235
+ getPoint3dFromArray(array) {
7236
+ return {
7237
+ x: array[0],
7238
+ y: array[1],
7239
+ z: array[2]
7240
+ };
7241
+ }
7242
+ getLogicalPoint3dAsArray(point3d) {
7243
+ return [ point3d.x, point3d.y, point3d.z ];
7244
+ }
7245
+ getOrthogonalCameraSettings() {
7246
+ const visViewer = this.visViewer();
7247
+ const activeView = visViewer.activeView;
7248
+ return {
7249
+ view_point: this.getPoint3dFromArray(activeView.viewPosition),
7250
+ direction: this.getPoint3dFromArray(activeView.viewTarget),
7251
+ up_vector: this.getPoint3dFromArray(activeView.upVector),
7252
+ field_width: activeView.viewFieldWidth,
7253
+ field_height: activeView.viewFieldHeight
7254
+ };
7255
+ }
7256
+ setOrthogonalCameraSettings(viewpoint) {
7257
+ const visViewer = this.visViewer();
7258
+ const activeView = visViewer.activeView;
7259
+ this.resetActiveDragger();
7260
+ this.clearSlices();
7261
+ this.clearOverlay();
7262
+ if (viewpoint.orthogonal_camera) {
7263
+ activeView.setView(this.getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.view_point), this.getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.direction), this.getLogicalPoint3dAsArray(viewpoint.orthogonal_camera.up_vector), viewpoint.orthogonal_camera.field_width, viewpoint.orthogonal_camera.field_height, true);
7264
+ }
7265
+ this.syncOverlay();
7266
+ }
7267
+ getClippingPlanes() {
7268
+ const visViewer = this.visViewer();
7269
+ const activeView = visViewer.activeView;
7270
+ const clipping_planes = [];
7271
+ for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
7272
+ const cuttingPlane = activeView.getCuttingPlane(i);
7273
+ const plane = {
7274
+ location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
7275
+ direction: this.getPoint3dFromArray(cuttingPlane.normal())
7276
+ };
7277
+ clipping_planes.push(plane);
7278
+ }
7279
+ return clipping_planes;
7280
+ }
7281
+ setClippingPlanes(viewpoint) {
7282
+ if (viewpoint.clipping_planes) {
7283
+ const visViewer = this.visViewer();
7284
+ const activeView = visViewer.activeView;
7285
+ for (const plane of viewpoint.clipping_planes) {
7286
+ const cuttingPlane = new (this.visLib().OdTvPlane);
7287
+ cuttingPlane.set(this.getLogicalPoint3dAsArray(plane.location), this.getLogicalPoint3dAsArray(plane.direction));
7288
+ activeView.addCuttingPlane(cuttingPlane);
7289
+ activeView.setEnableCuttingPlaneFill(true, 102, 102, 102);
7290
+ }
7291
+ }
7292
+ }
6814
7293
  executeCommand(id, ...args) {
6815
7294
  return commands("VisualizeJS").executeCommand(id, this, ...args);
6816
7295
  }
@@ -7145,7 +7624,7 @@ function zoomToSelected(viewer) {
7145
7624
 
7146
7625
  commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
7147
7626
 
7148
- const version = "25.2.2";
7627
+ const version = "25.2.8";
7149
7628
 
7150
7629
  export { Assembly, CANVAS_EVENTS, ClashTest, Client, EventEmitter2, File$1 as File, Job, Member, Model, OdBaseDragger, Options, Permission, Project, Role, User, Viewer, Viewer as VisualizejsViewer, commands, version };
7151
7630
  //# sourceMappingURL=client.module.js.map