@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.
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,13 @@
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
+ this.notifierChangeEvent();
1730
+ }
1723
1731
  get enablePartialMode() {
1724
1732
  return this._data.enablePartialMode;
1725
1733
  }
@@ -3914,7 +3922,7 @@
3914
3922
  .then((data) => ({
3915
3923
  ...data,
3916
3924
  server: data.version,
3917
- client: "25.2.5",
3925
+ client: "25.2.8",
3918
3926
  }));
3919
3927
  }
3920
3928
  /**
@@ -6675,7 +6683,7 @@
6675
6683
  }
6676
6684
 
6677
6685
  ///////////////////////////////////////////////////////////////////////////////
6678
- class VsfXLoader extends BaseLoader {
6686
+ class VsfXStreamingLoader extends BaseLoader {
6679
6687
  async load() {
6680
6688
  if (!this.viewer.visualizeJs)
6681
6689
  return;
@@ -6884,14 +6892,51 @@
6884
6892
  }
6885
6893
  }
6886
6894
 
6895
+ ///////////////////////////////////////////////////////////////////////////////
6896
+ class VsfXLoader extends BaseLoader {
6897
+ async load() {
6898
+ if (!this.viewer.visualizeJs)
6899
+ return;
6900
+ const visLib = this.viewer.visLib();
6901
+ const visViewer = visLib.getViewer();
6902
+ const abortController = new AbortController();
6903
+ this.viewer._abortController = abortController;
6904
+ console.time("File load time");
6905
+ try {
6906
+ this.viewer.emitEvent({ type: "geometrystart", model: this.model });
6907
+ const progressCb = (progress) => this.viewer.emitEvent({ type: "geometryprogress", data: progress, model: this.model });
6908
+ const arrayBuffer = await this.model.downloadResource(this.model.database, progressCb, abortController.signal);
6909
+ if (abortController.signal.aborted) {
6910
+ await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
6911
+ }
6912
+ if (this.viewer.visualizeJs) {
6913
+ visViewer.parseVsfx(new Uint8Array(arrayBuffer));
6914
+ this.viewer.update(true);
6915
+ this.viewer.syncOpenCloudVisualStyle(false);
6916
+ this.viewer.syncOptions();
6917
+ this.viewer.resize();
6918
+ }
6919
+ console.timeEnd("File load time");
6920
+ this.viewer.emitEvent({ type: "geometryend", model: this.model });
6921
+ }
6922
+ catch (error) {
6923
+ this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
6924
+ throw error;
6925
+ }
6926
+ }
6927
+ }
6928
+
6887
6929
  ///////////////////////////////////////////////////////////////////////////////
6888
6930
  class LoaderFactory {
6889
6931
  create(viewer, model, options) {
6890
6932
  const geometryType = model.database.split(".").pop();
6891
6933
  if (model.geometry.length === 0 && geometryType === "vsfx") {
6892
- return options.enablePartialMode
6893
- ? new VsfXPartialLoader(viewer, model, options)
6894
- : new VsfXLoader(viewer, model, options);
6934
+ if (!options.enableStreamingMode)
6935
+ return new VsfXLoader(viewer, model, options);
6936
+ else if (options.enablePartialMode)
6937
+ return new VsfXPartialLoader(viewer, model, options);
6938
+ else
6939
+ return new VsfXStreamingLoader(viewer, model, options);
6895
6940
  }
6896
6941
  if (geometryType === "data") {
6897
6942
  return new TCSLoader(viewer, model, options);
@@ -19212,43 +19257,14 @@
19212
19257
  });
19213
19258
  this._konvaLayer.draw();
19214
19259
  }
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();
19260
+ setViewpoint(viewpoint) {
19233
19261
  const markupColor = viewpoint.custom_fields.markup_color || { r: 255, g: 0, b: 0 };
19234
19262
  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
19263
  this.loadMarkup(viewpoint);
19244
- this._viewer.update();
19245
19264
  }
19246
- createViewpoint() {
19265
+ getViewpoint() {
19247
19266
  if (!this._viewer.visualizeJs)
19248
19267
  return {};
19249
- const visLib = this._viewer.visLib();
19250
- const visViewer = visLib.getViewer();
19251
- const activeView = visViewer.activeView;
19252
19268
  const viewpoint = {
19253
19269
  lines: [],
19254
19270
  texts: [],
@@ -19257,23 +19273,7 @@
19257
19273
  ellipses: [],
19258
19274
  images: [],
19259
19275
  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
19276
  };
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
19277
  viewpoint.snapshot = {
19278
19278
  data: this.combineMarkupWithDrawing(),
19279
19279
  };
@@ -20125,7 +20125,7 @@
20125
20125
  itr.delete();
20126
20126
  this._viewer.update();
20127
20127
  }
20128
- drawViewpoint(viewpoint) {
20128
+ setViewpoint(viewpoint) {
20129
20129
  function getLogicalPoint3dAsArray(point3d) {
20130
20130
  return [point3d.x, point3d.y, point3d.z];
20131
20131
  }
@@ -20137,12 +20137,6 @@
20137
20137
  const visLib = this._viewer.visLib();
20138
20138
  const visViewer = visLib.getViewer();
20139
20139
  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
20140
  this._viewer.syncOverlay();
20147
20141
  const markupColor = viewpoint.custom_fields.markup_color || { r: 255, g: 0, b: 0 };
20148
20142
  this.setMarkupColor(markupColor.r, markupColor.g, markupColor.b);
@@ -20176,17 +20170,9 @@
20176
20170
  entityPtr.delete();
20177
20171
  }
20178
20172
  }
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
20173
  this._viewer.update();
20188
20174
  }
20189
- createViewpoint() {
20175
+ getViewpoint() {
20190
20176
  function getLogicalPoint3dFromArray(array) {
20191
20177
  return { x: array[0], y: array[1], z: array[2] };
20192
20178
  }
@@ -20194,18 +20180,9 @@
20194
20180
  return {};
20195
20181
  const visLib = this._viewer.visLib();
20196
20182
  const visViewer = visLib.getViewer();
20197
- const activeView = visViewer.activeView;
20198
20183
  const viewpoint = {
20199
20184
  lines: [],
20200
20185
  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
20186
  };
20210
20187
  const model = visViewer.getMarkupModel();
20211
20188
  const itr = model.getEntitiesIterator();
@@ -20246,14 +20223,6 @@
20246
20223
  entityPtr.delete();
20247
20224
  }
20248
20225
  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
20226
  viewpoint.snapshot = {
20258
20227
  data: visLib.canvas.toDataURL("image/jpeg", 0.25),
20259
20228
  };
@@ -20281,6 +20250,9 @@
20281
20250
  clearSelected() {
20282
20251
  throw new Error("Not implemented yet");
20283
20252
  }
20253
+ getPoint3dFromArray(array) {
20254
+ return { x: array[0], y: array[1], z: array[2] };
20255
+ }
20284
20256
  }
20285
20257
 
20286
20258
  class MarkupFactory {
@@ -21149,7 +21121,9 @@
21149
21121
  * @param viewpoint - Viewpoint.
21150
21122
  */
