Skip to main content

Classifier

The Classifier component is responsible for grouping items from different models based on criteria. 📕 Tutorial. 📘 API.

Extends

Implements

Properties

enabled

enabled: boolean = true

Component.enabled

Overrides

Component . enabled


list

readonly list: DataMap<string, DataMap<string, ClassificationGroupData>>

A nested data map that organizes classification groups. The outer map uses strings as keys, and the inner map contains ClassificationGroupData, also keyed by strings.


onDisposed

readonly onDisposed: Event<unknown>

Disposable.onDisposed

Implementation of

Disposable . onDisposed


uuid

static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7"

A unique identifier for the component. This UUID is used to register the component within the Components system.

Methods

addGroupItems()

addGroupItems(classification, group, items): void

Adds items to a specific group within a classification.

Parameters

ParameterTypeDescription
classificationstringThe classification to which the group belongs.
groupstringThe group to which the items will be added.
itemsModelIdMapA map of model IDs to add to the group.

Returns

void


aggregateItemRelations()

aggregateItemRelations(classification, query, relation, config?): Promise<void>

From the items passing the query, use the specified relation to create groupings This method retrieves and processes related items, applying a custom aggregation callback to register relations between items based on their attributes and local IDs.

Parameters

ParameterTypeDescription
classificationstringThe classification type used to filter items.
queryItemsQueryParamsQuery parameters for filtering items, defined by FRAGS.ItemsQueryParams.
relationstringThe type of relation to aggregate (e.g., "ContainedInStructure", "HasAssociations").
config?ClassifyItemRelationsConfigOptional configuration for the aggregation process.

Returns

Promise<void>

A promise that resolves when the aggregation process is complete.

Remarks

  • The aggregationCallback function processes each item and registers relations based on the item's attribute value and the local ID of its relations.
  • Items without the specified attribute or relations are ignored during aggregation.

aggregateItems()

aggregateItems(classification, query, config?): Promise<void>

Aggregates items based on a classification and query, applying a provided function to each item.

Parameters

ParameterTypeDescription
classificationstringThe classification string used to categorize the items.
queryItemsQueryParamsThe query parameters used to find items.
config?objectOptional configuration for data and item processing.
config.aggregationCallback?(item, register) => void

Optional function to apply to each item; defaults to this.defaultSaveFunction if not provided.

This function receives the item data and a register function to associate item local IDs with names.

If no function is provided, the default save function is used.

config.data?Partial<ItemsDataConfig>Optional data configuration to pass to the item retrieval.
config.modelIds?RegExp[]-

Returns

Promise<void>

Remarks

The register function within the config.func allows associating item local IDs with a given name under the specified classification. It is used to keep track of which items belong to which classification.


byCategory()

byCategory(config?): Promise<void>

Asynchronously processes and adds classifications by category.

Parameters

ParameterTypeDescription
config?AddClassificationConfigOptional configuration for adding classifications.

Returns

Promise<void>

A promise that resolves once the categories have been processed and added.


byIfcBuildingStorey()

byIfcBuildingStorey(config?): Promise<void>

Asynchronously processes and adds classifications by IfcBuildingStorey.

Parameters

ParameterTypeDescription
config?AddClassificationConfigOptional configuration for adding classifications.

Returns

Promise<void>

A promise that resolves once the storeys have been processed and added.


byModel()

byModel(config?): Promise<void>

Asynchronously processes models based on the provided configuration and updates classification groups.

Parameters

ParameterTypeDescription
config?AddClassificationConfigOptional configuration for adding classifications. Contains the following properties.

Returns

Promise<void>

A promise that resolves when the processing is complete.


defaultSaveFunction()

defaultSaveFunction(item): null | string

The default save function used by the classifier. It extracts the 'value' property from the item's Name and returns it as a string. If the 'value' property does not exist, it returns null.

Parameters

ParameterTypeDescription
itemItemDataThe item data to extract the value from.

Returns

null | string

The extracted value as a string, or null if the value does not exist.


dispose()

dispose(): void

Disposable.dispose

Returns

void

Implementation of

Disposable . dispose


find()

find(data): Promise <ModelIdMap>

Asynchronously finds a set of ModelIdMaps based on the provided classification data.

Parameters

ParameterTypeDescription
dataClassifierIntersectionInputAn object with classifications as keys and an array of groups as values.

Returns

Promise <ModelIdMap>

A promise that resolves to a ModelIdMap representing the intersection of all ModelIdMaps found.


getGroupData()

getGroupData(classification, group): ClassificationGroupData

Retrieves data associated with a specific group within a classification. If the group data does not exist, it creates a new entry.

Parameters

ParameterTypeDescription
classificationstringThe classification string.
groupstringThe group string within the classification.

Returns

ClassificationGroupData

The data object associated with the group, containing a map and a get method.


isConfigurable()

isConfigurable(): this is Configurable<any, any>

Whether is component is Configurable.

Returns

this is Configurable<any, any>

Inherited from

Component . isConfigurable


isDisposeable()

isDisposeable(): this is Disposable

Whether is component is Disposable.

Returns

this is Disposable

Inherited from

Component . isDisposeable


isHideable()

isHideable(): this is Hideable

Whether is component is Hideable.

Returns

this is Hideable

Inherited from

Component . isHideable


isResizeable()

isResizeable(): this is Resizeable

Whether is component is Resizeable.

Returns

this is Resizeable

Inherited from

Component . isResizeable


isUpdateable()

isUpdateable(): this is Updateable

Whether is component is Updateable.

Returns

this is Updateable

Inherited from

Component . isUpdateable


removeItems()

removeItems(modelIdMap, config?): void

Removes items from the classifier based on the provided model ID map and configuration.

Parameters

ParameterTypeDescription
modelIdMapModelIdMapA map containing model IDs to be removed.
config?RemoveClassifierItemsConfigOptional configuration for removing items.s.

Returns

void

Remarks

If no configuration is provided, items will be removed from all classifications


setGroupQuery()

setGroupQuery(classification, group, query): void

Sets the query for a specific group within a classification.

Parameters

ParameterTypeDescription
classificationstringThe classification to target.
groupstringThe group within the classification to target.
queryClassificationGroupQueryThe query to set for the group.

Returns

void