bimatter-viewer-react 0.4.1 → 0.5.0
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/README.md +65 -34
- package/lib/Loaders/BmtLoader.d.ts +20 -2
- package/lib/Loaders/IFCLoader/IFCLoader.d.ts +34 -5
- package/lib/api/loader.d.ts +16 -0
- package/lib/assets/BMTWorker-yhSXOg2i.js +1 -0
- package/lib/assets/IFCWorker-B_lqybSb.js +6 -0
- package/lib/index.d.ts +5 -3
- package/lib/index.js +816 -436
- package/lib/workers/BMTWorker.d.ts +53 -0
- package/lib/workers/BMTWorkerClient.d.ts +14 -0
- package/lib/workers/IFCWorker.d.ts +62 -0
- package/lib/workers/IFCWorkerClient.d.ts +14 -0
- package/lib/workers/ProgressUtils.d.ts +27 -0
- package/lib/workers/index.d.ts +7 -0
- package/package.json +4 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type BmtGeomData, type BmtModelData } from "../Loaders/BmtLoader";
|
|
2
|
+
import { type WorkerProgressEvent } from "./ProgressUtils";
|
|
3
|
+
export type BmtWorkerSource = {
|
|
4
|
+
buffer: ArrayBuffer;
|
|
5
|
+
kind: "buffer";
|
|
6
|
+
name?: string;
|
|
7
|
+
} | {
|
|
8
|
+
file: File;
|
|
9
|
+
kind: "file";
|
|
10
|
+
name?: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: "url";
|
|
13
|
+
name?: string;
|
|
14
|
+
url: string;
|
|
15
|
+
};
|
|
16
|
+
export type BmtWorkerLoadOptions = {
|
|
17
|
+
streamGeometryChunks?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type BmtWorkerLoadRequest = {
|
|
20
|
+
options?: BmtWorkerLoadOptions;
|
|
21
|
+
sources: BmtWorkerSource[];
|
|
22
|
+
taskId: string;
|
|
23
|
+
type: "load-bmt-model";
|
|
24
|
+
};
|
|
25
|
+
export type BmtWorkerError = {
|
|
26
|
+
message: string;
|
|
27
|
+
stack?: string;
|
|
28
|
+
};
|
|
29
|
+
export type BmtWorkerGeometryChunk = {
|
|
30
|
+
chunkIndex: number;
|
|
31
|
+
geometry: BmtGeomData;
|
|
32
|
+
geometryID: number;
|
|
33
|
+
isIfcSpace: boolean;
|
|
34
|
+
modelIndex: number;
|
|
35
|
+
modelName?: string;
|
|
36
|
+
};
|
|
37
|
+
export type BmtWorkerResponse = {
|
|
38
|
+
error: BmtWorkerError;
|
|
39
|
+
taskId: string;
|
|
40
|
+
type: "error";
|
|
41
|
+
} | {
|
|
42
|
+
chunk: BmtWorkerGeometryChunk;
|
|
43
|
+
taskId: string;
|
|
44
|
+
type: "chunk";
|
|
45
|
+
} | {
|
|
46
|
+
models: Record<number, BmtModelData>;
|
|
47
|
+
taskId: string;
|
|
48
|
+
type: "complete";
|
|
49
|
+
} | {
|
|
50
|
+
progress: WorkerProgressEvent;
|
|
51
|
+
taskId: string;
|
|
52
|
+
type: "progress";
|
|
53
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BmtModelData } from "../Loaders/BmtLoader";
|
|
2
|
+
import type { BmtWorkerGeometryChunk, BmtWorkerLoadOptions } from "./BMTWorker";
|
|
3
|
+
import type { WorkerProgressEvent } from "./ProgressUtils";
|
|
4
|
+
export type BmtWorkerModelSource = ArrayBuffer | File | string;
|
|
5
|
+
export type BmtWorkerClientOptions = BmtWorkerLoadOptions & {
|
|
6
|
+
collectChunks?: boolean;
|
|
7
|
+
onChunk?: (chunk: BmtWorkerGeometryChunk) => void;
|
|
8
|
+
onProgress?: (progress: WorkerProgressEvent) => void;
|
|
9
|
+
terminateOnComplete?: boolean;
|
|
10
|
+
worker?: Worker;
|
|
11
|
+
};
|
|
12
|
+
export type BmtWorkerLoadedModels = Record<number, BmtModelData>;
|
|
13
|
+
export declare function loadBmtModelsInWorker(sources: BmtWorkerModelSource | BmtWorkerModelSource[], options?: BmtWorkerClientOptions): Promise<BmtWorkerLoadedModels>;
|
|
14
|
+
export declare function createBmtWorker(): Worker;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { BmtGeomData, BmtModelData } from "../Loaders/BmtLoader";
|
|
2
|
+
import { type IfcCoordinationMatrixSource } from "../Loaders/IFCLoader/IFCLoader";
|
|
3
|
+
import { type WorkerProgressEvent } from "./ProgressUtils";
|
|
4
|
+
export type IfcWorkerSource = {
|
|
5
|
+
kind: "buffer";
|
|
6
|
+
buffer: ArrayBuffer;
|
|
7
|
+
name?: string;
|
|
8
|
+
} | {
|
|
9
|
+
file: File;
|
|
10
|
+
kind: "file";
|
|
11
|
+
name?: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "url";
|
|
14
|
+
name?: string;
|
|
15
|
+
url: string;
|
|
16
|
+
};
|
|
17
|
+
export type IfcWorkerLoadOptions = {
|
|
18
|
+
chunk?: number;
|
|
19
|
+
coordinationMatrix?: IfcCoordinationMatrixSource;
|
|
20
|
+
maxMeshBytes?: number;
|
|
21
|
+
streamGeometryChunks?: boolean;
|
|
22
|
+
useIfcColors?: boolean;
|
|
23
|
+
useIfcElementAssembly?: boolean;
|
|
24
|
+
useIfcSpace?: boolean;
|
|
25
|
+
wasmPath?: string;
|
|
26
|
+
};
|
|
27
|
+
export type IfcWorkerLoadRequest = {
|
|
28
|
+
options?: IfcWorkerLoadOptions;
|
|
29
|
+
sources: IfcWorkerSource[];
|
|
30
|
+
taskId: string;
|
|
31
|
+
type: "load-ifc-model";
|
|
32
|
+
};
|
|
33
|
+
export type IfcWorkerError = {
|
|
34
|
+
message: string;
|
|
35
|
+
stack?: string;
|
|
36
|
+
};
|
|
37
|
+
export type IfcWorkerGeometryChunk = {
|
|
38
|
+
chunkIndex: number;
|
|
39
|
+
geometry: BmtGeomData;
|
|
40
|
+
geometryID: number;
|
|
41
|
+
isIfcSpace: boolean;
|
|
42
|
+
modelIndex: number;
|
|
43
|
+
modelName?: string;
|
|
44
|
+
totalChunks: number;
|
|
45
|
+
};
|
|
46
|
+
export type IfcWorkerResponse = {
|
|
47
|
+
error: IfcWorkerError;
|
|
48
|
+
taskId: string;
|
|
49
|
+
type: "error";
|
|
50
|
+
} | {
|
|
51
|
+
models: Record<number, BmtModelData>;
|
|
52
|
+
taskId: string;
|
|
53
|
+
type: "complete";
|
|
54
|
+
} | {
|
|
55
|
+
chunk: IfcWorkerGeometryChunk;
|
|
56
|
+
taskId: string;
|
|
57
|
+
type: "chunk";
|
|
58
|
+
} | {
|
|
59
|
+
progress: WorkerProgressEvent;
|
|
60
|
+
taskId: string;
|
|
61
|
+
type: "progress";
|
|
62
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BmtModelData } from "../Loaders/BmtLoader";
|
|
2
|
+
import type { IfcWorkerGeometryChunk, IfcWorkerLoadOptions } from "./IFCWorker";
|
|
3
|
+
import type { WorkerProgressEvent } from "./ProgressUtils";
|
|
4
|
+
export type IfcWorkerModelSource = ArrayBuffer | File | string;
|
|
5
|
+
export type IfcWorkerClientOptions = IfcWorkerLoadOptions & {
|
|
6
|
+
collectChunks?: boolean;
|
|
7
|
+
onChunk?: (chunk: IfcWorkerGeometryChunk) => void;
|
|
8
|
+
onProgress?: (progress: WorkerProgressEvent) => void;
|
|
9
|
+
terminateOnComplete?: boolean;
|
|
10
|
+
worker?: Worker;
|
|
11
|
+
};
|
|
12
|
+
export type IfcWorkerLoadedModels = Record<number, BmtModelData>;
|
|
13
|
+
export declare function loadIfcModelsInWorker(sources: IfcWorkerModelSource | IfcWorkerModelSource[], options?: IfcWorkerClientOptions): Promise<IfcWorkerLoadedModels>;
|
|
14
|
+
export declare function createIfcWorker(): Worker;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type WorkerProgressPhase = "queued" | "reading" | "fetching" | "initializing" | "opening" | "parsing" | "properties" | "complete" | "error";
|
|
2
|
+
export type WorkerProgressEvent = {
|
|
3
|
+
loaded?: number;
|
|
4
|
+
message?: string;
|
|
5
|
+
modelIndex: number;
|
|
6
|
+
modelName?: string;
|
|
7
|
+
phase: WorkerProgressPhase;
|
|
8
|
+
progress: number;
|
|
9
|
+
taskId: string;
|
|
10
|
+
total?: number;
|
|
11
|
+
totalModels: number;
|
|
12
|
+
};
|
|
13
|
+
export type WorkerProgressEmitter = (event: WorkerProgressEvent) => void;
|
|
14
|
+
export type WorkerProgressOptions = {
|
|
15
|
+
emit: WorkerProgressEmitter;
|
|
16
|
+
taskId: string;
|
|
17
|
+
totalModels: number;
|
|
18
|
+
};
|
|
19
|
+
export declare class WorkerProgressUtils {
|
|
20
|
+
private readonly emit;
|
|
21
|
+
private readonly taskId;
|
|
22
|
+
private readonly totalModels;
|
|
23
|
+
constructor(options: WorkerProgressOptions);
|
|
24
|
+
emitModelProgress(modelIndex: number, modelName: string | undefined, phase: WorkerProgressPhase, modelProgress: number, data?: Pick<WorkerProgressEvent, "loaded" | "message" | "total">): void;
|
|
25
|
+
emitError(message: string): void;
|
|
26
|
+
private clampProgress;
|
|
27
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createBmtWorker, loadBmtModelsInWorker } from "./BMTWorkerClient";
|
|
2
|
+
export type { BmtWorkerClientOptions, BmtWorkerLoadedModels, BmtWorkerModelSource, } from "./BMTWorkerClient";
|
|
3
|
+
export type { BmtWorkerError, BmtWorkerGeometryChunk, BmtWorkerLoadOptions, BmtWorkerLoadRequest, BmtWorkerResponse, BmtWorkerSource, } from "./BMTWorker";
|
|
4
|
+
export { createIfcWorker, loadIfcModelsInWorker } from "./IFCWorkerClient";
|
|
5
|
+
export type { IfcWorkerClientOptions, IfcWorkerLoadedModels, IfcWorkerModelSource, } from "./IFCWorkerClient";
|
|
6
|
+
export type { IfcWorkerError, IfcWorkerGeometryChunk, IfcWorkerLoadOptions, IfcWorkerLoadRequest, IfcWorkerResponse, IfcWorkerSource, } from "./IFCWorker";
|
|
7
|
+
export type { WorkerProgressEvent, WorkerProgressPhase, } from "./ProgressUtils";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bimatter-viewer-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -42,6 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@eslint/js": "^10.0.1",
|
|
45
|
+
"@loaders.gl/core": "^4.4.2",
|
|
46
|
+
"@loaders.gl/las": "^4.4.2",
|
|
47
|
+
"@math.gl/types": "^4.1.0",
|
|
45
48
|
"@react-three/drei": "^10.7.7",
|
|
46
49
|
"@react-three/fiber": "^9.6.1",
|
|
47
50
|
"@types/node": "^24.12.2",
|