@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.
package/dist/client.js CHANGED
@@ -1592,6 +1592,7 @@
1592
1592
  cameraAxisXSpeed: 4,
1593
1593
  cameraAxisYSpeed: 1,
1594
1594
  ambientOcclusion: false,
1595
+ enableStreamingMode: true,
1595
1596
  enablePartialMode: false,
1596
1597
  memoryLimit: 3294967296,
1597
1598
  cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
@@ -1720,6 +1721,16 @@
1720
1721
  this._data.ambientOcclusion = value;
1721
1722
  this.notifierChangeEvent();
1722
1723
  }
1724
+ get enableStreamingMode() {
1725
+ return this._data.enableStreamingMode;
1726
+ }
1727
+ set enableStreamingMode(value) {
1728
+ this._data.enableStreamingMode = value;
1729
+ if (this._data.enableStreamingMode) {
1730
+ this._data.enablePartialMode = false;
1731
+ }
1732
+ this.notifierChangeEvent();
1733
+ }
1723
1734
  get enablePartialMode() {
1724
1735
  return this._data.enablePartialMode;
1725
1736
  }
@@ -3914,7 +3925,7 @@
3914
3925
  .then((data) => ({
3915
3926
  ...data,
3916
3927
  server: data.version,
3917
- client: "25.2.5",
3928
+ client: "25.2.10",
3918
3929
  }));
3919
3930
  }
