@inweb/viewer-visualize 25.11.0 → 25.11.2

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.
@@ -552,7 +552,7 @@ commands("VisualizeJS").registerCommand("regenerateAll", regenerateAll);
552
552
 
553
553
  function resetView(viewer) {
554
554
  if (!viewer.visualizeJs) return;
555
- viewer.executeCommand("setActiveDragger", "");
555
+ viewer.executeCommand("setActiveDragger");
556
556
  viewer.executeCommand("clearSlices");
557
557
  viewer.executeCommand("clearOverlay");
558
558
  viewer.executeCommand("setMarkupColor");
@@ -1944,8 +1944,8 @@ class KonvaMarkup {
1944
1944
  this.addImage(screenPoint, image.src, image.width, image.height, image.id);
1945
1945
  }));
1946
1946
  }
1947
- getViewpoint() {
1948
- const viewpoint = {};
1947
+ getViewpoint(viewpoint) {
1948
+ if (!viewpoint) viewpoint = {};
1949
1949
  viewpoint.lines = this.getMarkupLines();
1950
1950
  viewpoint.texts = this.getMarkupTexts();
1951
1951
  viewpoint.arrows = this.getMarkupArrows();
@@ -1959,7 +1959,6 @@ class KonvaMarkup {
1959
1959
  viewpoint.snapshot = {
1960
1960
  data: this.combineMarkupWithDrawing()
1961
1961
  };
1962
- viewpoint.description = (new Date).toDateString();
1963
1962
  return viewpoint;
1964
1963
  }
1965
1964
  enableEditMode(mode) {
@@ -3516,7 +3515,7 @@ class OdaWalkDragger extends OdBaseDragger {
3516
3515
  const avp = this.viewer.activeView;
3517
3516
  avp.delete();
3518
3517
  }
3519
- this.subject.update();
3518
+ this.subject.update(true);
3520
3519
  this.subject.options.enableZoomWheel = this.enableZoomWheelPreviousValue;
3521
3520
  }
3522
3521
  keydown(ev) {
@@ -4645,6 +4644,7 @@ class TCSLoader extends BaseLoader {
4645
4644
  this.viewer.update(true);
4646
4645
  this.viewer.syncOpenCloudVisualStyle(false);
4647
4646
  this.viewer.syncOptions();
4647
+ this.viewer.syncOverlay();
4648
4648
  this.viewer.resize();
4649
4649
  this.viewer.emitEvent({
4650
4650
  type: "databasechunk",
@@ -4704,6 +4704,7 @@ class VsfXLoader extends BaseLoader {
4704
4704
  visViewer.parseVsfx(data);
4705
4705
  this.viewer.syncOpenCloudVisualStyle(false);
4706
4706
  this.viewer.syncOptions();
4707
+ this.viewer.syncOverlay();
4707
4708
  this.viewer.resize();
4708
4709
  }
4709
4710
  console.timeEnd("File load time");
@@ -4787,6 +4788,7 @@ class VsfXStreamingLoader extends BaseLoader {
4787
4788
  updaterController.update(UpdateType.kForce);
4788
4789
  this.viewer.syncOpenCloudVisualStyle(false);
4789
4790
  this.viewer.syncOptions();
4791
+ this.viewer.syncOverlay();
4790
4792
  this.viewer.resize();
4791
4793
  this.viewer.emitEvent({
4792
4794
  type: "databasechunk",
@@ -4860,6 +4862,7 @@ class VsfXPartialLoader extends BaseLoader {
4860
4862
  updaterController.update(UpdateType.kForce);
4861
4863
  this.viewer.syncOpenCloudVisualStyle(false);
4862
4864
  this.viewer.syncOptions();
4865
+ this.viewer.syncOverlay();
4863
4866
  this.viewer.resize();
4864
4867
  this.viewer.emitEvent({
4865
4868
  type: "databasechunk",
@@ -5253,7 +5256,8 @@ class VisualizeMarkup {
5253
5256
  }
5254
5257
  this._viewer.update();
5255
5258
  }
5256
- getViewpoint() {
5259
+ getViewpoint(viewpoint) {
5260
+ if (!this._viewer.visualizeJs) return {};
5257
5261
  function getLogicalPoint3dFromArray(array) {
5258
5262
  return {
5259
5263
  x: array[0],
@@ -5261,13 +5265,11 @@ class VisualizeMarkup {
5261
5265
  z: array[2]
5262
5266
  };
5263
5267
  }
5264
- if (!this._viewer.visualizeJs) return {};
5265
5268
  const visLib = this._viewer.visLib();
5266
5269
  const visViewer = visLib.getViewer();
5267
- const viewpoint = {
5268
- lines: [],
5269
- texts: []
5270
- };
5270
+ if (!viewpoint) viewpoint = {};
5271
+ viewpoint.lines = [];
5272
+ viewpoint.texts = [];
5271
5273
  const model = visViewer.getMarkupModel();
5272
5274
  const itr = model.getEntitiesIterator();
5273
5275
  for (;!itr.done(); itr.step()) {
@@ -5312,7 +5314,6 @@ class VisualizeMarkup {
5312
5314
  viewpoint.custom_fields = {
5313
5315
  markup_color: this.getMarkupColor()
5314
5316
  };
5315
- viewpoint.description = (new Date).toDateString();
5316
5317
  return viewpoint;
5317
5318
  }
5318
5319
  enableEditMode(mode) {
@@ -5443,6 +5444,7 @@ class Viewer extends EventEmitter2 {
5443
5444
  this._gestureManager.initialize();
5444
5445
  this.syncOpenCloudVisualStyle(true);
5445
5446
  this.syncOptions();
5447
+ this.syncOverlay();
5446
5448
  this._renderTime = performance.now();
5447
5449
  this.render(this._renderTime);
5448
5450
  this.emitEvent({
@@ -5725,6 +5727,7 @@ class Viewer extends EventEmitter2 {
5725
5727
  type: "changeactivedragger",
5726
5728
  data: name
5727
5729
  });
5730
+ this.update();
5728
5731
  }
5729
5732
  return this._activeDragger;
5730
5733
  }
@@ -5933,6 +5936,7 @@ class Viewer extends EventEmitter2 {
5933
5936
  visViewer.parseFile(data);
5934
5937
  this.syncOpenCloudVisualStyle(false);
5935
5938
  this.syncOptions();
5939
+ this.syncOverlay();
5936
5940
  this.resize();
5937
5941
  this.emitEvent({
5938
5942
  type: "geometryprogress",
@@ -5977,6 +5981,7 @@ class Viewer extends EventEmitter2 {
5977
5981
  visViewer.parseVsfx(data);
5978
5982
  this.syncOpenCloudVisualStyle(false);
5979
5983
  this.syncOptions();
5984
+ this.syncOverlay();
5980
5985
  this.resize();
5981
5986
  this.emitEvent({
5982
5987
  type: "geometryprogress",
@@ -6020,11 +6025,13 @@ class Viewer extends EventEmitter2 {
6020
6025
  const visLib = this.visLib();
6021
6026
  const visViewer = visLib.getViewer();
6022
6027
  this.setActiveDragger();
6028
+ this.clearSlices();
6023
6029
  this.clearOverlay();
6024
6030
  visViewer.clear();
6025
6031
  visViewer.createLocalDatabase();
6026
6032
  this.syncOpenCloudVisualStyle(true);
6027
6033
  this.syncOptions();
6034
+ this.syncOverlay();
6028
6035
  this.resize();
6029
6036
  this.emitEvent({
6030
6037
  type: "clear"
@@ -6061,14 +6068,38 @@ class Viewer extends EventEmitter2 {
6061
6068
  return entityId;
6062
6069
  }
6063
6070
  drawViewpoint(viewpoint) {
6071
+ var _a;
6072
+ if (!this.visualizeJs) return;
6073
+ const draggerName = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.name;
6074
+ this.setActiveDragger();
6075
+ this.clearSlices();
6076
+ this.clearOverlay();
6077
+ this.clearSelected();
6078
+ this.showAll();
6079
+ this.explode();
6064
6080
  this.setOrthogonalCameraSettings(viewpoint.orthogonal_camera);
6065
6081
  this.setClippingPlanes(viewpoint.clipping_planes);
6082
+ this.setSelection(viewpoint.selection);
6066
6083
  this._markup.setViewpoint(viewpoint);
6084
+ this.setActiveDragger(draggerName);
6085
+ this.emitEvent({
6086
+ type: "drawviewpoint",
6087
+ data: viewpoint
6088
+ });
6089
+ this.update();
6067
6090
  }
6068
6091
  createViewpoint() {
6069
- const viewpoint = this._markup.getViewpoint();
6092
+ if (!this.visualizeJs) return {};
6093
+ const viewpoint = {};
6070
6094
  viewpoint.orthogonal_camera = this.getOrthogonalCameraSettings();
6071
6095
  viewpoint.clipping_planes = this.getClippingPlanes();
6096
+ viewpoint.selection = this.getSelection();
6097
+ viewpoint.description = (new Date).toDateString();
6098
+ this._markup.getViewpoint(viewpoint);
6099
+ this.emitEvent({
6100
+ type: "createviewpoint",
6101
+ data: viewpoint
6102
+ });
6072
6103
  return viewpoint;
6073
6104
  }
6074
6105
  getPoint3dFromArray(array) {
@@ -6095,13 +6126,10 @@ class Viewer extends EventEmitter2 {
6095
6126
  setOrthogonalCameraSettings(settings) {
6096
6127
  const visViewer = this.visViewer();
6097
6128
  const activeView = visViewer.activeView;
6098
- this.resetActiveDragger();
6099
- this.clearSlices();
6100
- this.clearOverlay();
6101
6129
  if (settings) {
6102
6130
  activeView.setView(this.getLogicalPoint3dAsArray(settings.view_point), this.getLogicalPoint3dAsArray(settings.direction), this.getLogicalPoint3dAsArray(settings.up_vector), settings.field_width, settings.field_height, true);
6131
+ this.syncOverlay();
6103
6132
  }
6104
- this.syncOverlay();
6105
6133
  }
6106
6134
  getClippingPlanes() {
6107
6135
  const visViewer = this.visViewer();
@@ -6109,26 +6137,34 @@ class Viewer extends EventEmitter2 {
6109
6137
  const clipping_planes = [];
6110
6138
  for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
6111
6139
  const cuttingPlane = activeView.getCuttingPlane(i);
6112
- const plane = {
6140
+ const clipping_plane = {
6113
6141
  location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
6114
6142
  direction: this.getPoint3dFromArray(cuttingPlane.normal())
6115
6143
  };
6116
- clipping_planes.push(plane);
6144
+ clipping_planes.push(clipping_plane);
6117
6145
  }
6118
6146
  return clipping_planes;
6119
6147
  }
6120
- setClippingPlanes(clippingPlanes) {
6121
- if (clippingPlanes) {
6148
+ setClippingPlanes(clipping_planes) {
6149
+ if (clipping_planes) {
6122
6150
  const visViewer = this.visViewer();
6123
6151
  const activeView = visViewer.activeView;
6124
- for (const plane of clippingPlanes) {
6152
+ for (const clipping_plane of clipping_planes) {
6125
6153
  const cuttingPlane = new (this.visLib().OdTvPlane);
6126
- cuttingPlane.set(this.getLogicalPoint3dAsArray(plane.location), this.getLogicalPoint3dAsArray(plane.direction));
6154
+ cuttingPlane.set(this.getLogicalPoint3dAsArray(clipping_plane.location), this.getLogicalPoint3dAsArray(clipping_plane.direction));
6127
6155
  activeView.addCuttingPlane(cuttingPlane);
6128
6156
  activeView.setEnableCuttingPlaneFill(true, 102, 102, 102);
6129
6157
  }
6130
6158
  }
6131
6159
  }
6160
+ getSelection() {
6161
+ return this.getSelected().map((handle => ({
6162
+ handle: handle
6163
+ })));
6164
+ }
6165
+ setSelection(selection) {
6166
+ this.setSelected(selection === null || selection === void 0 ? void 0 : selection.map((component => component.handle)));
6167
+ }
6132
6168
  executeCommand(id, ...args) {
6133
6169
  return commands("VisualizeJS").executeCommand(id, this, ...args);
6134
6170
  }