@inweb/client 25.2.5 → 25.2.10

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.
@@ -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,16 @@ 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
+ if (this._data.enableStreamingMode) {
1028
+ this._data.enablePartialMode = false;
1029
+ }
1030
+ this.notifierChangeEvent();
1031
+ }
1021
1032
  get enablePartialMode() {
1022
1033
  return this._data.enablePartialMode;
1023
1034
  }
@@ -2069,7 +2080,7 @@ class Client extends EventEmitter2 {
2069
2080
  return this._httpClient.get("/version").then((response => response.json())).then((data => ({
2070
2081
  ...data,
2071
2082
  server: data.version,
2072
- client: "25.2.5"
2083
+ client: "25.2.10"
2073
2084
  })));
2074
2085
  }
2075
2086
  registerUser(email, password, userName) {
@@ -4339,7 +4350,7 @@ class UpdaterController {
4339
4350
  }
4340
4351
  }
4341
4352
 
4342
- class VsfXLoader extends BaseLoader {
4353
+ class VsfXStreamingLoader extends BaseLoader {
4343
4354
  async load() {
4344
4355
  if (!this.viewer.visualizeJs) return;
4345
4356
  const visLib = this.viewer.visLib();
@@ -4587,11 +4598,56 @@ class VsfXPartialLoader extends BaseLoader {
4587
4598
  }
4588
4599
  }
4589
4600
 
4601
+ class VsfXLoader extends BaseLoader {
4602
+ async load() {
4603
+ if (!this.viewer.visualizeJs) return;
4604
+ const visLib = this.viewer.visLib();
4605
+ const visViewer = visLib.getViewer();
4606
+ const abortController = new AbortController;
4607
+ this.viewer._abortController = abortController;
4608
+ console.time("File load time");
4609
+ try {
4610
+ this.viewer.emitEvent({
4611
+ type: "geometrystart",
4612
+ model: this.model
4613
+ });
4614
+ const progressCb = progress => this.viewer.emitEvent({
4615
+ type: "geometryprogress",
4616
+ data: progress,
4617
+ model: this.model
4618
+ });
4619
+ const arrayBuffer = await this.model.downloadResource(this.model.database, progressCb, abortController.signal);
4620
+ if (abortController.signal.aborted) {
4621
+ await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
4622
+ }
4623
+ if (this.viewer.visualizeJs) {
4624
+ visViewer.parseVsfx(new Uint8Array(arrayBuffer));
4625
+ this.viewer.update(true);
4626
+ this.viewer.syncOpenCloudVisualStyle(false);
4627
+ this.viewer.syncOptions();
4628
+ this.viewer.resize();
4629
+ }
4630
+ console.timeEnd("File load time");
4631
+ this.viewer.emitEvent({
4632
+ type: "geometryend",
4633
+ model: this.model
4634
+ });
4635
+ } catch (error) {
4636
+ this.viewer.emitEvent({
4637
+ type: "geometryerror",
4638
+ data: error,
4639
+ model: this.model
4640
+ });
4641
+ throw error;
4642
+ }
4643
+ }
4644
+ }
4645
+
4590
4646
  class LoaderFactory {
4591
4647
  create(viewer, model, options) {
4592
4648
  const geometryType = model.database.split(".").pop();
4593
4649
  if (model.geometry.length === 0 && geometryType === "vsfx") {
4594
- return options.enablePartialMode ? new VsfXPartialLoader(viewer, model, options) : new VsfXLoader(viewer, model, options);
4650
+ 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
4651
  }
4596
4652
  if (geometryType === "data") {
4597
4653
  return new TCSLoader(viewer, model, options);
@@ -5489,44 +5545,17 @@ class KonvaMarkup {
5489
5545
  }));
5490
5546
  this._konvaLayer.draw();
5491
5547
  }
5492
- drawViewpoint(viewpoint) {
5493
- function getLogicalPoint3dAsArray(point3d) {
5494
- return [ point3d.x, point3d.y, point3d.z ];
5495
- }
5496
- if (!this._isInitialized) return;
5497
- if (!this._viewer.visualizeJs) return;
5498
- const visLib = this._viewer.visLib();
5499
- const visViewer = visLib.getViewer();
5500
- const activeView = visViewer.activeView;
5501
- this._viewer.resetActiveDragger();
5502
- this._viewer.clearSlices();
5503
- this._viewer.clearOverlay();
5504
- if (viewpoint.orthogonal_camera) {
5505
- 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);
5506
- }
5507
- this._viewer.syncOverlay();
5548
+ setViewpoint(viewpoint) {
5508
5549
  const markupColor = viewpoint.custom_fields.markup_color || {
5509
5550
  r: 255,
5510
5551
  g: 0,
5511
5552
  b: 0
5512
5553
  };
5513
5554
  this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
5514
- if (viewpoint.clipping_planes) {
5515
- for (const plane of viewpoint.clipping_planes) {
5516
- const cuttingPlane = new visLib.OdTvPlane;
5517
- cuttingPlane.set(getLogicalPoint3dAsArray(plane.location), getLogicalPoint3dAsArray(plane.direction));
5518
- activeView.addCuttingPlane(cuttingPlane);
5519
- activeView.setEnableCuttingPlaneFill(true, 102, 102, 102);
5520
- }
5521
- }
5522
5555
  this.loadMarkup(viewpoint);
5523
- this._viewer.update();
5524
5556
  }
5525
- createViewpoint() {
5557
+ getViewpoint() {
5526
5558
  if (!this._viewer.visualizeJs) return {};
5527
- const visLib = this._viewer.visLib();
5528
- const visViewer = visLib.getViewer();
5529
- const activeView = visViewer.activeView;
5530
5559
  const viewpoint = {
5531
5560
  lines: [],
5532
5561
  texts: [],
@@ -5534,24 +5563,8 @@ class KonvaMarkup {
5534
5563
  clouds: [],
5535
5564
  ellipses: [],
5536
5565
  images: [],
5537
- rectangles: [],
5538
- clipping_planes: []
5566
+ rectangles: []
5539
5567
  };
5540
- viewpoint.orthogonal_camera = {
5541
- view_point: this.getPoint3dFromArray(activeView.viewPosition),
5542
- direction: this.getPoint3dFromArray(activeView.viewTarget),
5543
- up_vector: this.getPoint3dFromArray(activeView.upVector),
5544
- field_width: activeView.viewFieldWidth,
5545
- field_height: activeView.viewFieldHeight
5546
- };
5547
- for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
5548
- const cuttingPlane = activeView.getCuttingPlane(i);
5549
- const plane = {
5550
- location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
5551
- direction: this.getPoint3dFromArray(cuttingPlane.normal())
5552
- };
5553
- viewpoint.clipping_planes.push(plane);
5554
- }
5555
5568
  viewpoint.snapshot = {
5556
5569
  data: this.combineMarkupWithDrawing()
5557
5570
  };
@@ -6419,7 +6432,7 @@ class VisualizeMarkup {
6419
6432
  itr.delete();
6420
6433
  this._viewer.update();
6421
6434
  }
6422
- drawViewpoint(viewpoint) {
6435
+ setViewpoint(viewpoint) {
6423
6436
  function getLogicalPoint3dAsArray(point3d) {
6424
6437
  return [ point3d.x, point3d.y, point3d.z ];
6425
6438
  }
@@ -6430,12 +6443,6 @@ class VisualizeMarkup {
6430
6443
  const visLib = this._viewer.visLib();
6431
6444
  const visViewer = visLib.getViewer();
6432
6445
  const activeView = visViewer.activeView;
6433
- this._viewer.resetActiveDragger();
6434
- this._viewer.clearSlices();
6435
- this.clearOverlay();
6436
- if (viewpoint.orthogonal_camera) {
6437
- 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);
6438
- }
6439
6446
  this._viewer.syncOverlay();
6440
6447
  const markupColor = viewpoint.custom_fields.markup_color || {
6441
6448
  r: 255,
@@ -6473,17 +6480,9 @@ class VisualizeMarkup {
6473
6480
  entityPtr.delete();
6474
6481
  }
6475
6482
  }
6476
- if (viewpoint.clipping_planes) {
6477
- for (const plane of viewpoint.clipping_planes) {
6478
- const cuttingPlane = new visLib.OdTvPlane;
6479
- cuttingPlane.set(getLogicalPoint3dAsArray(plane.location), getLogicalPoint3dAsArray(plane.direction));
6480
- activeView.addCuttingPlane(cuttingPlane);
6481
- activeView.setEnableCuttingPlaneFill(true, 102, 102, 102);
6482
- }
6483
- }
6484
6483
  this._viewer.update();
6485
6484
  }
6486
- createViewpoint() {
6485
+ getViewpoint() {
6487
6486
  function getLogicalPoint3dFromArray(array) {
6488
6487
  return {
6489
6488
  x: array[0],
@@ -6494,18 +6493,9 @@ class VisualizeMarkup {
6494
6493
  if (!this._viewer.visualizeJs) return {};
6495
6494
  const visLib = this._viewer.visLib();
6496
6495
  const visViewer = visLib.getViewer();
6497
- const activeView = visViewer.activeView;
6498
6496
  const viewpoint = {
6499
6497
  lines: [],
6500
- texts: [],
6501
- clipping_planes: []
6502
- };
6503
- viewpoint.orthogonal_camera = {
6504
- view_point: getLogicalPoint3dFromArray(activeView.viewPosition),
6505
- direction: getLogicalPoint3dFromArray(activeView.viewTarget),
6506
- up_vector: getLogicalPoint3dFromArray(activeView.upVector),
6507
- field_width: activeView.viewFieldWidth,
6508
- field_height: activeView.viewFieldHeight
6498
+ texts: []
6509
6499
  };
6510
6500
  const model = visViewer.getMarkupModel();
6511
6501
  const itr = model.getEntitiesIterator();
@@ -6545,14 +6535,6 @@ class VisualizeMarkup {
6545
6535
  entityPtr.delete();
6546
6536
  }
6547
6537
  itr.delete();
6548
- for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
6549
- const cuttingPlane = activeView.getCuttingPlane(i);
6550
- const plane = {
6551
- location: getLogicalPoint3dFromArray(cuttingPlane.getOrigin()),
6552
- direction: getLogicalPoint3dFromArray(cuttingPlane.normal())
6553
- };
6554
- viewpoint.clipping_planes.push(plane);
6555
- }
6556
6538
  viewpoint.snapshot = {
6557
6539
  data: visLib.canvas.toDataURL("image/jpeg", .25)
6558
6540
  };
@@ -6580,6 +6562,13 @@ class VisualizeMarkup {
6580
6562
  clearSelected() {
6581
6563
  throw new Error("Not implemented yet");
6582
6564
  }
6565
+ getPoint3dFromArray(array) {
6566
+ return {
6567
+ x: array[0],
6568
+ y: array[1],
6569
+ z: array[2]
6570
+ };
6571
+ }
6583
6572
  }
6584
6573
 
6585
6574
  class MarkupFactory {
@@ -7236,12 +7225,74 @@ class Viewer extends EventEmitter2 {
7236
7225
  return entityId;
7237
7226
  }
7238
7227
  drawViewpoint(viewpoint) {
7239
- this.markup.drawViewpoint(viewpoint);
7228
+ this.setOrthogonalCameraSettings(viewpoint);
7229
+ this.setClippingPlanes(viewpoint);
7230
+ this.markup.setViewpoint(viewpoint);
7240
7231
  }
7241
7232
  createViewpoint() {
7242
- const vp = this.markup.createViewpoint();
7233
+ const vp = this.markup.getViewpoint();
7234
+ vp.orthogonal_camera = this.getOrthogonalCameraSettings();
7235
+ vp.clipping_planes = this.getClippingPlanes();
7243
7236
  return vp;
7244
7237
  }
7238
+ getPoint3dFromArray(array) {
7239
+ return {
7240
+ x: array[0],
7241
+ y: array[1],
7242
+ z: array[2]
7243
+ };
7244
+ }
7245
+ getLogicalPoint3dAsArray(point3d) {
7246
+ return [ point3d.x, point3d.y, point3d.z ];
7247
+ }
7248
+ getOrthogonalCameraSettings() {
7249
+ const visViewer = this.visViewer();
7250
+ const activeView = visViewer.activeView;
7251
+ return {
7252
+ view_point: this.getPoint3dFromArray(activeView.viewPosition),
7253
+ direction: this.getPoint3dFromArray(activeView.viewTarget),
7254
+ up_vector: this.getPoint3dFromArray(activeView.upVector),
7255
+ field_width: activeView.viewFieldWidth,
7256
+ field_height: activeView.viewFieldHeight
7257
+ };
7258
+ }
7259
+ setOrthogonalCameraSettings(viewpoint) {
7260
+ const visViewer = this.visViewer();
7261
+ const activeView = visViewer.activeView;
7262
+ this.resetActiveDragger();
7263
+ this.clearSlices();
7264
+ this.clearOverlay();
7265
+ if (viewpoint.orthogonal_camera) {
7266
+ 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);
7267
+ }
7268
+ this.syncOverlay();
7269
+ }
7270
+ getClippingPlanes() {
7271
+ const visViewer = this.visViewer();
7272
+ const activeView = visViewer.activeView;
7273
+ const clipping_planes = [];
7274
+ for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
7275
+ const cuttingPlane = activeView.getCuttingPlane(i);
7276
+ const plane = {
7277
+ location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
7278
+ direction: this.getPoint3dFromArray(cuttingPlane.normal())
7279
+ };
7280
+ clipping_planes.push(plane);
7281
+ }
7282
+ return clipping_planes;
7283
+ }
7284
+ setClippingPlanes(viewpoint) {
7285
+ if (viewpoint.clipping_planes) {
7286
+ const visViewer = this.visViewer();
7287
+ const activeView = visViewer.activeView;
7288
+ for (const plane of viewpoint.clipping_planes) {
7289
+ const cuttingPlane = new (this.visLib().OdTvPlane);
7290
+ cuttingPlane.set(this.getLogicalPoint3dAsArray(plane.location), this.getLogicalPoint3dAsArray(plane.direction));
7291
+ activeView.addCuttingPlane(cuttingPlane);
7292
+ activeView.setEnableCuttingPlaneFill(true, 102, 102, 102);
7293
+ }
7294
+ }
7295
+ }
7245
7296
  executeCommand(id, ...args) {
7246
7297
  return commands("VisualizeJS").executeCommand(id, this, ...args);
7247
7298
  }
@@ -7576,7 +7627,7 @@ function zoomToSelected(viewer) {
7576
7627
 
7577
7628
  commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
7578
7629
 
7579
- const version = "25.2.5";
7630
+ const version = "25.2.10";
7580
7631
 
7581
7632
  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 };
7582
7633
  //# sourceMappingURL=client.module.js.map