3920
3931
  /**
@@ -6675,7 +6686,7 @@
6675
6686
  }
6676
6687
 
6677
6688
  ///////////////////////////////////////////////////////////////////////////////
6678
- class VsfXLoader extends BaseLoader {
6689
+ class VsfXStreamingLoader extends BaseLoader {
6679
6690
  async load() {
6680
6691
  if (!this.viewer.visualizeJs)
6681
6692
  return;
@@ -6884,14 +6895,51 @@
6884
6895
  }
6885
6896
  }
6886
6897
 
6898
+ ///////////////////////////////////////////////////////////////////////////////
6899
+ class VsfXLoader extends BaseLoader {
6900
+ async load() {
6901
+ if (!this.viewer.visualizeJs)
6902
+ return;
6903
+ const visLib = this.viewer.visLib();
6904
+ const visViewer = visLib.getViewer();
6905
+ const abortController = new AbortController();
6906
+ this.viewer._abortController = abortController;
6907
+ console.time("File load time");
6908
+ try {
6909
+ this.viewer.emitEvent({ type: "geometrystart", model: this.model });
6910
+ const progressCb = (progress) => this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
6911
+ const arrayBuffer = await this.model.downloadResource(this.model.database, progressCb, abortController.signal);
6912
+ if (abortController.signal.aborted) {
6913
+ await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
6914
+ }
6915
+ if (this.viewer.visualizeJs) {
6916
+ visViewer.parseVsfx(new Uint8Array(arrayBuffer));
6917
+ this.viewer.update(true);
6918
+ this.viewer.syncOpenCloudVisualStyle(false);
6919
+ this.viewer.syncOptions();
6920
+ this.viewer.resize();
6921
+ }
6922
+ console.timeEnd("File load time");
6923
+ this.viewer.emitEvent({ type: "geometryend", model: this.model });
6924
+ }
6925
+ catch (error) {
6926
+ this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
6927
+ throw error;
6928
+ }
6929
+ }
6930
+ }
6931
+
6887
6932
  ///////////////////////////////////////////////////////////////////////////////
6888
6933
  class LoaderFactory {
6889
6934
  create(viewer, model, options) {
6890
6935
  const geometryType = model.database.split(".").pop();
6891
6936
  if (model.geometry.length === 0 && geometryType === "vsfx") {
6892
- return options.enablePartialMode
6893
- ? new VsfXPartialLoader(viewer, model, options)
6894
- : new VsfXLoader(viewer, model, options);
6937
+ if (!options.enableStreamingMode)
6938
+ return new VsfXLoader(viewer, model, options);
6939
+ else if (options.enablePartialMode)
6940
+ return new VsfXPartialLoader(viewer, model, options);
6941
+ else
6942
+ return new VsfXStreamingLoader(viewer, model, options);
6895
6943
  }
6896
6944
  if (geometryType === "data") {
6897
6945
  return new TCSLoader(viewer, model, options);
@@ -19212,43 +19260,14 @@
19212
19260
  });
19213
19261
  this._konvaLayer.draw();
19214
19262
  }
19215
- drawViewpoint(viewpoint) {
19216
- function getLogicalPoint3dAsArray(point3d) {
19217
- return [point3d.x, point3d.y, point3d.z];
19218
- }
19219
- if (!this._isInitialized)
19220
- return;
19221
- if (!this._viewer.visualizeJs)
19222
- return;
19223
- const visLib = this._viewer.visLib();
19224
- const visViewer = visLib.getViewer();
19225
- const activeView = visViewer.activeView;
19226
- this._viewer.resetActiveDragger();
19227
- this._viewer.clearSlices();
19228
- this._viewer.clearOverlay();
19229
- if (viewpoint.orthogonal_camera) {
19230
- 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);
19231
- }
19232
- this._viewer.syncOverlay();
19263
+ setViewpoint(viewpoint) {
19233
19264
  const markupColor = viewpoint.custom_fields.markup_color || { r: 255, g: 0, b: 0 };
19234
19265
  this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
19235
- if (viewpoint.clipping_planes) {
19236
- for (const plane of viewpoint.clipping_planes) {
19237
- const cuttingPlane = new visLib.OdTvPlane();
19238
- cuttingPlane.set(getLogicalPoint3dAsArray(plane.location), getLogicalPoint3dAsArray(plane.direction));
19239
- activeView.addCuttingPlane(cuttingPlane);
19240
- activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
19241
- }
19242
- }
19243
19266
  this.loadMarkup(viewpoint);
19244
- this._viewer.update();
19245
19267
  }
19246
- createViewpoint() {
19268
+ getViewpoint() {
19247
19269
  if (!this._viewer.visualizeJs)
19248
19270
  return {};
19249
- const visLib = this._viewer.visLib();
19250
- const visViewer = visLib.getViewer();
19251
- const activeView = visViewer.activeView;
19252
19271
  const viewpoint = {
19253
19272
  lines: [],
19254
19273
  texts: [],
@@ -19257,23 +19276,7 @@
19257
19276
  ellipses: [],
19258
19277
  images: [],
19259
19278
  rectangles: [],
19260
- clipping_planes: [],
19261
- };
19262
- viewpoint.orthogonal_camera = {
19263
- view_point: this.getPoint3dFromArray(activeView.viewPosition),
19264
- direction: this.getPoint3dFromArray(activeView.viewTarget),
19265
- up_vector: this.getPoint3dFromArray(activeView.upVector),
19266
- field_width: activeView.viewFieldWidth,
19267
- field_height: activeView.viewFieldHeight,
19268
19279
  };
19269
- for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
19270
- const cuttingPlane = activeView.getCuttingPlane(i);
19271
- const plane = {
19272
- location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
19273
- direction: this.getPoint3dFromArray(cuttingPlane.normal()),
19274
- };
19275
- viewpoint.clipping_planes.push(plane);
19276
- }
19277
19280
  viewpoint.snapshot = {
19278
19281
  data: this.combineMarkupWithDrawing(),
19279
19282
  };
@@ -20125,7 +20128,7 @@
20125
20128
  itr.delete();
20126
20129
  this._viewer.update();
20127
20130
  }
20128
- drawViewpoint(viewpoint) {
20131
+ setViewpoint(viewpoint) {
20129
20132
  function getLogicalPoint3dAsArray(point3d) {
20130
20133
  return [point3d.x, point3d.y, point3d.z];
20131
20134
  }
@@ -20137,12 +20140,6 @@
20137
20140
  const visLib = this._viewer.visLib();
20138
20141
  const visViewer = visLib.getViewer();
20139
20142
  const activeView = visViewer.activeView;
20140
- this._viewer.resetActiveDragger();
20141
- this._viewer.clearSlices();
20142
- this.clearOverlay();
20143
- if (viewpoint.orthogonal_camera) {
20144
- 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);
20145
- }
20146
20143
  this._viewer.syncOverlay();
20147
20144
  const markupColor = viewpoint.custom_fields.markup_color || { r: 255, g: 0, b: 0 };
20148
20145
  this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
@@ -20176,17 +20173,9 @@
20176
20173
  entityPtr.delete();
20177
20174
  }
20178
20175
  }
20179
- if (viewpoint.clipping_planes) {
20180
- for (const plane of viewpoint.clipping_planes) {
20181
- const cuttingPlane = new visLib.OdTvPlane();
20182
- cuttingPlane.set(getLogicalPoint3dAsArray(plane.location), getLogicalPoint3dAsArray(plane.direction));
20183
- activeView.addCuttingPlane(cuttingPlane);
20184
- activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
20185
- }
20186
- }
20187
20176
  this._viewer.update();
20188
20177
  }
20189
- createViewpoint() {
20178
+ getViewpoint() {
20190
20179
  function getLogicalPoint3dFromArray(array) {
20191
20180
  return { x: array[0], y: array[1], z: array[2] };
20192
20181
  }
@@ -20194,18 +20183,9 @@
20194
20183
  return {};
20195
20184
  const visLib = this._viewer.visLib();
20196
20185
  const visViewer = visLib.getViewer();
20197
- const activeView = visViewer.activeView;
20198
20186
  const viewpoint = {
20199
20187
  lines: [],
20200
20188
  texts: [],
20201
- clipping_planes: [],
20202
- };
20203
- viewpoint.orthogonal_camera = {
20204
- view_point: getLogicalPoint3dFromArray(activeView.viewPosition),
20205
- direction: getLogicalPoint3dFromArray(activeView.viewTarget),
20206
- up_vector: getLogicalPoint3dFromArray(activeView.upVector),
20207
- field_width: activeView.viewFieldWidth,
20208
- field_height: activeView.viewFieldHeight,
20209
20189
  };
20210
20190
  const model = visViewer.getMarkupModel();
20211
20191
  const itr = model.getEntitiesIterator();
@@ -20246,14 +20226,6 @@
20246
20226
  entityPtr.delete();
20247
20227
  }
20248
20228
  itr.delete();
20249
- for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
20250
- const cuttingPlane = activeView.getCuttingPlane(i);
20251
- const plane = {
20252
- location: getLogicalPoint3dFromArray(cuttingPlane.getOrigin()),
20253
- direction: getLogicalPoint3dFromArray(cuttingPlane.normal()),
20254
- };
20255
- viewpoint.clipping_planes.push(plane);
20256
- }
20257
20229
  viewpoint.snapshot = {
20258
20230
  data: visLib.canvas.toDataURL("image/jpeg", 0.25),
20259
20231
  };
@@ -20281,6 +20253,9 @@
20281
20253
  clearSelected() {
20282
20254
  throw new Error("Not implemented yet");
20283
20255
  }
20256
+ getPoint3dFromArray(array) {
20257
+ return { x: array[0], y: array[1], z: array[2] };
20258
+ }
20284
20259
  }
20285
20260
 
20286
20261
  class MarkupFactory {
@@ -21149,7 +21124,9 @@
21149
21124
  * @param viewpoint - Viewpoint.
21150
21125
  */
