@inweb/viewer-visualize 26.5.0 → 26.5.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.
- package/dist/viewer-visualize.js +18183 -18012
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +335 -297
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Loaders/{UpdaterController.d.ts → UpdateController.d.ts} +1 -1
- package/lib/Viewer/Loaders/VSFBufferLoader.d.ts +8 -0
- package/lib/Viewer/Loaders/VSFModelLoader.d.ts +8 -0
- package/lib/Viewer/Loaders/VSFXBufferLoader.d.ts +8 -0
- package/lib/Viewer/Loaders/VSFXModelLoader.d.ts +8 -0
- package/lib/Viewer/Loaders/VSFXPartialLoader.d.ts +10 -0
- package/lib/Viewer/Loaders/VSFXStreamingLoader.d.ts +8 -0
- package/lib/Viewer/Loaders/index.d.ts +67 -0
- package/lib/Viewer/Viewer.d.ts +7 -59
- package/lib/index.d.ts +3 -2
- package/package.json +5 -5
- package/src/Viewer/Loaders/{BaseLoader.ts → UpdateController.ts} +30 -10
- package/src/Viewer/Loaders/{LoaderFactory.ts → VSFBufferLoader.ts} +28 -19
- package/src/Viewer/Loaders/VSFModelLoader.ts +87 -0
- package/src/Viewer/Loaders/VSFXBufferLoader.ts +58 -0
- package/src/Viewer/Loaders/{VsfXLoader.ts → VSFXModelLoader.ts} +35 -35
- package/src/Viewer/Loaders/{VsfXPartialLoader.ts → VSFXPartialLoader.ts} +55 -45
- package/src/Viewer/Loaders/{VsfXStreamingLoader.ts → VSFXStreamingLoader.ts} +35 -25
- package/src/Viewer/Loaders/index.ts +108 -0
- package/src/Viewer/Viewer.ts +53 -103
- package/src/index.ts +6 -3
- package/lib/Viewer/Loaders/BaseLoader.d.ts +0 -10
- package/lib/Viewer/Loaders/LoaderFactory.d.ts +0 -10
- package/lib/Viewer/Loaders/TCSLoader.d.ts +0 -4
- package/lib/Viewer/Loaders/VsfXLoader.d.ts +0 -4
- package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +0 -4
- package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +0 -4
- package/src/Viewer/Loaders/TCSLoader.ts +0 -83
- package/src/Viewer/Loaders/UpdaterController.ts +0 -37
package/src/index.ts
CHANGED
|
@@ -21,13 +21,16 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
export * from "@inweb/viewer-core";
|
|
25
|
-
export * from "@inweb/markup";
|
|
26
|
-
|
|
27
24
|
export { draggers } from "./Viewer/Draggers";
|
|
28
25
|
export { commands } from "./Viewer/Commands";
|
|
29
26
|
export { components } from "./Viewer/Components";
|
|
27
|
+
export { loaders } from "./Viewer/Loaders";
|
|
30
28
|
export { Viewer } from "./Viewer/Viewer";
|
|
31
29
|
|
|
32
30
|
export { OdBaseDragger } from "./Viewer/Draggers/Common/OdBaseDragger";
|
|
33
31
|
export { MarkupType } from "./Viewer/Markup/MarkupFactory";
|
|
32
|
+
|
|
33
|
+
// the lines below are required for typedoc to include the viewer core and markups documentation
|
|
34
|
+
|
|
35
|
+
export * from "@inweb/viewer-core";
|
|
36
|
+
export * from "@inweb/markup";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Model } from "@inweb/client";
|
|
2
|
-
import { IOptions } from "@inweb/viewer-core";
|
|
3
|
-
import { Viewer } from "../Viewer";
|
|
4
|
-
export declare class BaseLoader {
|
|
5
|
-
protected viewer: Viewer;
|
|
6
|
-
protected model: Model;
|
|
7
|
-
protected options: IOptions;
|
|
8
|
-
constructor(viewer: Viewer, model: Model, options: IOptions);
|
|
9
|
-
load(): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Model } from "@inweb/client";
|
|
2
|
-
import { IOptions } from "@inweb/viewer-core";
|
|
3
|
-
import { TCSLoader } from "./TCSLoader";
|
|
4
|
-
import { VsfXLoader } from "./VsfXLoader";
|
|
5
|
-
import { VsfXStreamingLoader } from "./VsfXStreamingLoader";
|
|
6
|
-
import { VsfXPartialLoader } from "./VsfXPartialLoader";
|
|
7
|
-
import { Viewer } from "../Viewer";
|
|
8
|
-
export declare class LoaderFactory {
|
|
9
|
-
create(viewer: Viewer, model: Model, options: IOptions): TCSLoader | VsfXLoader | VsfXStreamingLoader | VsfXPartialLoader;
|
|
10
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
3
|
-
// All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This software and its documentation and related materials are owned by
|
|
6
|
-
// the Alliance. The software may only be incorporated into application
|
|
7
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
-
// protected by copyright law and international treaty provisions. Application
|
|
12
|
-
// programs incorporating this software must include the following statement
|
|
13
|
-
// with their copyright notices:
|
|
14
|
-
//
|
|
15
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
-
// license agreement with Open Design Alliance.
|
|
17
|
-
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
18
|
-
// All rights reserved.
|
|
19
|
-
//
|
|
20
|
-
// By use of this software, its documentation or related materials, you
|
|
21
|
-
// acknowledge and accept the above terms.
|
|
22
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
-
|
|
24
|
-
import { BaseLoader } from "./BaseLoader";
|
|
25
|
-
|
|
26
|
-
export class TCSLoader extends BaseLoader {
|
|
27
|
-
override async load(): Promise<void> {
|
|
28
|
-
if (!this.viewer.visualizeJs) return;
|
|
29
|
-
|
|
30
|
-
const visLib = this.viewer.visLib();
|
|
31
|
-
const visViewer = visLib.getViewer();
|
|
32
|
-
const abortController = new AbortController();
|
|
33
|
-
|
|
34
|
-
const filesToDownload = [this.model.database, ...this.model.geometry];
|
|
35
|
-
|
|
36
|
-
this.viewer._abortController = abortController;
|
|
37
|
-
|
|
38
|
-
console.time("File load time");
|
|
39
|
-
try {
|
|
40
|
-
this.viewer.emitEvent({ type: "geometrystart", model: this.model });
|
|
41
|
-
|
|
42
|
-
for (let i = 0; i < filesToDownload.length; i++) {
|
|
43
|
-
const dataId = filesToDownload[i];
|
|
44
|
-
|
|
45
|
-
const chunkLoadHandler = (progress: number) => {
|
|
46
|
-
const data = (i + progress) / filesToDownload.length;
|
|
47
|
-
this.viewer.emitEvent({ type: "geometryprogress", data, model: this.model });
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const arrayBuffer = await this.model.downloadResource(dataId, chunkLoadHandler, abortController.signal);
|
|
51
|
-
|
|
52
|
-
if (abortController.signal.aborted) {
|
|
53
|
-
await Promise.reject(new Error(`Open model aborted ${this.model.name}`));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
visViewer.parseStream(new Uint8Array(arrayBuffer));
|
|
57
|
-
this.viewer.update();
|
|
58
|
-
|
|
59
|
-
const data = new Uint8Array(arrayBuffer);
|
|
60
|
-
|
|
61
|
-
if (i === 0) {
|
|
62
|
-
this.viewer.update(true);
|
|
63
|
-
|
|
64
|
-
this.viewer.syncOpenCloudVisualStyle(false);
|
|
65
|
-
this.viewer.syncOptions();
|
|
66
|
-
this.viewer.syncOverlay();
|
|
67
|
-
this.viewer.resize();
|
|
68
|
-
|
|
69
|
-
this.viewer.emitEvent({ type: "databasechunk", data, model: this.model });
|
|
70
|
-
} else {
|
|
71
|
-
this.viewer.emitEvent({ type: "geometrychunk", data, model: this.model });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
console.timeEnd("File load time");
|
|
76
|
-
|
|
77
|
-
this.viewer.emitEvent({ type: "geometryend", model: this.model });
|
|
78
|
-
} catch (error) {
|
|
79
|
-
this.viewer.emitEvent({ type: "geometryerror", data: error, model: this.model });
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Viewer } from "../Viewer";
|
|
2
|
-
|
|
3
|
-
const DELAY_TIME_MULTIPLEXER = 2.0;
|
|
4
|
-
const START_UPDATE_TIME = 1000;
|
|
5
|
-
|
|
6
|
-
export enum UpdateType {
|
|
7
|
-
kDelay,
|
|
8
|
-
kNormal,
|
|
9
|
-
kForce,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class UpdaterController {
|
|
13
|
-
private lastUpdate: number;
|
|
14
|
-
private viewer: Viewer;
|
|
15
|
-
public delayUpdateTime: number;
|
|
16
|
-
|
|
17
|
-
constructor() {
|
|
18
|
-
this.lastUpdate = 0;
|
|
19
|
-
this.delayUpdateTime = START_UPDATE_TIME;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
initialize(viewer: Viewer) {
|
|
23
|
-
this.viewer = viewer;
|
|
24
|
-
this.lastUpdate = performance.now();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
update(type: UpdateType) {
|
|
28
|
-
const isNeedUpdate = type !== UpdateType.kDelay || performance.now() - this.lastUpdate >= this.delayUpdateTime;
|
|
29
|
-
const isForce = type === UpdateType.kForce;
|
|
30
|
-
|
|
31
|
-
if (isNeedUpdate) {
|
|
32
|
-
this.viewer.update(isForce);
|
|
33
|
-
this.lastUpdate = performance.now();
|
|
34
|
-
this.delayUpdateTime *= DELAY_TIME_MULTIPLEXER;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|