Skip to content

Commit

Permalink
feat(core): adds GUID to FragmentIdMap functionality to FragmentsManager
Browse files Browse the repository at this point in the history
  • Loading branch information
HoyosJuan committed Aug 12, 2024
1 parent 529ca55 commit 5de15cc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/core/src/fragments/FragmentsManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,26 @@ export class FragmentsManager extends Component implements Disposable {
return fragmentIdMap;
}

/**
* Converts a collection of IFC GUIDs to a fragmentIdMap.
*
* @param guids - An iterable collection of global IDs to be converted to a fragment ID map.
*
* @returns A fragment ID map, where the keys are fragment IDs and the values are the corresponding express IDs.
*/
guidToFragmentIdMap(guids: Iterable<string>) {
const modelIdMap: { [modelID: string]: Set<number> } = {};
for (const [id, model] of this.groups) {
if (!(id in modelIdMap)) modelIdMap[id] = new Set();
for (const globalId of guids) {
const expressID = model.globalToExpressIDs.get(globalId);
if (expressID) modelIdMap[id].add(expressID);
}
}
const fragmentIdMap = this.modelIdToFragmentIdMap(modelIdMap);
return fragmentIdMap;
}

/**
* Applies coordinate transformation to the provided models.
* If no models are provided, all groups are used.
Expand Down

0 comments on commit 5de15cc

Please sign in to comment.