Skip to content

Commit

Permalink
fix: correct indexer check bug
Browse files Browse the repository at this point in the history
  • Loading branch information
agviegas committed Jul 19, 2024
1 parent db352b7 commit b4cab8e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 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.9",
"version": "2.1.11",
"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.9";
static readonly release = "2.1.11";

/** {@link Disposable.onDisposed} */
readonly onDisposed = new Event<void>();
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/fragments/Classifier/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export class Classifier extends Component implements Disposable {
*/
async bySpatialStructure(
model: FRAGS.FragmentsGroup,
config: { useProperties?: boolean; isolate?: Set<number> },
config: { useProperties?: boolean; isolate?: Set<number> } = {},
) {
const indexer = this.components.get(IfcRelationsIndexer);
const modelRelations = indexer.relationMaps[model.uuid];
Expand All @@ -368,8 +368,8 @@ export class Classifier extends Component implements Disposable {
const systemName = "spatialStructures";

// If useProperties is undefined, use properties by default
const propsUndefined = config.useProperties === undefined;
const useProperties = propsUndefined || config.useProperties;
const noProps = config.useProperties === undefined;
const useProperties = noProps || config.useProperties;

for (const [expressID] of modelRelations) {
// E.g. if the user just wants the building storeys
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/fragments/Hider/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ In this tutorial, we will import:

import Stats from "stats.js";
import * as BUI from "@thatopen/ui";
import * as WEBIFC from "web-ifc";
import * as OBC from "@thatopen/components";

/* MD
Expand Down Expand Up @@ -109,7 +110,9 @@ const hider = components.get(OBC.Hider);

const classifier = components.get(OBC.Classifier);
classifier.byEntity(model);
await classifier.bySpatialStructure(model);
await classifier.bySpatialStructure(model, {
isolate: new Set([WEBIFC.IFCBUILDINGSTOREY]),
});

/* MD
### ⏱️ Measuring the performance (optional)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/ifc/IfcRelationsIndexer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export class IfcRelationsIndexer extends Component implements Disposable {
}
const entityRelations = indexMap.get(expressID);
const attributeIndex = this.getAttributeIndex(relationName);
if (!(entityRelations && attributeIndex)) {
if (entityRelations === undefined || attributeIndex === null) {
return null;
}
const relations = entityRelations.get(attributeIndex);
Expand Down

0 comments on commit b4cab8e

Please sign in to comment.