@thatopen/components 2.0.0-alpha.2 → 2.0.0-alpha.4

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.
@@ -40,7 +40,7 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
40
40
  * has to be `true` for this to apply.
41
41
  */
42
42
  toleranceOrthogonalY: number;
43
- planes: T[];
43
+ list: T[];
44
44
  protected PlaneType: new (...args: any) => SimplePlane | T;
45
45
  /** The material used in all the clipping planes. */
46
46
  protected _material: THREE.Material;
@@ -63,7 +63,7 @@ export interface Updateable {
63
63
  * Function used to update the state of this component each frame. For
64
64
  * instance, a renderer component will make a render each frame.
65
65
  */
66
- update(delta?: number): void | Promise<void>;
66
+ update(delta?: number): void;
67
67
  }
68
68
  /** Basic type to describe the progress of any kind of process. */
69
69
  export interface Progress {
@@ -78,31 +78,20 @@ export interface Progress {
78
78
  * dimensions.
79
79
  */
80
80
  export interface Createable {
81
- readonly onBeforeCreate: Event<any>;
82
81
  /** Creates a new instance of an element (e.g. a new Dimension). */
83
82
  create: (data: any) => void;
84
- /** Fired after successfully calling {@link Createable.create} */
85
- readonly onAfterCreate: Event<any>;
86
83
  /**
87
84
  * Finish the creation process of the component, successfully creating an
88
85
  * instance of whatever the component creates.
89
86
  */
90
- endCreation: (data: any) => void;
91
- /** Fired before calling {@link Createable.cancelCreation}. */
92
- readonly onBeforeCancel: Event<any>;
87
+ endCreation?: (data: any) => void;
93
88
  /**
94
89
  * Cancels the creation process of the component, going back to the state
95
90
  * before starting to create.
96
91
  */
97
- cancelCreation: (data: any) => void;
98
- /** Fired after calling {@link Createable.cancelCreation}. */
99
- readonly onAfterCancel: Event<any>;
100
- /** Fired before calling {@link Createable.delete}. */
101
- readonly onBeforeDelete: Event<any>;
92
+ cancelCreation?: (data: any) => void;
102
93
  /** Deletes an existing instance of an element (e.g. a Dimension). */
103
94
  delete: (data: any) => void;
104
- /** Fired after successfully calling {@link Createable.delete()} */
105
- readonly onAfterDelete: Event<any>;
106
95
  }
107
96
  /**
108
97
  * Whether this component supports to be configured.
@@ -0,0 +1,10 @@
1
+ import * as FRAGS from "bim-fragment";
2
+ import { Components, Component } from "../../core";
3
+ export declare class FragmentHider extends Component {
4
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
5
+ enabled: boolean;
6
+ constructor(components: Components);
7
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
8
+ isolate(items: FRAGS.FragmentIdMap): void;
9
+ private updateCulledVisibility;
10
+ }
@@ -1,5 +1,7 @@
1
1
  export * from "./FragmentBoundingBox";
2
2
  export * from "./FragmentClassifier";
3
+ export * from "./FragmentExploder";
4
+ export * from "./FragmentHider";
3
5
  export * from "./FragmentIfcLoader";
4
6
  export * from "./FragmentIfcStreamer";
5
7
  export * from "./FragmentManager";
@@ -1,31 +1,77 @@
1
1
  import { FragmentsGroup } from "bim-fragment";
2
2
  import { Disposable, Event, Component, Components } from "../../core";
3
- import { IfcPropertiesManager } from "../IfcPropertiesManager";
4
- interface IndexMap {
5
- [modelID: string]: {
6
- [expressID: string]: Set<number>;
7
- };
3
+ interface RelationMap {
4
+ [modelID: string]: Map<number, Map<number, number[]>>;
8
5
  }
9
6
  export declare class IfcPropertiesIndexer extends Component implements Disposable {
10
7
  static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
11
8
  /** {@link Disposable.onDisposed} */
12
9
  readonly onDisposed: Event<string>;
13
10
  enabled: boolean;
14
- relationsToProcess: number[];
15
- indexMap: IndexMap;
16
- private _propertiesManager;
17
- readonly onPropertiesManagerSet: Event<IfcPropertiesManager>;
18
- set propertiesManager(manager: IfcPropertiesManager | null);
19
- get propertiesManager(): IfcPropertiesManager | null;
11
+ /**
12
+ * All the inverse attributes this component can processes.
13
+ */
14
+ readonly inverseAttributes: string[];
15
+ inverseAttributesToProcess: string[];
16
+ private _relToAttributesMap;
17
+ readonly relationMaps: RelationMap;
20
18
  constructor(components: Components);
21
19
  private onFragmentsDisposed;
22
- dispose(): Promise<void>;
23
- getProperties(model: FragmentsGroup, id: string): Promise<any[] | null>;
24
- private getNestedPsets;
25
- private getPsetProperties;
26
- process(model: FragmentsGroup): Promise<void>;
27
- private setEntityIndex;
28
- private cloneProperty;
29
- private clonePropertyArray;
20
+ private getAttributeRels;
21
+ private setRelMap;
22
+ /**
23
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
24
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
25
+ * and maps them in a structured way to facilitate quick access to related entities.
26
+ *
27
+ * The process involves querying the model for each relation type associated with the inverse attributes
28
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
29
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
30
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
31
+ * of entities that are related through that attribute.
32
+ *
33
+ * @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
34
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
35
+ * representation of the relations indexed by entity expressIDs and relation types.
36
+ * @throws An error if the model does not have properties loaded.
37
+ */
38
+ process(model: FragmentsGroup): Promise<Map<number, Map<number, number[]>>>;
39
+ /**
40
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
41
+ * This method searches the indexed relation maps for the specified model and entity,
42
+ * returning the IDs of related entities if a match is found.
43
+ *
44
+ * @param model The `FragmentsGroup` model containing the entity.
45
+ * @param expressID The unique identifier of the entity within the model.
46
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
47
+ * @returns An array of express IDs representing the related entities, or `null` if no relations are found
48
+ * or the specified relation name is not indexed.
49
+ */
50
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: string): number[] | null;
51
+ /**
52
+ * Serializes the relations of a specific model into a JSON string.
53
+ * This method iterates through the relations indexed for the given model,
54
+ * organizing them into a structured object where each key is an expressID of an entity,
55
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
56
+ * The resulting object is then serialized into a JSON string.
57
+ *
58
+ * @param model The `FragmentsGroup` model whose relations are to be serialized.
59
+ * @returns A JSON string representing the serialized relations of the specified model.
60
+ * If the model has no indexed relations, `null` is returned.
61
+ */
62
+ serializeModelRelations(model: FragmentsGroup): string | null;
63
+ /**
64
+ * Serializes all relations of every model processed by the indexer into a JSON string.
65
+ * This method iterates through each model's relations indexed in `relationMaps`, organizing them
66
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
67
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
68
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
69
+ *
70
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
71
+ * If no relations have been indexed, an empty object is returned as a JSON string.
72
+ */
73
+ serializeRelations(): string;
74
+ getRelationsMapFromJSON(json: string): Map<number, Map<number, number[]>>;
75
+ dispose(): void;
30
76
  }
31
77
  export {};