Skip to content

Commit

Permalink
fix(main): make isStreamed property available in fragment load event
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Jul 28, 2024
1 parent ada621e commit 9ca135e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components",
"description": "Collection of core functionalities to author BIM apps.",
"version": "2.1.15",
"version": "2.1.16",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/core/Components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Components implements Disposable {
/**
* The version of the @thatopen/components library.
*/
static readonly release = "2.1.15";
static readonly release = "2.1.16";

/** {@link Disposable.onDisposed} */
readonly onDisposed = new Event<void>();
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/fragments/FragmentsManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class FragmentsManager extends Component implements Disposable {
* Loads a binary file that contain fragment geometry.
* @param data - The binary data to load.
* @param config - Optional configuration for loading.
* @param config.isStreamed - Optional setting to determine whether this model is streamed or not.
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
* @returns The loaded FragmentsGroup.
Expand All @@ -121,6 +122,7 @@ export class FragmentsManager extends Component implements Disposable {
name: string;
properties: FRAGS.IfcProperties;
relationsMap: RelationsMap;
isStreamed?: boolean;
}>,
) {
const defaultConfig: {
Expand All @@ -132,6 +134,9 @@ export class FragmentsManager extends Component implements Disposable {
const _config = { ...defaultConfig, ...config };
const { coordinate, name, properties, relationsMap } = _config;
const model = this._loader.import(data);
if (config) {
model.isStreamed = config.isStreamed || false;
}
if (name) model.name = name;
for (const fragment of model.items) {
fragment.group = model;
Expand Down
2 changes: 1 addition & 1 deletion packages/front/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thatopen/components-front",
"description": "Collection of frontend tools to author BIM apps.",
"version": "2.1.11",
"version": "2.1.12",
"author": "That Open Company",
"contributors": [
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
Expand Down
3 changes: 1 addition & 2 deletions packages/front/src/fragments/IfcStreamer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,10 @@ export class IfcStreamer extends OBC.Component implements OBC.Disposable {
const groupArrayBuffer = await groupData.arrayBuffer();
const groupBuffer = new Uint8Array(groupArrayBuffer);
const fragments = this.components.get(OBC.FragmentsManager);
const group = fragments.load(groupBuffer, { coordinate });
const group = fragments.load(groupBuffer, { coordinate, isStreamed: true });

group.name = globalDataFileId.replace("-processed-global", "");

group.isStreamed = true;
this.world.scene.three.add(group);

const { opaque, transparent } = group.geometryIDs;
Expand Down

0 comments on commit 9ca135e

Please sign in to comment.