21151
21126
  drawViewpoint(viewpoint) {
21152
- this.markup.drawViewpoint(viewpoint);
21127
+ this.setOrthogonalCameraSettings(viewpoint);
21128
+ this.setClippingPlanes(viewpoint);
21129
+ this.markup.setViewpoint(viewpoint);
21153
21130
  }
21154
21131
  /**
21155
21132
  * Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the
@@ -21157,9 +21134,65 @@
21157
21134
  * {@link File#saveViewpoint | File.saveViewpoint()}.
21158
21135
  */
21159
21136
  createViewpoint() {
21160
- const vp = this.markup.createViewpoint();
21137
+ const vp = this.markup.getViewpoint();
21138
+ vp.orthogonal_camera = this.getOrthogonalCameraSettings();
21139
+ vp.clipping_planes = this.getClippingPlanes();
21161
21140
  return vp;
21162
21141
  }
21142
+ getPoint3dFromArray(array) {
21143
+ return { x: array[0], y: array[1], z: array[2] };
21144
+ }
21145
+ getLogicalPoint3dAsArray(point3d) {
21146
+ return [point3d.x, point3d.y, point3d.z];
21147
+ }
21148
+ getOrthogonalCameraSettings() {
21149
+ const visViewer = this.visViewer();
21150
+ const activeView = visViewer.activeView;
21151
+ return {
21152
+ view_point: this.getPoint3dFromArray(activeView.viewPosition),
21153
+ direction: this.getPoint3dFromArray(activeView.viewTarget),
21154
+ up_vector: this.getPoint3dFromArray(activeView.upVector),
21155
+ field_width: activeView.viewFieldWidth,
21156
+ field_height: activeView.viewFieldHeight,
21157
+ };
21158
+ }
21159
+ setOrthogonalCameraSettings(viewpoint) {
21160
+ const visViewer = this.visViewer();
21161
+ const activeView = visViewer.activeView;
21162
+ this.resetActiveDragger();
21163
+ this.clearSlices();
21164
+ this.clearOverlay();
21165
+ if (viewpoint.orthogonal_camera) {
21166
+ 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);
21167
+ }
21168
+ this.syncOverlay();
21169
+ }
21170
+ getClippingPlanes() {
21171
+ const visViewer = this.visViewer();
21172
+ const activeView = visViewer.activeView;
21173
+ const clipping_planes = [];
21174
+ for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
21175
+ const cuttingPlane = activeView.getCuttingPlane(i);
21176
+ const plane = {
21177
+ location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
21178
+ direction: this.getPoint3dFromArray(cuttingPlane.normal()),
21179
+ };
21180
+ clipping_planes.push(plane);
21181
+ }
21182
+ return clipping_planes;
21183
+ }
21184
+ setClippingPlanes(viewpoint) {
21185
+ if (viewpoint.clipping_planes) {
21186
+ const visViewer = this.visViewer();
21187
+ const activeView = visViewer.activeView;
21188
+ for (const plane of viewpoint.clipping_planes) {
21189
+ const cuttingPlane = new (this.visLib().OdTvPlane)();
21190
+ cuttingPlane.set(this.getLogicalPoint3dAsArray(plane.location), this.getLogicalPoint3dAsArray(plane.direction));
21191
+ activeView.addCuttingPlane(cuttingPlane);
21192
+ activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
21193
+ }
21194
+ }
21195
+ }
21163
21196
  /**
21164
21197
  * Executes the command denoted by the given command identifier.
21165
21198
  *
@@ -21485,7 +21518,7 @@
21485
21518
  commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
21486
21519
 
21487
21520
  ///////////////////////////////////////////////////////////////////////////////
21488
- const version = "25.2.5";
21521
+ const version = "25.2.10";
21489
21522
 
21490
21523
  exports.Assembly = Assembly;
21491
21524
  exports.CANVAS_EVENTS = CANVAS_EVENTS;