@inweb/viewer-visualize 26.6.1 → 26.6.3

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.
@@ -3853,7 +3853,54 @@
3853
3853
  // By use of this software, its documentation or related materials, you
3854
3854
  // acknowledge and accept the above terms.
3855
3855
  ///////////////////////////////////////////////////////////////////////////////
3856
- class VSFModelLoader extends Loader {
3856
+ class VSFBufferLoader extends Loader {
3857
+ constructor(viewer) {
3858
+ super();
3859
+ this.viewer = viewer;
3860
+ }
3861
+ isSupport(file, format) {
3862
+ return file instanceof ArrayBuffer && /vsf$/i.test(format);
3863
+ }
3864
+ load(buffer, format) {
3865
+ if (!this.viewer.visualizeJs)
3866
+ return Promise.resolve(this);
3867
+ const visLib = this.viewer.visLib();
3868
+ const visViewer = visLib.getViewer();
3869
+ const data = new Uint8Array(buffer);
3870
+ visViewer.parseFile(data);
3871
+ this.viewer.syncOpenCloudVisualStyle(false);
3872
+ this.viewer.syncOptions();
3873
+ this.viewer.syncOverlay();
3874
+ this.viewer.resize();
3875
+ this.viewer.emitEvent({ type: "geometryprogress", data: 1, file: buffer });
3876
+ this.viewer.emitEvent({ type: "databasechunk", data, file: buffer });
3877
+ return Promise.resolve(this);
3878
+ }
3879
+ }
3880
+
3881
+ ///////////////////////////////////////////////////////////////////////////////
3882
+ // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
3883
+ // All rights reserved.
3884
+ //
3885
+ // This software and its documentation and related materials are owned by
3886
+ // the Alliance. The software may only be incorporated into application
3887
+ // programs owned by members of the Alliance, subject to a signed
3888
+ // Membership Agreement and Supplemental Software License Agreement with the
3889
+ // Alliance. The structure and organization of this software are the valuable
3890
+ // trade secrets of the Alliance and its suppliers. The software is also
3891
+ // protected by copyright law and international treaty provisions. Application
3892
+ // programs incorporating this software must include the following statement
3893
+ // with their copyright notices:
3894
+ //
3895
+ // This application incorporates Open Design Alliance software pursuant to a
3896
+ // license agreement with Open Design Alliance.
3897
+ // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
3898
+ // All rights reserved.
3899
+ //
3900
+ // By use of this software, its documentation or related materials, you
3901
+ // acknowledge and accept the above terms.
3902
+ ///////////////////////////////////////////////////////////////////////////////
3903
+ class VSFCloudModelLoader extends Loader {
3857
3904
  constructor(viewer) {
3858
3905
  super();
3859
3906
  this.viewer = viewer;
@@ -3922,13 +3969,13 @@
3922
3969
  // By use of this software, its documentation or related materials, you
3923
3970
  // acknowledge and accept the above terms.
3924
3971
  ///////////////////////////////////////////////////////////////////////////////
3925
- class VSFBufferLoader extends Loader {
3972
+ class VSFXBufferLoader extends Loader {
3926
3973
  constructor(viewer) {
3927
3974
  super();
3928
3975
  this.viewer = viewer;
3929
3976
  }
3930
3977
  isSupport(file, format) {
3931
- return file instanceof ArrayBuffer && /vsf$/i.test(format);
3978
+ return file instanceof ArrayBuffer && /vsfx$/i.test(format);
3932
3979
  }
3933
3980
  load(buffer, format) {
3934
3981
  if (!this.viewer.visualizeJs)
@@ -3936,7 +3983,7 @@
3936
3983
  const visLib = this.viewer.visLib();
3937
3984
  const visViewer = visLib.getViewer();
3938
3985
  const data = new Uint8Array(buffer);
3939
- visViewer.parseFile(data);
3986
+ visViewer.parseVsfx(data);
3940
3987
  this.viewer.syncOpenCloudVisualStyle(false);
3941
3988
  this.viewer.syncOptions();
3942
3989
  this.viewer.syncOverlay();
@@ -3969,7 +4016,7 @@
3969
4016
  // By use of this software, its documentation or related materials, you
3970
4017
  // acknowledge and accept the above terms.
3971
4018
  ///////////////////////////////////////////////////////////////////////////////
3972
- class VSFXModelLoader extends Loader {
4019
+ class VSFXCloudModelLoader extends Loader {
3973
4020
  constructor(viewer) {
3974
4021
  super();
3975
4022
  this.viewer = viewer;
@@ -4077,13 +4124,14 @@
4077
4124
  // By use of this software, its documentation or related materials, you
4078
4125
  // acknowledge and accept the above terms.
4079
4126
  ///////////////////////////////////////////////////////////////////////////////
4080
- class VSFXStreamingLoader extends Loader {
4127
+ class VSFXCloudStreamingLoader extends Loader {
4081
4128
  constructor(viewer) {
4082
4129
  super();
4083
4130
  this.viewer = viewer;
4084
4131
  }
4085
4132
  isSupport(file) {
4086
4133
  return (typeof file === "object" &&
4134
+ typeof file.database === "string" &&
4087
4135
  typeof file.downloadResource === "function" &&
4088
4136
  /.vsfx$/i.test(file.database) &&
4089
4137
  this.viewer.options.enableStreamingMode === true &&
@@ -4154,7 +4202,7 @@
4154
4202
  ///////////////////////////////////////////////////////////////////////////////
4155
4203
  const PENDING_REQUESTS_SIZE = 50;
4156
4204
  const PENDING_REQUESTS_TIMEOUT = 250;
4157
- class VSFXPartialLoader extends Loader {
4205
+ class VSFXCloudPartialLoader extends Loader {
4158
4206
  constructor(viewer) {
4159
4207
  super();
4160
4208
  this.viewer = viewer;
@@ -4162,6 +4210,7 @@
4162
4210
  }
4163
4211
  isSupport(file) {
4164
4212
  return (typeof file === "object" &&
4213
+ typeof file.database === "string" &&
4165
4214
  typeof file.downloadResource === "function" &&
4166
4215
  /.vsfx$/i.test(file.database) &&
4167
4216
  (this.viewer.options.enablePartialMode === true || /.rcs$/i.test(file.name)));
@@ -4310,53 +4359,6 @@
4310
4359
  }
4311
4360
  }
4312
4361
 
4313
- ///////////////////////////////////////////////////////////////////////////////
4314
- // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
4315
- // All rights reserved.
4316
- //
4317
- // This software and its documentation and related materials are owned by
4318
- // the Alliance. The software may only be incorporated into application
4319
- // programs owned by members of the Alliance, subject to a signed
4320
- // Membership Agreement and Supplemental Software License Agreement with the
4321
- // Alliance. The structure and organization of this software are the valuable
4322
- // trade secrets of the Alliance and its suppliers. The software is also
4323
- // protected by copyright law and international treaty provisions. Application
4324
- // programs incorporating this software must include the following statement
4325
- // with their copyright notices:
4326
- //
4327
- // This application incorporates Open Design Alliance software pursuant to a
4328
- // license agreement with Open Design Alliance.
4329
- // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
4330
- // All rights reserved.
4331
- //
4332
- // By use of this software, its documentation or related materials, you
4333
- // acknowledge and accept the above terms.
4334
- ///////////////////////////////////////////////////////////////////////////////
4335
- class VSFXBufferLoader extends Loader {
4336
- constructor(viewer) {
4337
- super();
4338
- this.viewer = viewer;
4339
- }
4340
- isSupport(file, format) {
4341
- return file instanceof ArrayBuffer && /vsfx$/i.test(format);
4342
- }
4343
- load(buffer, format) {
4344
- if (!this.viewer.visualizeJs)
4345
- return Promise.resolve(this);
4346
- const visLib = this.viewer.visLib();
4347
- const visViewer = visLib.getViewer();
4348
- const data = new Uint8Array(buffer);
4349
- visViewer.parseVsfx(data);
4350
- this.viewer.syncOpenCloudVisualStyle(false);
4351
- this.viewer.syncOptions();
4352
- this.viewer.syncOverlay();
4353
- this.viewer.resize();
4354
- this.viewer.emitEvent({ type: "geometryprogress", data: 1, file: buffer });
4355
- this.viewer.emitEvent({ type: "databasechunk", data, file: buffer });
4356
- return Promise.resolve(this);
4357
- }
4358
- }
4359
-
4360
4362
  ///////////////////////////////////////////////////////////////////////////////
4361
4363
  // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
4362
4364
  // All rights reserved.
@@ -4446,12 +4448,12 @@
4446
4448
  */
4447
4449
  const loaders = loadersRegistry("visualizejs");
4448
4450
  // build-in loaders
4449
- loaders.registerLoader("vsf", (viewer) => new VSFModelLoader(viewer));
4450
4451
  loaders.registerLoader("vsf-buffer", (viewer) => new VSFBufferLoader(viewer));
4451
- loaders.registerLoader("vsfx", (viewer) => new VSFXModelLoader(viewer));
4452
- loaders.registerLoader("vsfx-streaming", (viewer) => new VSFXStreamingLoader(viewer));
4453
- loaders.registerLoader("vsfx-partial", (viewer) => new VSFXPartialLoader(viewer));
4452
+ loaders.registerLoader("vsf-cloud-model", (viewer) => new VSFCloudModelLoader(viewer));
4454
4453
  loaders.registerLoader("vsfx-buffer", (viewer) => new VSFXBufferLoader(viewer));
4454
+ loaders.registerLoader("vsfx-cloud-model", (viewer) => new VSFXCloudModelLoader(viewer));
4455
+ loaders.registerLoader("vsfx-cloud-streaming", (viewer) => new VSFXCloudStreamingLoader(viewer));
4456
+ loaders.registerLoader("vsfx-cloud-partial", (viewer) => new VSFXCloudPartialLoader(viewer));
4455
4457
 
4456
4458
  class EventEmitter2 {
4457
4459
  constructor() {
@@ -16512,7 +16514,7 @@
16512
16514
  let wcsPoints = this._ref.getAttr("wcsPoints");
16513
16515
  if (!wcsPoints) {
16514
16516
  wcsPoints = [];
16515
- let points = this._ref.points();
16517
+ const points = this._ref.points();
16516
16518
  let wcsPoint;
16517
16519
  for (let i = 0; i < points.length; i += 2) {
16518
16520
  wcsPoint = this._worldTransformer.screenToWorld({
@@ -16541,7 +16543,7 @@
16541
16543
  const wcsPoints = [];
16542
16544
  params.points.forEach((point => {
16543
16545
  konvaPoints.push(point.x, point.y);
16544
- let wcsPoint = this._worldTransformer.screenToWorld({
16546
+ const wcsPoint = this._worldTransformer.screenToWorld({
16545
16547
  x: point.x,
16546
16548
  y: point.y
16547
16549
  });
@@ -16569,8 +16571,8 @@
16569
16571
  }));
16570
16572
  this._ref.on("transformend", (e => {
16571
16573
  const absoluteTransform = this._ref.getAbsoluteTransform();
16572
- let wcsPoints = [];
16573
- let points = this._ref.points();
16574
+ const wcsPoints = [];
16575
+ const points = this._ref.points();
16574
16576
  let wcsPoint;
16575
16577
  for (let i = 0; i < points.length; i += 2) {
16576
16578
  const position = absoluteTransform.point({
@@ -16591,8 +16593,8 @@
16591
16593
  }));
16592
16594
  this._ref.on("dragend", (e => {
16593
16595
  const absoluteTransform = this._ref.getAbsoluteTransform();
16594
- let wcsPoints = [];
16595
- let points = this._ref.points();
16596
+ const wcsPoints = [];
16597
+ const points = this._ref.points();
16596
16598
  let wcsPoint;
16597
16599
  for (let i = 0; i < points.length; i += 2) {
16598
16600
  const position = absoluteTransform.point({
@@ -16680,17 +16682,17 @@
16680
16682
  }
16681
16683
  addPoints(points) {
16682
16684
  let newPoints = this._ref.points();
16683
- let wcsPoints = this._ref.getAttr("wcsPoints");
16685
+ const wcsPoints = this._ref.getAttr("wcsPoints");
16684
16686
  points.forEach((point => {
16685
16687
  newPoints = newPoints.concat([ point.x, point.y ]);
16686
- let wcsPoint = this._worldTransformer.screenToWorld(point);
16688
+ const wcsPoint = this._worldTransformer.screenToWorld(point);
16687
16689
  wcsPoints.push(wcsPoint);
16688
16690
  }));
16689
16691
  this._ref.points(newPoints);
16690
16692
  }
16691
16693
  updateScreenCoordinates() {
16692
- let wcsPoints = this._ref.getAttr("wcsPoints");
16693
- let points = [];
16694
+ const wcsPoints = this._ref.getAttr("wcsPoints");
16695
+ const points = [];
16694
16696
  let invert = this._ref.getAbsoluteTransform().copy();
16695
16697
  invert = invert.invert();
16696
16698
  wcsPoints.forEach((point => {
@@ -16849,7 +16851,7 @@
16849
16851
  this._ref.fontSize(size);
16850
16852
  }
16851
16853
  updateScreenCoordinates() {
16852
- let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
16854
+ const screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
16853
16855
  let invert = this._ref.getStage().getAbsoluteTransform().copy();
16854
16856
  invert = invert.invert();
16855
16857
  const positionStart = invert.point(screenPositionStart);
@@ -17065,8 +17067,8 @@
17065
17067
  return this._ref.strokeWidth();
17066
17068
  }
17067
17069
  updateScreenCoordinates() {
17068
- let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
17069
- let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
17070
+ const screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
17071
+ const screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
17070
17072
  let invert = this._ref.getStage().getAbsoluteTransform().copy();
17071
17073
  invert = invert.invert();
17072
17074
  const positionStart = invert.point(screenPositionStart);
@@ -17304,9 +17306,9 @@
17304
17306
  this._ref = null;
17305
17307
  }
17306
17308
  updateScreenCoordinates() {
17307
- let screenPosition = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsPosition"));
17308
- let radiusX = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusX"));
17309
- let radiusY = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusY"));
17309
+ const screenPosition = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsPosition"));
17310
+ const radiusX = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusX"));
17311
+ const radiusY = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsRadiusY"));
17310
17312
  let invert = this._ref.getStage().getAbsoluteTransform().copy();
17311
17313
  invert = invert.invert();
17312
17314
  const position = invert.point({
@@ -17491,8 +17493,8 @@
17491
17493
  }));
17492
17494
  }
17493
17495
  updateScreenCoordinates() {
17494
- let screenStartPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
17495
- let screenEndPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
17496
+ const screenStartPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
17497
+ const screenEndPoint = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
17496
17498
  let invert = this._ref.getAbsoluteTransform().copy();
17497
17499
  invert = invert.invert();
17498
17500
  const startPoint = invert.point({
@@ -17730,8 +17732,8 @@
17730
17732
  this._ref.setAttr("wcsEnd", wcsRightLowerPoint);
17731
17733
  }
17732
17734
  updateScreenCoordinates() {
17733
- let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
17734
- let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
17735
+ const screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
17736
+ const screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
17735
17737
  let invert = this._ref.getStage().getAbsoluteTransform().copy();
17736
17738
  invert = invert.invert();
17737
17739
  const positionStart = invert.point(screenPositionStart);
@@ -18029,8 +18031,8 @@
18029
18031
  this._ref.strokeWidth(size);
18030
18032
  }
18031
18033
  updateScreenCoordinates() {
18032
- let screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
18033
- let screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
18034
+ const screenPositionStart = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsStart"));
18035
+ const screenPositionEnd = this._worldTransformer.worldToScreen(this._ref.getAttr("wcsEnd"));
18034
18036
  let invert = this._ref.getStage().getAbsoluteTransform().copy();
18035
18037
  invert = invert.invert();
18036
18038
  const positionStart = invert.point(screenPositionStart);
@@ -19449,11 +19451,12 @@
19449
19451
  }
19450
19452
  dispose() {
19451
19453
  this.cancel();
19454
+ this.clear();
19452
19455
  this.emitEvent({ type: "dispose" });
19456
+ this.removeAllListeners();
19457
+ this.setActiveDragger();
19453
19458
  this._components.forEach((component) => component.dispose());
19454
19459
  this._components = [];
19455
- this.setActiveDragger();
19456
- this.removeAllListeners();
19457
19460
  this._markup.dispose();
19458
19461
  if (this.canvas) {
19459
19462
  this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));