21151
21123
  drawViewpoint(viewpoint) {
21152
- this.markup.drawViewpoint(viewpoint);
21124
+ this.setOrthogonalCameraSettings(viewpoint);
21125
+ this.setClippingPlanes(viewpoint);
21126
+ this.markup.setViewpoint(viewpoint);
21153
21127
  }
21154
21128
  /**
21155
21129
  * Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the
@@ -21157,9 +21131,65 @@
21157
21131
  * {@link File#saveViewpoint | File.saveViewpoint()}.
21158
21132
  */
21159
21133
  createViewpoint() {
21160
- const vp = this.markup.createViewpoint();
21134
+ const vp = this.markup.getViewpoint();
21135
+ vp.orthogonal_camera = this.getOrthogonalCameraSettings();
21136
+ vp.clipping_planes = this.getClippingPlanes();
21161
21137
  return vp;
21162
21138
  }
21139
+ getPoint3dFromArray(array) {
21140
+ return { x: array[0], y: array[1], z: array[2] };
21141
+ }
21142
+ getLogicalPoint3dAsArray(point3d) {
21143
+ return [point3d.x, point3d.y, point3d.z];
21144
+ }
21145
+ getOrthogonalCameraSettings() {
21146
+ const visViewer = this.visViewer();
21147
+ const activeView = visViewer.activeView;
21148
+ return {
21149
+ view_point: this.getPoint3dFromArray(activeView.viewPosition),
21150
+ direction: this.getPoint3dFromArray(activeView.viewTarget),
21151
+ up_vector: this.getPoint3dFromArray(activeView.upVector),
21152
+ field_width: activeView.viewFieldWidth,
21153
+ field_height: activeView.viewFieldHeight,
21154
+ };
21155
+ }
21156
+ setOrthogonalCameraSettings(viewpoint) {
21157
+ const visViewer = this.visViewer();
21158
+ const activeView = visViewer.activeView;
21159
+ this.resetActiveDragger();
21160
+ this.clearSlices();
21161
+ this.clearOverlay();
21162
+ if (viewpoint.orthogonal_camera) {
21163
+ 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);
21164
+ }
21165
+ this.syncOverlay();
21166
+ }
21167
+ getClippingPlanes() {
21168
+ const visViewer = this.visViewer();
21169
+ const activeView = visViewer.activeView;
21170
+ const clipping_planes = [];
21171
+ for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
21172
+ const cuttingPlane = activeView.getCuttingPlane(i);
21173
+ const plane = {
21174
+ location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
21175
+ direction: this.getPoint3dFromArray(cuttingPlane.normal()),
21176
+ };
21177
+ clipping_planes.push(plane);
21178
+ }
21179
+ return clipping_planes;
21180
+ }
21181
+ setClippingPlanes(viewpoint) {
21182
+ if (viewpoint.clipping_planes) {
21183
+ const visViewer = this.visViewer();
21184
+ const activeView = visViewer.activeView;
21185
+ for (const plane of viewpoint.clipping_planes) {
21186
+ const cuttingPlane = new (this.visLib().OdTvPlane)();
21187
+ cuttingPlane.set(this.getLogicalPoint3dAsArray(plane.location), this.getLogicalPoint3dAsArray(plane.direction));
21188
+ activeView.addCuttingPlane(cuttingPlane);
21189
+ activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
21190
+ }
21191
+ }
21192
+ }
21163
21193
  /**
21164
21194
  * Executes the command denoted by the given command identifier.
21165
21195
  *
@@ -21485,7 +21515,7 @@
21485
21515
  commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
21486
21516
 
21487
21517
  ///////////////////////////////////////////////////////////////////////////////
21488
- const version = "25.2.5";
21518
+ const version = "25.2.8";
21489
21519
 
21490
21520
  exports.Assembly = Assembly;
21491
21521
  exports.CANVAS_EVENTS = CANVAS_EVENTS;