bimatter-viewer-react 0.11.0 → 0.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.
- package/lib/{IFCLoader-D_jyTADr.js → IFCLoader-N1C1bJ4O.js} +71 -60
- package/lib/Loaders/BmtConverter.d.ts +1 -1
- package/lib/Loaders/BmtExternalMetadataWriter.d.ts +17 -0
- package/lib/Loaders/BmtLoader.d.ts +3 -0
- package/lib/Loaders/IFCLoader/IFCLoader.d.ts +6 -3
- package/lib/Loaders/IFCLoader/PropertySerializer.d.ts +8 -3
- package/lib/Viewer.d.ts +1 -2
- package/lib/ViewerComponents/ApiHolders.d.ts +17 -0
- package/lib/ViewerComponents/Layout.d.ts +35 -0
- package/lib/ViewerComponents/Postproduction.d.ts +6 -0
- package/lib/ViewerComponents/SharedPlanScene.d.ts +41 -0
- package/lib/ViewerComponents/ViewerScene.d.ts +37 -0
- package/lib/ViewerComponents/WebGpuRendererUtils.d.ts +35 -0
- package/lib/assets/{BMTWorker-Beh6PzGw.js → BMTWorker-4FHDYd-p.js} +1 -1
- package/lib/assets/{BmtConverterWorker-Cq5tBdLt.js → BmtConverterWorker-C90sCwAT.js} +6 -5
- package/lib/assets/{IFCWorker-qQ8Zt4MA.js → IFCWorker-pZu61wpO.js} +1 -1
- package/lib/index.js +11558 -11451
- package/lib/workers/BMTWorker.d.ts +1 -0
- package/lib/workers/IFCWorker.d.ts +1 -0
- package/package.json +1 -1
|
@@ -191330,39 +191330,39 @@ var y_ = class {
|
|
|
191330
191330
|
constructor(e) {
|
|
191331
191331
|
this.parser = e;
|
|
191332
191332
|
}
|
|
191333
|
-
async serializeAllProperties(e, t, n) {
|
|
191334
|
-
return this.clearPropertyCaches(), await this.getPropertiesAsBlobs(e, t, n);
|
|
191333
|
+
async serializeAllProperties(e, t, n, r) {
|
|
191334
|
+
return this.clearPropertyCaches(), await this.getPropertiesAsBlobs(e, t, n, r);
|
|
191335
191335
|
}
|
|
191336
191336
|
resetCaches() {
|
|
191337
191337
|
this.clearPropertyCaches(), this.spatialLinesCache.clear(), this.spatialTreeChunksCache.clear();
|
|
191338
191338
|
}
|
|
191339
|
-
async getPropertiesAsBlobs(e, t, n) {
|
|
191340
|
-
let
|
|
191341
|
-
if (
|
|
191342
|
-
let
|
|
191343
|
-
for (let e of
|
|
191339
|
+
async getPropertiesAsBlobs(e, t, n, r) {
|
|
191340
|
+
let i = await this.getAllRelDefinesByProps(e), a = i.size, o = t.size, s = {}, c = this.parser.GetLineIDsWithType(e, Sd).get(0);
|
|
191341
|
+
if (c === void 0) return s;
|
|
191342
|
+
let l = await this.getItemPropertiesBatch(e, i), u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
|
|
191343
|
+
for (let e of l.values()) {
|
|
191344
191344
|
if (!e) continue;
|
|
191345
191345
|
let t = __(e.RelatingPropertyDefinition);
|
|
191346
|
-
t !== null &&
|
|
191347
|
-
for (let t of v_(e.RelatedObjects))
|
|
191348
|
-
}
|
|
191349
|
-
let
|
|
191350
|
-
for (let e of
|
|
191351
|
-
for (let t of v_(e.HasProperties))
|
|
191352
|
-
for (let t of v_(e.Quantities))
|
|
191353
|
-
}
|
|
191354
|
-
await this.getItemPropertiesBatch(e,
|
|
191355
|
-
let
|
|
191356
|
-
for (let e of
|
|
191357
|
-
|
|
191358
|
-
let
|
|
191359
|
-
id:
|
|
191346
|
+
t !== null && u.add(t);
|
|
191347
|
+
for (let t of v_(e.RelatedObjects)) d.add(t);
|
|
191348
|
+
}
|
|
191349
|
+
let f = await this.getItemPropertiesBatch(e, u), p = /* @__PURE__ */ new Set();
|
|
191350
|
+
for (let e of f.values()) if (e) {
|
|
191351
|
+
for (let t of v_(e.HasProperties)) p.add(t);
|
|
191352
|
+
for (let t of v_(e.Quantities)) p.add(t);
|
|
191353
|
+
}
|
|
191354
|
+
await this.getItemPropertiesBatch(e, p);
|
|
191355
|
+
let m = new Set(t);
|
|
191356
|
+
for (let e of d) m.add(e);
|
|
191357
|
+
m.add(c), await this.getItemPropertiesBatch(e, m);
|
|
191358
|
+
let ee = await this.getItemProperty(e, c) ?? {
|
|
191359
|
+
id: c,
|
|
191360
191360
|
props: {},
|
|
191361
191361
|
sets: []
|
|
191362
191362
|
};
|
|
191363
|
-
|
|
191364
|
-
let
|
|
191365
|
-
for (let t of
|
|
191363
|
+
ee.sets = [], s[c] = ee;
|
|
191364
|
+
let te = 0;
|
|
191365
|
+
for (let t of i) {
|
|
191366
191366
|
let r = await this.getItemProperty(e, t);
|
|
191367
191367
|
if (r) {
|
|
191368
191368
|
let t = __(r.RelatingPropertyDefinition);
|
|
@@ -191382,24 +191382,24 @@ var y_ = class {
|
|
|
191382
191382
|
isQuantities: !!n.Quantities
|
|
191383
191383
|
});
|
|
191384
191384
|
let a = v_(r.RelatedObjects);
|
|
191385
|
-
for (let t of a) if (
|
|
191385
|
+
for (let t of a) if (s[t]) s[t].sets ??= [], s[t].sets.push(i);
|
|
191386
191386
|
else {
|
|
191387
191387
|
let n = await this.getItemProperty(e, t);
|
|
191388
191388
|
if (n) {
|
|
191389
|
-
let e = this.getStringValue(n.GlobalId), r = n.Name, a = n.ObjectType,
|
|
191389
|
+
let e = this.getStringValue(n.GlobalId), r = n.Name, a = n.ObjectType, o = n.LongName, c = this.getStringValue(n.type), l = {
|
|
191390
191390
|
name: r,
|
|
191391
191391
|
typeName: a,
|
|
191392
|
-
longName:
|
|
191392
|
+
longName: o,
|
|
191393
191393
|
type: c,
|
|
191394
191394
|
elevation: void 0
|
|
191395
191395
|
};
|
|
191396
|
-
|
|
191396
|
+
s[t] = {
|
|
191397
191397
|
id: t,
|
|
191398
191398
|
guid: e,
|
|
191399
191399
|
props: l,
|
|
191400
191400
|
sets: [i]
|
|
191401
191401
|
}, c === "IfcBuildingStorey" && (l.elevation = n.Elevation);
|
|
191402
|
-
} else
|
|
191402
|
+
} else s[t] = {
|
|
191403
191403
|
id: t,
|
|
191404
191404
|
guid: "null",
|
|
191405
191405
|
props: {
|
|
@@ -191413,24 +191413,35 @@ var y_ = class {
|
|
|
191413
191413
|
};
|
|
191414
191414
|
}
|
|
191415
191415
|
}
|
|
191416
|
-
|
|
191417
|
-
loaded:
|
|
191416
|
+
te += 1, this.shouldEmitProgress(te, a) && n?.({
|
|
191417
|
+
loaded: te,
|
|
191418
191418
|
phase: "propertySets",
|
|
191419
|
-
total:
|
|
191419
|
+
total: a
|
|
191420
191420
|
});
|
|
191421
191421
|
}
|
|
191422
|
-
let
|
|
191422
|
+
let ne = 0, re = /* @__PURE__ */ new Set(), h = (e) => {
|
|
191423
|
+
if (re.has(e)) return;
|
|
191424
|
+
let t = s[e];
|
|
191425
|
+
t && (re.add(e), r?.({
|
|
191426
|
+
elementID: e,
|
|
191427
|
+
props: t
|
|
191428
|
+
}));
|
|
191429
|
+
};
|
|
191430
|
+
Object.keys(s).forEach((e) => {
|
|
191431
|
+
let t = Number(e);
|
|
191432
|
+
Number.isFinite(t) && h(t);
|
|
191433
|
+
});
|
|
191423
191434
|
for (let r of t) {
|
|
191424
|
-
if (
|
|
191425
|
-
|
|
191426
|
-
loaded:
|
|
191435
|
+
if (s[r]) {
|
|
191436
|
+
h(r), ne += 1, this.shouldEmitProgress(ne, o) && n?.({
|
|
191437
|
+
loaded: ne,
|
|
191427
191438
|
phase: "elements",
|
|
191428
|
-
total:
|
|
191439
|
+
total: o
|
|
191429
191440
|
});
|
|
191430
191441
|
continue;
|
|
191431
191442
|
}
|
|
191432
191443
|
let t = await this.getItemProperty(e, r);
|
|
191433
|
-
t ?
|
|
191444
|
+
t ? s[r] = {
|
|
191434
191445
|
id: r,
|
|
191435
191446
|
guid: this.getStringValue(t.GlobalId),
|
|
191436
191447
|
props: {
|
|
@@ -191441,7 +191452,7 @@ var y_ = class {
|
|
|
191441
191452
|
elevation: void 0
|
|
191442
191453
|
},
|
|
191443
191454
|
sets: []
|
|
191444
|
-
} :
|
|
191455
|
+
} : s[r] = {
|
|
191445
191456
|
id: r,
|
|
191446
191457
|
guid: "null",
|
|
191447
191458
|
props: {
|
|
@@ -191452,13 +191463,13 @@ var y_ = class {
|
|
|
191452
191463
|
elevation: void 0
|
|
191453
191464
|
},
|
|
191454
191465
|
sets: []
|
|
191455
|
-
},
|
|
191456
|
-
loaded:
|
|
191466
|
+
}, h(r), ne += 1, this.shouldEmitProgress(ne, o) && n?.({
|
|
191467
|
+
loaded: ne,
|
|
191457
191468
|
phase: "elements",
|
|
191458
|
-
total:
|
|
191469
|
+
total: o
|
|
191459
191470
|
});
|
|
191460
191471
|
}
|
|
191461
|
-
return
|
|
191472
|
+
return s;
|
|
191462
191473
|
}
|
|
191463
191474
|
async getItemProperty(e, t, n = !1) {
|
|
191464
191475
|
let r = this.getItemPropertyCacheKey(e, t, n), i = this.itemPropertyCache.get(r);
|
|
@@ -191939,40 +191950,40 @@ var S_ = class {
|
|
|
191939
191950
|
set _parser(e) {
|
|
191940
191951
|
this.parser = e, this.propertySerializer = new y_(this.parser), this.parserReady = null;
|
|
191941
191952
|
}
|
|
191942
|
-
async loadModel(e, t) {
|
|
191953
|
+
async loadModel(e, t, n) {
|
|
191943
191954
|
await this.initParser(this.getPath), this.setCoordinationMatrix(t);
|
|
191944
|
-
let
|
|
191945
|
-
for (let e = 0; e <
|
|
191955
|
+
let r = Array.isArray(e) ? e : [e], i = {};
|
|
191956
|
+
for (let e = 0; e < r.length; e++) {
|
|
191946
191957
|
let t = Date.now();
|
|
191947
|
-
|
|
191958
|
+
i[e] = await this.loadSingleModel(r[e], n), i[e].coordinationMatrix ??= this.coordinationMatrixData, console.log(`Loaded by ${Date.now() - t} ms`);
|
|
191948
191959
|
}
|
|
191949
|
-
return
|
|
191960
|
+
return i;
|
|
191950
191961
|
}
|
|
191951
191962
|
async parseBinaryFile(e, t, n) {
|
|
191952
191963
|
return await this.initParser(this.getPath), this.setCoordinationMatrix(t), this.parseInitializedBuffer(e, n);
|
|
191953
191964
|
}
|
|
191954
|
-
async loadSingleModel(e) {
|
|
191965
|
+
async loadSingleModel(e, t) {
|
|
191955
191966
|
if (typeof e == "string") {
|
|
191956
|
-
let { data:
|
|
191957
|
-
return
|
|
191967
|
+
let { data: n } = await this.getModelData(e, t);
|
|
191968
|
+
return n;
|
|
191958
191969
|
}
|
|
191959
|
-
return this.parseInitializedBuffer(await e.arrayBuffer());
|
|
191970
|
+
return this.parseInitializedBuffer(await e.arrayBuffer(), t);
|
|
191960
191971
|
}
|
|
191961
191972
|
async parseInitializedBuffer(e, t) {
|
|
191962
191973
|
let n = await this.getModelDataFromBuffer(e, void 0, t);
|
|
191963
191974
|
if (!n) throw Error("model loading error");
|
|
191964
191975
|
return n.data;
|
|
191965
191976
|
}
|
|
191966
|
-
getModelData(e) {
|
|
191967
|
-
return new Promise((
|
|
191977
|
+
getModelData(e, t) {
|
|
191978
|
+
return new Promise((n, r) => {
|
|
191968
191979
|
fetch(e).then((e) => e.arrayBuffer()).then(async (e) => {
|
|
191969
191980
|
if (this.parser) {
|
|
191970
|
-
let
|
|
191971
|
-
|
|
191981
|
+
let i = await this.getModelDataFromBuffer(e, void 0, t);
|
|
191982
|
+
i ? n(i) : r("model loading error");
|
|
191972
191983
|
}
|
|
191973
|
-
|
|
191984
|
+
r("model loading error");
|
|
191974
191985
|
}).catch((e) => {
|
|
191975
|
-
console.log(e),
|
|
191986
|
+
console.log(e), r("model loading error");
|
|
191976
191987
|
});
|
|
191977
191988
|
});
|
|
191978
191989
|
}
|
|
@@ -192030,8 +192041,8 @@ var S_ = class {
|
|
|
192030
192041
|
n && (p[t] = this.transformGridData(n, d));
|
|
192031
192042
|
}
|
|
192032
192043
|
n?.onPhase?.("properties");
|
|
192033
|
-
let m = await this.propertySerializer.serializeAllProperties(a, c, n?.onPropertiesProgress), ee = await this.propertySerializer.getSpatialStructure(a, !1);
|
|
192034
|
-
return u.coordinationMatrix ??= this.coordinationMatrixData, u.props = m, u.structure = ee, u.grids = p, typeof s == "number" && (u.trueNorthAngle = s), console.log("spend to load ifc data: ", Date.now() - r, "ms"), {
|
|
192044
|
+
let m = await this.propertySerializer.serializeAllProperties(a, c, n?.onPropertiesProgress, n?.onElementPropertiesSerialized), ee = await this.propertySerializer.getSpatialStructure(a, !1);
|
|
192045
|
+
return n?.onStructureSerialized?.(ee), u.coordinationMatrix ??= this.coordinationMatrixData, u.props = m, u.structure = ee, u.grids = p, typeof s == "number" && (u.trueNorthAngle = s), console.log("spend to load ifc data: ", Date.now() - r, "ms"), {
|
|
192035
192046
|
structure: ee,
|
|
192036
192047
|
propsData: m,
|
|
192037
192048
|
data: u,
|
|
@@ -64,6 +64,7 @@ export declare class BmtConverter {
|
|
|
64
64
|
private getModelFileBaseName;
|
|
65
65
|
private normalizeBaseName;
|
|
66
66
|
private createModelFiles;
|
|
67
|
+
private createConvertedModelResult;
|
|
67
68
|
private createBmtBytes;
|
|
68
69
|
private writeProps;
|
|
69
70
|
private writeMeshes;
|
|
@@ -98,7 +99,6 @@ export declare class BmtConverter {
|
|
|
98
99
|
private deflateTypedArray;
|
|
99
100
|
private deflateBytes;
|
|
100
101
|
private encodeText;
|
|
101
|
-
private encodePrettyJson;
|
|
102
102
|
private shouldEmitItemProgress;
|
|
103
103
|
private clampProgress;
|
|
104
104
|
private isRecord;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BmtElementProps, BmtModelProps, BmtModelStructure } from "./BmtLoader";
|
|
2
|
+
export declare class BmtExternalMetadataWriter {
|
|
3
|
+
private readonly chunks;
|
|
4
|
+
private readonly textEncoder;
|
|
5
|
+
private closed;
|
|
6
|
+
private length;
|
|
7
|
+
private propsClosed;
|
|
8
|
+
private wroteProperty;
|
|
9
|
+
constructor();
|
|
10
|
+
writeProperty(elementID: number | string, props: BmtElementProps): void;
|
|
11
|
+
finish(structure: BmtModelStructure): void;
|
|
12
|
+
get isClosed(): boolean;
|
|
13
|
+
toUint8Array(): Uint8Array<ArrayBuffer>;
|
|
14
|
+
private writeJsonValue;
|
|
15
|
+
private writeText;
|
|
16
|
+
}
|
|
17
|
+
export declare function createBmtExternalMetadataBytes(props: BmtModelProps, structure: BmtModelStructure): Uint8Array<ArrayBuffer>;
|
|
@@ -61,6 +61,7 @@ export interface BmtModelData {
|
|
|
61
61
|
coordinationMatrix?: string;
|
|
62
62
|
data: BmtModelGeometryData;
|
|
63
63
|
grids?: ModelGridsData;
|
|
64
|
+
minVersionMetadataBytes?: Uint8Array;
|
|
64
65
|
name?: string;
|
|
65
66
|
props: BmtModelProps;
|
|
66
67
|
renderSettings?: BmtModelRenderSettings;
|
|
@@ -69,6 +70,7 @@ export interface BmtModelData {
|
|
|
69
70
|
}
|
|
70
71
|
export type BmtGeometryChunkData = {
|
|
71
72
|
chunkIndex: number;
|
|
73
|
+
coordinationMatrix?: string;
|
|
72
74
|
geometry: BmtGeomData;
|
|
73
75
|
geometryID: number;
|
|
74
76
|
isIfcSpace: boolean;
|
|
@@ -119,6 +121,7 @@ export declare class BMTLoader {
|
|
|
119
121
|
parseMesh(data: Uint8Array): BmtMeshData;
|
|
120
122
|
private getExternalMetadataPath;
|
|
121
123
|
private loadExternalMetadata;
|
|
124
|
+
private getCoordinationMatrixFromBinary;
|
|
122
125
|
private getModelNameFromPath;
|
|
123
126
|
loadModel(path: string, callbacks?: BmtParseCallbacks): Promise<BmtModelData>;
|
|
124
127
|
parseBinaryFile(data: ArrayBuffer, callbacks?: BmtParseCallbacks): BmtModelData;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IfcElementsAssembly, type IfcPropertiesProgressData } from "./PropertySerializer";
|
|
1
|
+
import { type IfcElementsAssembly, type IfcPropertiesProgressData, type IfcSerializedElementPropertiesCallback } from "./PropertySerializer";
|
|
2
2
|
import { Matrix4 } from "three";
|
|
3
3
|
import { IfcAPI, type LocateFileHandlerFn } from "web-ifc";
|
|
4
4
|
import { type GridData } from "./IfcGrid";
|
|
@@ -21,6 +21,7 @@ export type IfcLoadedModels = Record<number, BmtModelData>;
|
|
|
21
21
|
export type IfcCoordinationMatrixSource = Matrix4 | number[] | string | null | undefined;
|
|
22
22
|
export type IfcGeometryChunkData = {
|
|
23
23
|
chunkIndex: number;
|
|
24
|
+
coordinationMatrix?: string;
|
|
24
25
|
geometry: BmtGeomData;
|
|
25
26
|
geometryID: number;
|
|
26
27
|
isIfcSpace: boolean;
|
|
@@ -34,10 +35,12 @@ export type IfcGeometryProgressData = {
|
|
|
34
35
|
export type IfcPropertyProgressData = IfcPropertiesProgressData;
|
|
35
36
|
export type IfcParsePhase = "opening" | "opened" | "streaming" | "properties" | "metadata";
|
|
36
37
|
export type IfcParseCallbacks = {
|
|
38
|
+
onElementPropertiesSerialized?: IfcSerializedElementPropertiesCallback;
|
|
37
39
|
onGeometryChunk?: (chunk: IfcGeometryChunkData) => void;
|
|
38
40
|
onGeometryProgress?: (progress: IfcGeometryProgressData) => void;
|
|
39
41
|
onPhase?: (phase: IfcParsePhase) => void;
|
|
40
42
|
onPropertiesProgress?: (progress: IfcPropertyProgressData) => void;
|
|
43
|
+
onStructureSerialized?: (structure: BmtModelStructure) => void;
|
|
41
44
|
streamGeometryChunks?: boolean;
|
|
42
45
|
};
|
|
43
46
|
export declare class IFCLoader {
|
|
@@ -59,11 +62,11 @@ export declare class IFCLoader {
|
|
|
59
62
|
set wasmPath(path: string);
|
|
60
63
|
get _parser(): IfcAPI;
|
|
61
64
|
set _parser(parser: IfcAPI);
|
|
62
|
-
loadModel(sources: IfcModelSource | IfcModelSource[], coordinationMatrix?: IfcCoordinationMatrixSource): Promise<IfcLoadedModels>;
|
|
65
|
+
loadModel(sources: IfcModelSource | IfcModelSource[], coordinationMatrix?: IfcCoordinationMatrixSource, callbacks?: IfcParseCallbacks): Promise<IfcLoadedModels>;
|
|
63
66
|
parseBinaryFile(file: ArrayBuffer, coordinationMatrix?: IfcCoordinationMatrixSource, callbacks?: IfcParseCallbacks): Promise<BmtModelData>;
|
|
64
67
|
private loadSingleModel;
|
|
65
68
|
private parseInitializedBuffer;
|
|
66
|
-
getModelData(path: string): Promise<IfcModelDataResult>;
|
|
69
|
+
getModelData(path: string, callbacks?: IfcParseCallbacks): Promise<IfcModelDataResult>;
|
|
67
70
|
setCoordinationMatrix(matrix: IfcCoordinationMatrixSource): void;
|
|
68
71
|
resetCoordinationMatrix(): void;
|
|
69
72
|
get coordinationMatrixData(): string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IfcAPI } from "web-ifc";
|
|
2
|
-
import type { BmtModelProps, BmtModelStructureNode, BmtPropertyRecord, BmtPropertyValue } from "../BmtLoader";
|
|
2
|
+
import type { BmtElementProps, BmtModelProps, BmtModelStructureNode, BmtPropertyRecord, BmtPropertyValue } from "../BmtLoader";
|
|
3
3
|
type IfcValueRef = {
|
|
4
4
|
value: IfcRawValue;
|
|
5
5
|
};
|
|
@@ -36,6 +36,11 @@ export type IfcPropertiesProgressData = {
|
|
|
36
36
|
total: number;
|
|
37
37
|
};
|
|
38
38
|
export type IfcPropertiesProgressCallback = (progress: IfcPropertiesProgressData) => void;
|
|
39
|
+
export type IfcSerializedElementPropertiesData = {
|
|
40
|
+
elementID: number;
|
|
41
|
+
props: BmtElementProps;
|
|
42
|
+
};
|
|
43
|
+
export type IfcSerializedElementPropertiesCallback = (data: IfcSerializedElementPropertiesData) => void;
|
|
39
44
|
export declare class PropertySerializer {
|
|
40
45
|
private PropsNames;
|
|
41
46
|
readonly parser: IfcAPI;
|
|
@@ -44,9 +49,9 @@ export declare class PropertySerializer {
|
|
|
44
49
|
private spatialTreeChunksCache;
|
|
45
50
|
private typeNameCache;
|
|
46
51
|
constructor(parser: IfcAPI);
|
|
47
|
-
serializeAllProperties(modelID: number, ids: Set<number>, onProgress?: IfcPropertiesProgressCallback): Promise<BmtModelProps>;
|
|
52
|
+
serializeAllProperties(modelID: number, ids: Set<number>, onProgress?: IfcPropertiesProgressCallback, onElementSerialized?: IfcSerializedElementPropertiesCallback): Promise<BmtModelProps>;
|
|
48
53
|
resetCaches(): void;
|
|
49
|
-
getPropertiesAsBlobs(modelID: number, ids: Set<number>, onProgress?: IfcPropertiesProgressCallback): Promise<BmtModelProps>;
|
|
54
|
+
getPropertiesAsBlobs(modelID: number, ids: Set<number>, onProgress?: IfcPropertiesProgressCallback, onElementSerialized?: IfcSerializedElementPropertiesCallback): Promise<BmtModelProps>;
|
|
50
55
|
getItemProperty(modelID: number, id: number, flatten?: boolean): Promise<IfcLineData | null>;
|
|
51
56
|
private getItemPropertiesBatch;
|
|
52
57
|
private readItemProperty;
|
package/lib/Viewer.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type ComponentProps } from "react";
|
|
2
|
-
import type { BmtModelData } from "./Loaders/BmtLoader";
|
|
3
2
|
import { Canvas } from "@react-three/fiber";
|
|
4
3
|
import type { ViewerMaterialMode } from "./types";
|
|
5
4
|
import { type ViewerApi, type ViewerSelection } from "./api/ViewerApi";
|
|
6
5
|
import { type ViewerModelSource } from "./api/loader";
|
|
7
|
-
type ModelsData
|
|
6
|
+
import { type ModelsData } from "./ViewerComponents/ViewerScene";
|
|
8
7
|
export type ViewerModelsData = ModelsData;
|
|
9
8
|
export type ViewerProps = {
|
|
10
9
|
autoFitCamera?: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ViewerModelsApi, ViewerSceneApi } from "../api/ViewerApi";
|
|
2
|
+
import type { ViewerPlansContainerFactory } from "../api/ViewerPlansApi";
|
|
3
|
+
export declare class ViewerSceneApiHolder {
|
|
4
|
+
private sceneApi;
|
|
5
|
+
get: () => ViewerSceneApi | null;
|
|
6
|
+
set: (sceneApi: ViewerSceneApi | null) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare class ViewerModelsApiHolder {
|
|
9
|
+
private modelsApi;
|
|
10
|
+
get: () => ViewerModelsApi | null;
|
|
11
|
+
set: (modelsApi: ViewerModelsApi | null) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare class ViewerPlansContainerFactoryHolder {
|
|
14
|
+
private factory;
|
|
15
|
+
get: () => ViewerPlansContainerFactory | null;
|
|
16
|
+
set: (factory: ViewerPlansContainerFactory | null) => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const NAV_CUBE_CONTAINER_STYLE: {
|
|
2
|
+
bottom: number;
|
|
3
|
+
height: number;
|
|
4
|
+
pointerEvents: "auto";
|
|
5
|
+
position: "absolute";
|
|
6
|
+
right: number;
|
|
7
|
+
touchAction: "none";
|
|
8
|
+
width: number;
|
|
9
|
+
zIndex: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const VIEWER_CANVAS_CONTAINER_STYLE: {
|
|
12
|
+
height: string;
|
|
13
|
+
position: "relative";
|
|
14
|
+
width: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const NAV_CUBE_CAMERA: {
|
|
17
|
+
far: number;
|
|
18
|
+
near: number;
|
|
19
|
+
position: [number, number, number];
|
|
20
|
+
zoom: number;
|
|
21
|
+
};
|
|
22
|
+
export declare const NAV_CUBE_GL: {
|
|
23
|
+
alpha: boolean;
|
|
24
|
+
antialias: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare const NAV_CUBE_PERFORMANCE_GL: {
|
|
27
|
+
alpha: boolean;
|
|
28
|
+
antialias: boolean;
|
|
29
|
+
powerPreference: "high-performance";
|
|
30
|
+
};
|
|
31
|
+
export declare const PERFORMANCE_CANVAS_GL: {
|
|
32
|
+
antialias: boolean;
|
|
33
|
+
powerPreference: "high-performance";
|
|
34
|
+
};
|
|
35
|
+
export declare const NAV_CUBE_MIN_DPR = 2;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function ViewerPostproduction({ enabled }: {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
export declare function ViewerWebGpuPostproduction({ enabled, }: {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { Canvas } from "@react-three/fiber";
|
|
3
|
+
import { Object3D, OrthographicCamera, PerspectiveCamera, Plane, Vector3 } from "three";
|
|
4
|
+
import type { ViewerControlsRef } from "../types";
|
|
5
|
+
import type { ViewerPlanLocalPlaneSource } from "../api/ViewerPlansApi";
|
|
6
|
+
import { type ViewerNotesApi } from "../utils/NotesUtils";
|
|
7
|
+
export declare const CAMERA_MOTION_VISIBILITY_HIDDEN_KEY = "__bimatterCameraMotionHidden";
|
|
8
|
+
export declare function applyPlanViewToCamera({ camera, controls, invalidate, model, plane, size, viewNormal, }: {
|
|
9
|
+
camera: PerspectiveCamera | OrthographicCamera;
|
|
10
|
+
controls?: ViewerControlsRef["current"];
|
|
11
|
+
invalidate?: () => void;
|
|
12
|
+
model: Object3D | null;
|
|
13
|
+
plane: Plane;
|
|
14
|
+
size: {
|
|
15
|
+
height: number;
|
|
16
|
+
width: number;
|
|
17
|
+
};
|
|
18
|
+
viewNormal?: Vector3;
|
|
19
|
+
}): {
|
|
20
|
+
position: Vector3;
|
|
21
|
+
target: Vector3;
|
|
22
|
+
zoom: number;
|
|
23
|
+
} | null;
|
|
24
|
+
export declare function getPlaneCoplanarPoint(plane: Plane): Vector3;
|
|
25
|
+
export declare function createPlanOnlyPlane(sourceModel: Object3D | null, source: ViewerPlanLocalPlaneSource): Plane;
|
|
26
|
+
export declare function SharedPlanCanvas({ dpr, getExtraObjects, onPreselectionChange, performanceMode, plane, registerInvalidate, registerNotesApi, sourceModel, useLocalClippingVisuals, useWebGPU, viewNormal, }: {
|
|
27
|
+
dpr: ComponentProps<typeof Canvas>["dpr"];
|
|
28
|
+
getExtraObjects: () => Object3D[];
|
|
29
|
+
onPreselectionChange?: (preselection: {
|
|
30
|
+
elementID: number;
|
|
31
|
+
modelID: number;
|
|
32
|
+
} | null) => void;
|
|
33
|
+
performanceMode: boolean;
|
|
34
|
+
plane: Plane;
|
|
35
|
+
registerInvalidate?: (invalidate: () => void) => () => void;
|
|
36
|
+
registerNotesApi?: (api: ViewerNotesApi) => () => void;
|
|
37
|
+
sourceModel: Object3D;
|
|
38
|
+
useLocalClippingVisuals?: boolean;
|
|
39
|
+
useWebGPU: boolean;
|
|
40
|
+
viewNormal?: Vector3;
|
|
41
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Object3D, Plane } from "three";
|
|
2
|
+
import type { BmtModelData } from "../Loaders/BmtLoader";
|
|
3
|
+
import type { ViewerCameraRef, ViewerControlsRef, ViewerLightRef, ViewerMaterialMode, ViewerModelRef } from "../types";
|
|
4
|
+
import { type ViewerNotesApi } from "../utils/NotesUtils";
|
|
5
|
+
import { type ViewerApi, type ViewerSceneApi } from "../api/ViewerApi";
|
|
6
|
+
export type ModelsData = Record<number, BmtModelData>;
|
|
7
|
+
export type CameraDprMode = "wake" | "move" | "sleep";
|
|
8
|
+
export declare function ViewerScene({ autoFitCamera, cameraRef, controlRef, fitToView, loadGeneration, lightRef, materialMode, modelRef, modelsData, modelsLoading, initialPlanPlane, createPlanComment, createPlanMarkupCloud, deleteAllPlanNotes, onReady, onModelsReady, onCameraDprModeChange, publicApi, invalidatePlanViews, setPlanPreselectionHandler, setPlanVisualObjectsGetter, setSceneApi, setPlanNotesModeActive, usePerformanceMoving, useWebGPU, }: {
|
|
9
|
+
autoFitCamera: boolean;
|
|
10
|
+
cameraRef: ViewerCameraRef;
|
|
11
|
+
controlRef: ViewerControlsRef;
|
|
12
|
+
fitToView: boolean;
|
|
13
|
+
loadGeneration: number;
|
|
14
|
+
lightRef: ViewerLightRef;
|
|
15
|
+
materialMode?: ViewerMaterialMode;
|
|
16
|
+
modelRef: ViewerModelRef;
|
|
17
|
+
modelsData: ModelsData;
|
|
18
|
+
modelsLoading: boolean;
|
|
19
|
+
initialPlanPlane?: Plane | null;
|
|
20
|
+
deleteAllPlanNotes: () => void;
|
|
21
|
+
onReady?: (api: ViewerApi) => void;
|
|
22
|
+
onModelsReady: (loadGeneration: number) => void;
|
|
23
|
+
onCameraDprModeChange: (mode: CameraDprMode) => void;
|
|
24
|
+
publicApi: ViewerApi;
|
|
25
|
+
invalidatePlanViews: () => void;
|
|
26
|
+
createPlanComment: ViewerNotesApi["createComment"];
|
|
27
|
+
createPlanMarkupCloud: ViewerNotesApi["createMarkupCloud"];
|
|
28
|
+
setPlanPreselectionHandler: (handler: ((preselection: {
|
|
29
|
+
elementID: number;
|
|
30
|
+
modelID: number;
|
|
31
|
+
} | null) => void) | null) => void;
|
|
32
|
+
setPlanVisualObjectsGetter: (getter: (() => Object3D[]) | null) => void;
|
|
33
|
+
setSceneApi: (sceneApi: ViewerSceneApi | null) => void;
|
|
34
|
+
setPlanNotesModeActive: (active: boolean) => void;
|
|
35
|
+
usePerformanceMoving: boolean;
|
|
36
|
+
useWebGPU: boolean;
|
|
37
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { Canvas, type Renderer } from "@react-three/fiber";
|
|
3
|
+
import { Camera, Object3D, type ColorRepresentation } from "three";
|
|
4
|
+
import type { ViewerLightRef } from "../types";
|
|
5
|
+
export type WebGpuRenderer = Renderer & {
|
|
6
|
+
compileAsync?: (scene: Object3D, camera: Camera, targetScene?: Object3D | null) => Promise<unknown>;
|
|
7
|
+
domElement: HTMLCanvasElement;
|
|
8
|
+
getPixelRatio?: () => number;
|
|
9
|
+
init?: () => Promise<void>;
|
|
10
|
+
setClearColor: (color: ColorRepresentation, alpha?: number) => void;
|
|
11
|
+
setPixelRatio?: (value: number) => void;
|
|
12
|
+
setSize?: (width: number, height: number, updateStyle?: boolean) => void;
|
|
13
|
+
};
|
|
14
|
+
type CanvasGlFactory = Extract<NonNullable<ComponentProps<typeof Canvas>["gl"]>, (...args: never[]) => unknown>;
|
|
15
|
+
type WebGpuRendererDefaultProps = Parameters<CanvasGlFactory>[0];
|
|
16
|
+
export declare function createWebGpuRendererFactory({ alpha, performanceMode, }: {
|
|
17
|
+
alpha?: boolean;
|
|
18
|
+
performanceMode: boolean;
|
|
19
|
+
}): ({ canvas, }: WebGpuRendererDefaultProps) => Promise<Renderer>;
|
|
20
|
+
export declare function WebGpuRendererResizeGuard({ active }: {
|
|
21
|
+
active: boolean;
|
|
22
|
+
}): null;
|
|
23
|
+
export declare function RendererReadySignal({ active, onReady, }: {
|
|
24
|
+
active: boolean;
|
|
25
|
+
onReady: () => void;
|
|
26
|
+
}): null;
|
|
27
|
+
export declare function WebGpuSceneLights({ ambientColor, ambientIntensity, directionalColor, directionalIntensity, lightRef, }: {
|
|
28
|
+
ambientColor: ColorRepresentation;
|
|
29
|
+
ambientIntensity: number;
|
|
30
|
+
directionalColor: ColorRepresentation;
|
|
31
|
+
directionalIntensity: number;
|
|
32
|
+
lightRef: ViewerLightRef;
|
|
33
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function ViewerHardwareDetector(): null;
|
|
35
|
+
export {};
|