@ifc-lite/cache 1.1.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/LICENSE +373 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/reader.d.ts +16 -0
- package/dist/reader.d.ts.map +1 -0
- package/dist/reader.js +102 -0
- package/dist/reader.js.map +1 -0
- package/dist/sections/entities.d.ts +28 -0
- package/dist/sections/entities.d.ts.map +1 -0
- package/dist/sections/entities.js +121 -0
- package/dist/sections/entities.js.map +1 -0
- package/dist/sections/geometry.d.ts +32 -0
- package/dist/sections/geometry.d.ts.map +1 -0
- package/dist/sections/geometry.js +125 -0
- package/dist/sections/geometry.js.map +1 -0
- package/dist/sections/header.d.ts +14 -0
- package/dist/sections/header.d.ts.map +1 -0
- package/dist/sections/header.js +95 -0
- package/dist/sections/header.js.map +1 -0
- package/dist/sections/properties.d.ts +28 -0
- package/dist/sections/properties.d.ts.map +1 -0
- package/dist/sections/properties.js +201 -0
- package/dist/sections/properties.js.map +1 -0
- package/dist/sections/quantities.d.ts +14 -0
- package/dist/sections/quantities.d.ts.map +1 -0
- package/dist/sections/quantities.js +119 -0
- package/dist/sections/quantities.js.map +1 -0
- package/dist/sections/relationships.d.ts +21 -0
- package/dist/sections/relationships.d.ts.map +1 -0
- package/dist/sections/relationships.js +134 -0
- package/dist/sections/relationships.js.map +1 -0
- package/dist/sections/strings.d.ts +18 -0
- package/dist/sections/strings.d.ts.map +1 -0
- package/dist/sections/strings.js +59 -0
- package/dist/sections/strings.js.map +1 -0
- package/dist/types.d.ts +128 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +45 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/buffer-utils.d.ts +65 -0
- package/dist/utils/buffer-utils.d.ts.map +1 -0
- package/dist/utils/buffer-utils.js +204 -0
- package/dist/utils/buffer-utils.js.map +1 -0
- package/dist/utils/hash.d.ts +12 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +99 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/writer.d.ts +24 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +125 -0
- package/dist/writer.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { IfcTypeEnumToString } from '@ifc-lite/data';
|
|
5
|
+
/**
|
|
6
|
+
* Write EntityTable to buffer
|
|
7
|
+
* Format:
|
|
8
|
+
* - count: uint32
|
|
9
|
+
* - expressId: Uint32Array[count]
|
|
10
|
+
* - typeEnum: Uint16Array[count]
|
|
11
|
+
* - globalId: Uint32Array[count] (string indices)
|
|
12
|
+
* - name: Uint32Array[count]
|
|
13
|
+
* - description: Uint32Array[count]
|
|
14
|
+
* - objectType: Uint32Array[count]
|
|
15
|
+
* - flags: Uint8Array[count]
|
|
16
|
+
* - containedInStorey: Int32Array[count]
|
|
17
|
+
* - definedByType: Int32Array[count]
|
|
18
|
+
* - geometryIndex: Int32Array[count]
|
|
19
|
+
* - typeRangeCount: uint16
|
|
20
|
+
* - typeRanges: [type:uint16, start:uint32, end:uint32][]
|
|
21
|
+
*/
|
|
22
|
+
export function writeEntities(writer, entities) {
|
|
23
|
+
const count = entities.count;
|
|
24
|
+
// Write count
|
|
25
|
+
writer.writeUint32(count);
|
|
26
|
+
// Write columnar arrays
|
|
27
|
+
writer.writeTypedArray(entities.expressId);
|
|
28
|
+
writer.writeTypedArray(entities.typeEnum);
|
|
29
|
+
writer.writeTypedArray(entities.globalId);
|
|
30
|
+
writer.writeTypedArray(entities.name);
|
|
31
|
+
writer.writeTypedArray(entities.description);
|
|
32
|
+
writer.writeTypedArray(entities.objectType);
|
|
33
|
+
writer.writeTypedArray(entities.flags);
|
|
34
|
+
writer.writeTypedArray(entities.containedInStorey);
|
|
35
|
+
writer.writeTypedArray(entities.definedByType);
|
|
36
|
+
writer.writeTypedArray(entities.geometryIndex);
|
|
37
|
+
// Write type ranges
|
|
38
|
+
const typeRangeCount = entities.typeRanges.size;
|
|
39
|
+
writer.writeUint16(typeRangeCount);
|
|
40
|
+
for (const [type, range] of entities.typeRanges) {
|
|
41
|
+
writer.writeUint16(type);
|
|
42
|
+
writer.writeUint32(range.start);
|
|
43
|
+
writer.writeUint32(range.end);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Read EntityTable from buffer
|
|
48
|
+
*/
|
|
49
|
+
export function readEntities(reader, strings) {
|
|
50
|
+
const count = reader.readUint32();
|
|
51
|
+
// Read columnar arrays
|
|
52
|
+
const expressId = reader.readUint32Array(count);
|
|
53
|
+
const typeEnum = reader.readUint16Array(count);
|
|
54
|
+
const globalId = reader.readUint32Array(count);
|
|
55
|
+
const name = reader.readUint32Array(count);
|
|
56
|
+
const description = reader.readUint32Array(count);
|
|
57
|
+
const objectType = reader.readUint32Array(count);
|
|
58
|
+
const flags = reader.readUint8Array(count);
|
|
59
|
+
const containedInStorey = reader.readInt32Array(count);
|
|
60
|
+
const definedByType = reader.readInt32Array(count);
|
|
61
|
+
const geometryIndex = reader.readInt32Array(count);
|
|
62
|
+
// Read type ranges
|
|
63
|
+
const typeRangeCount = reader.readUint16();
|
|
64
|
+
const typeRanges = new Map();
|
|
65
|
+
for (let i = 0; i < typeRangeCount; i++) {
|
|
66
|
+
const type = reader.readUint16();
|
|
67
|
+
const start = reader.readUint32();
|
|
68
|
+
const end = reader.readUint32();
|
|
69
|
+
typeRanges.set(type, { start, end });
|
|
70
|
+
}
|
|
71
|
+
// Build EntityTable with methods
|
|
72
|
+
const HAS_GEOMETRY = 0b00000001;
|
|
73
|
+
const indexOfId = (id) => {
|
|
74
|
+
for (let i = 0; i < expressId.length; i++) {
|
|
75
|
+
if (expressId[i] === id)
|
|
76
|
+
return i;
|
|
77
|
+
}
|
|
78
|
+
return -1;
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
count,
|
|
82
|
+
expressId,
|
|
83
|
+
typeEnum,
|
|
84
|
+
globalId,
|
|
85
|
+
name,
|
|
86
|
+
description,
|
|
87
|
+
objectType,
|
|
88
|
+
flags,
|
|
89
|
+
containedInStorey,
|
|
90
|
+
definedByType,
|
|
91
|
+
geometryIndex,
|
|
92
|
+
typeRanges,
|
|
93
|
+
getGlobalId: (id) => {
|
|
94
|
+
const idx = indexOfId(id);
|
|
95
|
+
return idx >= 0 ? strings.get(globalId[idx]) : '';
|
|
96
|
+
},
|
|
97
|
+
getName: (id) => {
|
|
98
|
+
const idx = indexOfId(id);
|
|
99
|
+
return idx >= 0 ? strings.get(name[idx]) : '';
|
|
100
|
+
},
|
|
101
|
+
getTypeName: (id) => {
|
|
102
|
+
const idx = indexOfId(id);
|
|
103
|
+
return idx >= 0 ? IfcTypeEnumToString(typeEnum[idx]) : 'Unknown';
|
|
104
|
+
},
|
|
105
|
+
hasGeometry: (id) => {
|
|
106
|
+
const idx = indexOfId(id);
|
|
107
|
+
return idx >= 0 ? (flags[idx] & HAS_GEOMETRY) !== 0 : false;
|
|
108
|
+
},
|
|
109
|
+
getByType: (type) => {
|
|
110
|
+
const range = typeRanges.get(type);
|
|
111
|
+
if (!range)
|
|
112
|
+
return [];
|
|
113
|
+
const ids = [];
|
|
114
|
+
for (let i = range.start; i < range.end; i++) {
|
|
115
|
+
ids.push(expressId[i]);
|
|
116
|
+
}
|
|
117
|
+
return ids;
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../../src/sections/entities.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAO/D,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AG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACnE,CAAC;QACD,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE;YAClB,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;YAC1B,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC9D,CAAC;QACD,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE;YAClB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,KAAK;gBAAE,OAAO,EAAE,CAAC;YACtB,MAAM,GAAG,GAAa,EAAE,CAAC;YACzB,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YACzB,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geometry serialization
|
|
3
|
+
*/
|
|
4
|
+
import type { MeshData, CoordinateInfo } from '@ifc-lite/geometry';
|
|
5
|
+
import { BufferWriter, BufferReader } from '../utils/buffer-utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Write geometry data to buffer
|
|
8
|
+
* Format:
|
|
9
|
+
* - meshCount: uint32
|
|
10
|
+
* - totalVertices: uint32
|
|
11
|
+
* - totalTriangles: uint32
|
|
12
|
+
* - coordinateInfo (see below)
|
|
13
|
+
* - per mesh:
|
|
14
|
+
* - expressId: uint32
|
|
15
|
+
* - vertexCount: uint32
|
|
16
|
+
* - indexCount: uint32
|
|
17
|
+
* - color: float32[4]
|
|
18
|
+
* - positions: Float32Array[vertexCount * 3]
|
|
19
|
+
* - normals: Float32Array[vertexCount * 3]
|
|
20
|
+
* - indices: Uint32Array[indexCount]
|
|
21
|
+
*/
|
|
22
|
+
export declare function writeGeometry(writer: BufferWriter, meshes: MeshData[], totalVertices: number, totalTriangles: number, coordinateInfo: CoordinateInfo): void;
|
|
23
|
+
/**
|
|
24
|
+
* Read geometry data from buffer
|
|
25
|
+
*/
|
|
26
|
+
export declare function readGeometry(reader: BufferReader): {
|
|
27
|
+
meshes: MeshData[];
|
|
28
|
+
totalVertices: number;
|
|
29
|
+
totalTriangles: number;
|
|
30
|
+
coordinateInfo: CoordinateInfo;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/sections/geometry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAc,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,QAAQ,EAAE,EAClB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,cAAc,GAC7B,IAAI,CA6BN;AA2BD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG;IAClD,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,cAAc,CAAC;CAChC,CAwCA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Write geometry data to buffer
|
|
6
|
+
* Format:
|
|
7
|
+
* - meshCount: uint32
|
|
8
|
+
* - totalVertices: uint32
|
|
9
|
+
* - totalTriangles: uint32
|
|
10
|
+
* - coordinateInfo (see below)
|
|
11
|
+
* - per mesh:
|
|
12
|
+
* - expressId: uint32
|
|
13
|
+
* - vertexCount: uint32
|
|
14
|
+
* - indexCount: uint32
|
|
15
|
+
* - color: float32[4]
|
|
16
|
+
* - positions: Float32Array[vertexCount * 3]
|
|
17
|
+
* - normals: Float32Array[vertexCount * 3]
|
|
18
|
+
* - indices: Uint32Array[indexCount]
|
|
19
|
+
*/
|
|
20
|
+
export function writeGeometry(writer, meshes, totalVertices, totalTriangles, coordinateInfo) {
|
|
21
|
+
writer.writeUint32(meshes.length);
|
|
22
|
+
writer.writeUint32(totalVertices);
|
|
23
|
+
writer.writeUint32(totalTriangles);
|
|
24
|
+
// Write coordinate info
|
|
25
|
+
writeCoordinateInfo(writer, coordinateInfo);
|
|
26
|
+
// Write each mesh
|
|
27
|
+
for (const mesh of meshes) {
|
|
28
|
+
writer.writeUint32(mesh.expressId);
|
|
29
|
+
const vertexCount = mesh.positions.length / 3;
|
|
30
|
+
const indexCount = mesh.indices.length;
|
|
31
|
+
writer.writeUint32(vertexCount);
|
|
32
|
+
writer.writeUint32(indexCount);
|
|
33
|
+
// Write color (RGBA)
|
|
34
|
+
writer.writeFloat32(mesh.color[0]);
|
|
35
|
+
writer.writeFloat32(mesh.color[1]);
|
|
36
|
+
writer.writeFloat32(mesh.color[2]);
|
|
37
|
+
writer.writeFloat32(mesh.color[3]);
|
|
38
|
+
// Write geometry arrays
|
|
39
|
+
writer.writeTypedArray(mesh.positions);
|
|
40
|
+
writer.writeTypedArray(mesh.normals);
|
|
41
|
+
writer.writeTypedArray(mesh.indices);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function writeCoordinateInfo(writer, info) {
|
|
45
|
+
// Origin shift
|
|
46
|
+
writeVec3(writer, info.originShift);
|
|
47
|
+
// Original bounds
|
|
48
|
+
writeAABB(writer, info.originalBounds);
|
|
49
|
+
// Shifted bounds
|
|
50
|
+
writeAABB(writer, info.shiftedBounds);
|
|
51
|
+
// Is geo-referenced flag
|
|
52
|
+
writer.writeUint8(info.isGeoReferenced ? 1 : 0);
|
|
53
|
+
}
|
|
54
|
+
function writeVec3(writer, v) {
|
|
55
|
+
writer.writeFloat64(v.x);
|
|
56
|
+
writer.writeFloat64(v.y);
|
|
57
|
+
writer.writeFloat64(v.z);
|
|
58
|
+
}
|
|
59
|
+
function writeAABB(writer, aabb) {
|
|
60
|
+
writeVec3(writer, aabb.min);
|
|
61
|
+
writeVec3(writer, aabb.max);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Read geometry data from buffer
|
|
65
|
+
*/
|
|
66
|
+
export function readGeometry(reader) {
|
|
67
|
+
const meshCount = reader.readUint32();
|
|
68
|
+
const totalVertices = reader.readUint32();
|
|
69
|
+
const totalTriangles = reader.readUint32();
|
|
70
|
+
const coordinateInfo = readCoordinateInfo(reader);
|
|
71
|
+
const meshes = [];
|
|
72
|
+
for (let i = 0; i < meshCount; i++) {
|
|
73
|
+
const expressId = reader.readUint32();
|
|
74
|
+
const vertexCount = reader.readUint32();
|
|
75
|
+
const indexCount = reader.readUint32();
|
|
76
|
+
const color = [
|
|
77
|
+
reader.readFloat32(),
|
|
78
|
+
reader.readFloat32(),
|
|
79
|
+
reader.readFloat32(),
|
|
80
|
+
reader.readFloat32(),
|
|
81
|
+
];
|
|
82
|
+
const positions = reader.readFloat32Array(vertexCount * 3);
|
|
83
|
+
const normals = reader.readFloat32Array(vertexCount * 3);
|
|
84
|
+
const indices = reader.readUint32Array(indexCount);
|
|
85
|
+
meshes.push({
|
|
86
|
+
expressId,
|
|
87
|
+
positions,
|
|
88
|
+
normals,
|
|
89
|
+
indices,
|
|
90
|
+
color,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
meshes,
|
|
95
|
+
totalVertices,
|
|
96
|
+
totalTriangles,
|
|
97
|
+
coordinateInfo,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function readCoordinateInfo(reader) {
|
|
101
|
+
const originShift = readVec3(reader);
|
|
102
|
+
const originalBounds = readAABB(reader);
|
|
103
|
+
const shiftedBounds = readAABB(reader);
|
|
104
|
+
const isGeoReferenced = reader.readUint8() === 1;
|
|
105
|
+
return {
|
|
106
|
+
originShift,
|
|
107
|
+
originalBounds,
|
|
108
|
+
shiftedBounds,
|
|
109
|
+
isGeoReferenced,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function readVec3(reader) {
|
|
113
|
+
return {
|
|
114
|
+
x: reader.readFloat64(),
|
|
115
|
+
y: reader.readFloat64(),
|
|
116
|
+
z: reader.readFloat64(),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function readAABB(reader) {
|
|
120
|
+
return {
|
|
121
|
+
min: readVec3(reader),
|
|
122
|
+
max: readVec3(reader),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/sections/geometry.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAS/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAoB,EACpB,MAAkB,EAClB,aAAqB,EACrB,cAAsB,EACtB,cAA8B;IAE9B,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAClC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAEnC,wBAAwB;IACxB,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;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
5
|
+
import { BufferWriter, BufferReader } from '../utils/buffer-utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Write header and section table
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeHeader(writer: BufferWriter, header: CacheHeader, sections: SectionEntry[]): void;
|
|
10
|
+
/**
|
|
11
|
+
* Read header and section table
|
|
12
|
+
*/
|
|
13
|
+
export declare function readHeader(reader: BufferReader): CacheHeaderInfo;
|
|
14
|
+
//# sourceMappingURL=header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/sections/header.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EAGrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtE;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,YAAY,EAAE,GACvB,IAAI,CAuCN;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAyDhE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Header serialization
|
|
6
|
+
*/
|
|
7
|
+
import { MAGIC, FORMAT_VERSION, HEADER_SIZE, HeaderFlags, } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Write header and section table
|
|
10
|
+
*/
|
|
11
|
+
export function writeHeader(writer, header, sections) {
|
|
12
|
+
// Magic
|
|
13
|
+
writer.writeUint32(MAGIC);
|
|
14
|
+
// Version
|
|
15
|
+
writer.writeUint16(header.version);
|
|
16
|
+
// Flags
|
|
17
|
+
writer.writeUint16(header.flags);
|
|
18
|
+
// Source hash
|
|
19
|
+
writer.writeBigUint64(header.sourceHash);
|
|
20
|
+
// Schema
|
|
21
|
+
writer.writeUint8(header.schema);
|
|
22
|
+
// Counts
|
|
23
|
+
writer.writeUint32(header.entityCount);
|
|
24
|
+
writer.writeUint32(header.totalVertices);
|
|
25
|
+
writer.writeUint32(header.totalTriangles);
|
|
26
|
+
// Section count
|
|
27
|
+
writer.writeUint16(sections.length);
|
|
28
|
+
// Padding to 64 bytes
|
|
29
|
+
// Already written: 4 + 2 + 2 + 8 + 1 + 4 + 4 + 4 + 2 = 31 bytes
|
|
30
|
+
const padding = HEADER_SIZE - 31;
|
|
31
|
+
for (let i = 0; i < padding; i++) {
|
|
32
|
+
writer.writeUint8(0);
|
|
33
|
+
}
|
|
34
|
+
// Write section table
|
|
35
|
+
for (const section of sections) {
|
|
36
|
+
writer.writeUint16(section.type);
|
|
37
|
+
writer.writeUint16(section.flags);
|
|
38
|
+
writer.writeUint32(section.offset);
|
|
39
|
+
writer.writeUint32(section.size);
|
|
40
|
+
writer.writeUint32(section.compressedSize);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Read header and section table
|
|
45
|
+
*/
|
|
46
|
+
export function readHeader(reader) {
|
|
47
|
+
// Magic
|
|
48
|
+
const magic = reader.readUint32();
|
|
49
|
+
if (magic !== MAGIC) {
|
|
50
|
+
throw new Error(`Invalid magic bytes: expected 0x${MAGIC.toString(16)}, got 0x${magic.toString(16)}`);
|
|
51
|
+
}
|
|
52
|
+
// Version
|
|
53
|
+
const version = reader.readUint16();
|
|
54
|
+
if (version > FORMAT_VERSION) {
|
|
55
|
+
throw new Error(`Unsupported format version: ${version} (max supported: ${FORMAT_VERSION})`);
|
|
56
|
+
}
|
|
57
|
+
// Flags
|
|
58
|
+
const flags = reader.readUint16();
|
|
59
|
+
// Source hash
|
|
60
|
+
const sourceHash = reader.readBigUint64();
|
|
61
|
+
// Schema
|
|
62
|
+
const schema = reader.readUint8();
|
|
63
|
+
// Counts
|
|
64
|
+
const entityCount = reader.readUint32();
|
|
65
|
+
const totalVertices = reader.readUint32();
|
|
66
|
+
const totalTriangles = reader.readUint32();
|
|
67
|
+
// Section count
|
|
68
|
+
const sectionCount = reader.readUint16();
|
|
69
|
+
// Skip padding
|
|
70
|
+
const padding = HEADER_SIZE - 31;
|
|
71
|
+
reader.skip(padding);
|
|
72
|
+
// Read section table
|
|
73
|
+
const sections = [];
|
|
74
|
+
for (let i = 0; i < sectionCount; i++) {
|
|
75
|
+
sections.push({
|
|
76
|
+
type: reader.readUint16(),
|
|
77
|
+
flags: reader.readUint16(),
|
|
78
|
+
offset: reader.readUint32(),
|
|
79
|
+
size: reader.readUint32(),
|
|
80
|
+
compressedSize: reader.readUint32(),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
version,
|
|
85
|
+
schema,
|
|
86
|
+
sourceHash,
|
|
87
|
+
entityCount,
|
|
88
|
+
totalVertices,
|
|
89
|
+
totalTriangles,
|
|
90
|
+
hasGeometry: (flags & HeaderFlags.HasGeometry) !== 0,
|
|
91
|
+
hasSpatialHierarchy: (flags & HeaderFlags.HasSpatial) !== 0,
|
|
92
|
+
sections,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/sections/header.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;GAEG;AAEH,OAAO,EACL,KAAK,EACL,cAAc,EACd,WAAW,EAKX,WAAW,GAEZ,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,MAAoB,EACpB,MAAmB,EACnB,QAAwB;IAExB,QAAQ;IACR,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;I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,MAAM,CAAC,UAAU,EAAkB;YAC1C,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE;YAC3B,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE;YACzB,cAAc,EAAE,MAAM,CAAC,UAAU,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,OAAO;QACP,MAAM;QACN,UAAU;QACV,WAAW;QACX,aAAa;QACb,cAAc;QACd,WAAW,EAAE,CAAC,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC;QACpD,mBAAmB,EAAE,CAAC,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC;QAC3D,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PropertyTable serialization
|
|
3
|
+
*/
|
|
4
|
+
import type { PropertyTable, StringTable } from '@ifc-lite/data';
|
|
5
|
+
import { BufferWriter, BufferReader } from '../utils/buffer-utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Write PropertyTable to buffer
|
|
8
|
+
* Format:
|
|
9
|
+
* - count: uint32
|
|
10
|
+
* - entityId: Uint32Array[count]
|
|
11
|
+
* - psetName: Uint32Array[count]
|
|
12
|
+
* - psetGlobalId: Uint32Array[count]
|
|
13
|
+
* - propName: Uint32Array[count]
|
|
14
|
+
* - propType: Uint8Array[count]
|
|
15
|
+
* - valueString: Uint32Array[count]
|
|
16
|
+
* - valueReal: Float64Array[count]
|
|
17
|
+
* - valueInt: Int32Array[count]
|
|
18
|
+
* - valueBool: Uint8Array[count]
|
|
19
|
+
* - unitId: Int32Array[count]
|
|
20
|
+
* - entityIndexCount: uint32
|
|
21
|
+
* - entityIndex entries: [key:uint32, count:uint32, indices:uint32[]]...
|
|
22
|
+
*/
|
|
23
|
+
export declare function writeProperties(writer: BufferWriter, properties: PropertyTable): void;
|
|
24
|
+
/**
|
|
25
|
+
* Read PropertyTable from buffer
|
|
26
|
+
*/
|
|
27
|
+
export declare function readProperties(reader: BufferReader, strings: StringTable): PropertyTable;
|
|
28
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/sections/properties.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAe,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,GAAG,IAAI,CAoBrF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,CA2HxF"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { PropertyValueType } from '@ifc-lite/data';
|
|
5
|
+
/**
|
|
6
|
+
* Write PropertyTable to buffer
|
|
7
|
+
* Format:
|
|
8
|
+
* - count: uint32
|
|
9
|
+
* - entityId: Uint32Array[count]
|
|
10
|
+
* - psetName: Uint32Array[count]
|
|
11
|
+
* - psetGlobalId: Uint32Array[count]
|
|
12
|
+
* - propName: Uint32Array[count]
|
|
13
|
+
* - propType: Uint8Array[count]
|
|
14
|
+
* - valueString: Uint32Array[count]
|
|
15
|
+
* - valueReal: Float64Array[count]
|
|
16
|
+
* - valueInt: Int32Array[count]
|
|
17
|
+
* - valueBool: Uint8Array[count]
|
|
18
|
+
* - unitId: Int32Array[count]
|
|
19
|
+
* - entityIndexCount: uint32
|
|
20
|
+
* - entityIndex entries: [key:uint32, count:uint32, indices:uint32[]]...
|
|
21
|
+
*/
|
|
22
|
+
export function writeProperties(writer, properties) {
|
|
23
|
+
const count = properties.count;
|
|
24
|
+
writer.writeUint32(count);
|
|
25
|
+
writer.writeTypedArray(properties.entityId);
|
|
26
|
+
writer.writeTypedArray(properties.psetName);
|
|
27
|
+
writer.writeTypedArray(properties.psetGlobalId);
|
|
28
|
+
writer.writeTypedArray(properties.propName);
|
|
29
|
+
writer.writeTypedArray(properties.propType);
|
|
30
|
+
writer.writeTypedArray(properties.valueString);
|
|
31
|
+
writer.writeTypedArray(properties.valueReal);
|
|
32
|
+
writer.writeTypedArray(properties.valueInt);
|
|
33
|
+
writer.writeTypedArray(properties.valueBool);
|
|
34
|
+
writer.writeTypedArray(properties.unitId);
|
|
35
|
+
// Write entity index
|
|
36
|
+
writeIndex(writer, properties.entityIndex);
|
|
37
|
+
writeIndex(writer, properties.psetIndex);
|
|
38
|
+
writeIndex(writer, properties.propIndex);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Read PropertyTable from buffer
|
|
42
|
+
*/
|
|
43
|
+
export function readProperties(reader, strings) {
|
|
44
|
+
const count = reader.readUint32();
|
|
45
|
+
const entityId = reader.readUint32Array(count);
|
|
46
|
+
const psetName = reader.readUint32Array(count);
|
|
47
|
+
const psetGlobalId = reader.readUint32Array(count);
|
|
48
|
+
const propName = reader.readUint32Array(count);
|
|
49
|
+
const propType = reader.readUint8Array(count);
|
|
50
|
+
const valueString = reader.readUint32Array(count);
|
|
51
|
+
const valueReal = reader.readFloat64Array(count);
|
|
52
|
+
const valueInt = reader.readInt32Array(count);
|
|
53
|
+
const valueBool = reader.readUint8Array(count);
|
|
54
|
+
const unitId = reader.readInt32Array(count);
|
|
55
|
+
const entityIndex = readIndex(reader);
|
|
56
|
+
const psetIndex = readIndex(reader);
|
|
57
|
+
const propIndex = readIndex(reader);
|
|
58
|
+
const getPropertyValue = (idx) => {
|
|
59
|
+
const type = propType[idx];
|
|
60
|
+
switch (type) {
|
|
61
|
+
case PropertyValueType.String:
|
|
62
|
+
case PropertyValueType.Label:
|
|
63
|
+
case PropertyValueType.Identifier:
|
|
64
|
+
case PropertyValueType.Text:
|
|
65
|
+
case PropertyValueType.Enum:
|
|
66
|
+
return valueString[idx] >= 0 ? strings.get(valueString[idx]) : null;
|
|
67
|
+
case PropertyValueType.Real:
|
|
68
|
+
return valueReal[idx];
|
|
69
|
+
case PropertyValueType.Integer:
|
|
70
|
+
return valueInt[idx];
|
|
71
|
+
case PropertyValueType.Boolean:
|
|
72
|
+
case PropertyValueType.Logical:
|
|
73
|
+
const boolVal = valueBool[idx];
|
|
74
|
+
return boolVal === 255 ? null : boolVal === 1;
|
|
75
|
+
case PropertyValueType.List:
|
|
76
|
+
const listStr = strings.get(valueString[idx]);
|
|
77
|
+
try {
|
|
78
|
+
return JSON.parse(listStr);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
default:
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
count,
|
|
89
|
+
entityId,
|
|
90
|
+
psetName,
|
|
91
|
+
psetGlobalId,
|
|
92
|
+
propName,
|
|
93
|
+
propType,
|
|
94
|
+
valueString,
|
|
95
|
+
valueReal,
|
|
96
|
+
valueInt,
|
|
97
|
+
valueBool,
|
|
98
|
+
unitId,
|
|
99
|
+
entityIndex,
|
|
100
|
+
psetIndex,
|
|
101
|
+
propIndex,
|
|
102
|
+
getForEntity: (id) => {
|
|
103
|
+
const rowIndices = entityIndex.get(id) || [];
|
|
104
|
+
const psets = new Map();
|
|
105
|
+
for (const idx of rowIndices) {
|
|
106
|
+
const psetNameStr = strings.get(psetName[idx]);
|
|
107
|
+
const psetGlobalIdStr = strings.get(psetGlobalId[idx]);
|
|
108
|
+
if (!psets.has(psetNameStr)) {
|
|
109
|
+
psets.set(psetNameStr, {
|
|
110
|
+
name: psetNameStr,
|
|
111
|
+
globalId: psetGlobalIdStr,
|
|
112
|
+
properties: [],
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const pset = psets.get(psetNameStr);
|
|
116
|
+
const propNameStr = strings.get(propName[idx]);
|
|
117
|
+
pset.properties.push({
|
|
118
|
+
name: propNameStr,
|
|
119
|
+
type: propType[idx],
|
|
120
|
+
value: getPropertyValue(idx),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return Array.from(psets.values());
|
|
124
|
+
},
|
|
125
|
+
getPropertyValue: (id, pset, prop) => {
|
|
126
|
+
const rowIndices = entityIndex.get(id) || [];
|
|
127
|
+
const psetIdx = strings.indexOf(pset);
|
|
128
|
+
const propIdx = strings.indexOf(prop);
|
|
129
|
+
for (const idx of rowIndices) {
|
|
130
|
+
if (psetName[idx] === psetIdx && propName[idx] === propIdx) {
|
|
131
|
+
return getPropertyValue(idx);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
},
|
|
136
|
+
findByProperty: (prop, operator, value) => {
|
|
137
|
+
const propIdx = strings.indexOf(prop);
|
|
138
|
+
if (propIdx < 0)
|
|
139
|
+
return [];
|
|
140
|
+
const rowIndices = propIndex.get(propIdx) || [];
|
|
141
|
+
const results = [];
|
|
142
|
+
for (const idx of rowIndices) {
|
|
143
|
+
const propValue = getPropertyValue(idx);
|
|
144
|
+
if (compareValues(propValue, operator, value)) {
|
|
145
|
+
results.push(entityId[idx]);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return results;
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function compareValues(propValue, operator, value) {
|
|
153
|
+
if (propValue === null || value === null)
|
|
154
|
+
return false;
|
|
155
|
+
if (typeof propValue === 'number' && typeof value === 'number') {
|
|
156
|
+
switch (operator) {
|
|
157
|
+
case '>=': return propValue >= value;
|
|
158
|
+
case '>': return propValue > value;
|
|
159
|
+
case '<=': return propValue <= value;
|
|
160
|
+
case '<': return propValue < value;
|
|
161
|
+
case '=':
|
|
162
|
+
case '==': return propValue === value;
|
|
163
|
+
case '!=': return propValue !== value;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (typeof propValue === 'string' && typeof value === 'string') {
|
|
167
|
+
switch (operator) {
|
|
168
|
+
case '=':
|
|
169
|
+
case '==': return propValue === value;
|
|
170
|
+
case '!=': return propValue !== value;
|
|
171
|
+
case 'contains': return propValue.includes(value);
|
|
172
|
+
case 'startsWith': return propValue.startsWith(value);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
function writeIndex(writer, index) {
|
|
178
|
+
writer.writeUint32(index.size);
|
|
179
|
+
for (const [key, values] of index) {
|
|
180
|
+
writer.writeUint32(key);
|
|
181
|
+
writer.writeUint32(values.length);
|
|
182
|
+
for (const v of values) {
|
|
183
|
+
writer.writeUint32(v);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function readIndex(reader) {
|
|
188
|
+
const size = reader.readUint32();
|
|
189
|
+
const index = new Map();
|
|
190
|
+
for (let i = 0; i < size; i++) {
|
|
191
|
+
const key = reader.readUint32();
|
|
192
|
+
const valueCount = reader.readUint32();
|
|
193
|
+
const values = [];
|
|
194
|
+
for (let j = 0; j < valueCount; j++) {
|
|
195
|
+
values.push(reader.readUint32());
|
|
196
|
+
}
|
|
197
|
+
index.set(key, values);
|
|
198
|
+
}
|
|
199
|
+
return index;
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/sections/properties.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAO/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB,EAAE,UAAyB;IAC7E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