@inweb/client 25.2.5 → 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.
@@ -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.5"
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);
@@ -5489,44 +5542,17 @@ class KonvaMarkup {
5489
5542
  }));
5490
5543
  this._konvaLayer.draw();
5491
5544
  }
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();
5545
+ setViewpoint(viewpoint) {
5508
5546
  const markupColor = viewpoint.custom_fields.markup_color || {
5509
5547
  r: 255,
5510
5548
  g: 0,
5511
5549
  b: 0
5512
5550
  };
5513
5551
  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
5552
  this.loadMarkup(viewpoint);
5523
- this._viewer.update();
5524
5553
  }
5525
- createViewpoint() {
5554
+ getViewpoint() {
5526
5555
  if (!this._viewer.visualizeJs) return {};
5527
- const visLib = this._viewer.visLib();
5528
- const visViewer = visLib.getViewer();
5529
- const activeView = visViewer.activeView;
5530
5556
  const viewpoint = {
5531
5557
  lines: [],
5532
5558
  texts: [],
@@ -5534,24 +5560,8 @@ class KonvaMarkup {
5534
5560
  clouds: [],
5535
5561
  ellipses: [],
5536
5562
  images: [],
5537
- rectangles: [],
5538
- clipping_planes: []
5539
- };
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
5563
+ rectangles: []
5546
5564
  };
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
5565
  viewpoint.snapshot = {
5556
5566
  data: this.combineMarkupWithDrawing()
5557
5567
  };
@@ -6419,7 +6429,7 @@ class VisualizeMarkup {
6419
6429
  itr.delete();
6420
6430
  this._viewer.update();
6421
6431
  }
6422
- drawViewpoint(viewpoint) {
6432
+ setViewpoint(viewpoint) {
6423
6433
  function getLogicalPoint3dAsArray(point3d) {
6424
6434
  return [ point3d.x, point3d.y, point3d.z ];
6425
6435
  }
@@ -6430,12 +6440,6 @@ class VisualizeMarkup {
6430
6440
  const visLib = this._viewer.visLib();
6431
6441
  const visViewer = visLib.getViewer();
6432
6442
  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
6443
  this._viewer.syncOverlay();
6440
6444
  const markupColor = viewpoint.custom_fields.markup_color || {
6441
6445
  r: 255,
@@ -6473,17 +6477,9 @@ class VisualizeMarkup {
6473
6477
  entityPtr.delete();
6474
6478
  }
6475
6479
  }
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
6480
  this._viewer.update();
6485
6481
  }
6486
- createViewpoint() {
6482
+ getViewpoint() {
6487
6483
  function getLogicalPoint3dFromArray(array) {
6488
6484
  return {
6489
6485
  x: array[0],
@@ -6494,18 +6490,9 @@ class VisualizeMarkup {
6494
6490
  if (!this._viewer.visualizeJs) return {};
6495
6491
  const visLib = this._viewer.visLib();
6496
6492
  const visViewer = visLib.getViewer();
6497
- const activeView = visViewer.activeView;
6498
6493
  const viewpoint = {
6499
6494
  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
6495
+ texts: []
6509
6496
  };
6510
6497
  const model = visViewer.getMarkupModel();
6511
6498
  const itr = model.getEntitiesIterator();
@@ -6545,14 +6532,6 @@ class VisualizeMarkup {
6545
6532
  entityPtr.delete();
6546
6533
  }
6547
6534
  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
6535
  viewpoint.snapshot = {
6557
6536
  data: visLib.canvas.toDataURL("image/jpeg", .25)
6558
6537
  };
@@ -6580,6 +6559,13 @@ class VisualizeMarkup {
6580
6559
  clearSelected() {
6581
6560
  throw new Error("Not implemented yet");
6582
6561
  }
6562
+ getPoint3dFromArray(array) {
6563
+ return {
6564
+ x: array[0],
6565
+ y: array[1],
6566
+ z: array[2]
6567
+ };
6568
+ }
6583
6569
  }
6584
6570
 
6585
6571
  class MarkupFactory {
@@ -7236,12 +7222,74 @@ class Viewer extends EventEmitter2 {
7236
7222
  return entityId;
7237
7223
  }
7238
7224
  drawViewpoint(viewpoint) {
7239
- this.markup.drawViewpoint(viewpoint);
7225
+ this.setOrthogonalCameraSettings(viewpoint);
7226
+ this.setClippingPlanes(viewpoint);
7227
+ this.markup.setViewpoint(viewpoint);
7240
7228
  }
7241
7229
  createViewpoint() {
7242
- const vp = this.markup.createViewpoint();
7230
+ const vp = this.markup.getViewpoint();
7231
+ vp.orthogonal_camera = this.getOrthogonalCameraSettings();
7232
+ vp.clipping_planes = this.getClippingPlanes();
7243
7233
  return vp;
7244
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
+ }
7245
7293
  executeCommand(id, ...args) {
7246
7294
  return commands("VisualizeJS").executeCommand(id, this, ...args);
7247
7295
  }
@@ -7576,7 +7624,7 @@ function zoomToSelected(viewer) {
7576
7624
 
7577
7625
  commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
7578
7626
 
7579
- const version = "25.2.5";
7627
+ const version = "25.2.8";
7580
7628
 
7581
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 };
7582
7630
  //# sourceMappingURL=client.module.js.map