@thatopen/components 2.0.0-alpha.5 → 2.0.0-alpha.7
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.
- package/dist/core/Cullers/src/culler-renderer.d.ts +3 -2
- package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +1 -0
- package/dist/core/Types/src/async-event.d.ts +34 -0
- package/dist/core/Types/src/index.d.ts +1 -0
- package/dist/ifc/IfcRelationsIndexer/index.d.ts +106 -0
- package/dist/ifc/index.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +1245 -1110
- package/dist/namespace.d.ts +840 -729
- package/package.json +2 -2
- package/dist/ifc/IfcPropertiesIndexer/index.d.ts +0 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import { Components } from "../../Components";
|
|
3
|
-
import { Event, World } from "../../Types";
|
|
3
|
+
import { AsyncEvent, Event, World } from "../../Types";
|
|
4
4
|
export interface CullerRendererSettings {
|
|
5
5
|
updateInterval?: number;
|
|
6
6
|
width?: number;
|
|
@@ -18,7 +18,7 @@ export declare class CullerRenderer {
|
|
|
18
18
|
* meshes that are currently visible, and the ones that were visible
|
|
19
19
|
* just before but not anymore.
|
|
20
20
|
*/
|
|
21
|
-
readonly onViewUpdated: Event<any>;
|
|
21
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
22
22
|
/** {@link Component.enabled} */
|
|
23
23
|
enabled: boolean;
|
|
24
24
|
/**
|
|
@@ -44,6 +44,7 @@ export declare class CullerRenderer {
|
|
|
44
44
|
private readonly renderTarget;
|
|
45
45
|
private readonly bufferSize;
|
|
46
46
|
private readonly _buffer;
|
|
47
|
+
protected _isWorkerBusy: boolean;
|
|
47
48
|
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
48
49
|
/** {@link Disposable.dispose} */
|
|
49
50
|
dispose(): void;
|
|
@@ -17,6 +17,7 @@ export declare class MeshCullerRenderer extends CullerRenderer {
|
|
|
17
17
|
private _meshIDColorCodeMap;
|
|
18
18
|
private _currentVisibleMeshes;
|
|
19
19
|
private _recentlyHiddenMeshes;
|
|
20
|
+
private _intervalID;
|
|
20
21
|
private readonly _transparentMat;
|
|
21
22
|
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
22
23
|
dispose(): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple event handler by
|
|
3
|
+
* [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
|
|
4
|
+
* Keep in mind that:
|
|
5
|
+
* - If you want to remove it later, you might want to declare the callback as
|
|
6
|
+
* an object.
|
|
7
|
+
* - If you want to maintain the reference to `this`, you will need to declare
|
|
8
|
+
* the callback as an arrow function.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AsyncEvent<T> {
|
|
11
|
+
/**
|
|
12
|
+
* Add a callback to this event instance.
|
|
13
|
+
* @param handler - the callback to be added to this event.
|
|
14
|
+
*/
|
|
15
|
+
add(handler: T extends void ? {
|
|
16
|
+
(): Promise<void>;
|
|
17
|
+
} : {
|
|
18
|
+
(data: T): Promise<void>;
|
|
19
|
+
}): void;
|
|
20
|
+
/**
|
|
21
|
+
* Removes a callback from this event instance.
|
|
22
|
+
* @param handler - the callback to be removed from this event.
|
|
23
|
+
*/
|
|
24
|
+
remove(handler: T extends void ? {
|
|
25
|
+
(): Promise<void>;
|
|
26
|
+
} : {
|
|
27
|
+
(data: T): Promise<void>;
|
|
28
|
+
}): void;
|
|
29
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
30
|
+
trigger: (data?: T) => Promise<void>;
|
|
31
|
+
/** Gets rid of all the suscribed events. */
|
|
32
|
+
reset(): void;
|
|
33
|
+
private handlers;
|
|
34
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
2
|
+
import { Disposable, Event, Component, Components } from "../../core";
|
|
3
|
+
interface RelationMap {
|
|
4
|
+
[modelID: string]: Map<number, Map<number, number[]>>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
|
|
8
|
+
* It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations.
|
|
9
|
+
*/
|
|
10
|
+
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
11
|
+
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
12
|
+
/** {@link Disposable.onDisposed} */
|
|
13
|
+
readonly onDisposed: Event<string>;
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* All the inverse attributes this component can processes.
|
|
17
|
+
*/
|
|
18
|
+
readonly inverseAttributes: string[];
|
|
19
|
+
inverseAttributesToProcess: string[];
|
|
20
|
+
private _relToAttributesMap;
|
|
21
|
+
/**
|
|
22
|
+
* Holds the relationship mappings for each model processed by the indexer.
|
|
23
|
+
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
24
|
+
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
25
|
+
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
26
|
+
* that are related through that relation type. This structure allows for efficient querying
|
|
27
|
+
* of entity relationships within a model.
|
|
28
|
+
*/
|
|
29
|
+
readonly relationMaps: RelationMap;
|
|
30
|
+
constructor(components: Components);
|
|
31
|
+
private onFragmentsDisposed;
|
|
32
|
+
private getAttributeRels;
|
|
33
|
+
private setRelMap;
|
|
34
|
+
/**
|
|
35
|
+
* Processes a given model to index its IFC entities relations based on predefined inverse attributes.
|
|
36
|
+
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
37
|
+
* and maps them in a structured way to facilitate quick access to related entities.
|
|
38
|
+
*
|
|
39
|
+
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
40
|
+
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
41
|
+
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
42
|
+
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
43
|
+
* of entities that are related through that attribute.
|
|
44
|
+
*
|
|
45
|
+
* @param model The `FragmentsGroup` model to be processed. It must have properties loaded.
|
|
46
|
+
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
47
|
+
* representation of the relations indexed by entity expressIDs and relation types.
|
|
48
|
+
* @throws An error if the model does not have properties loaded.
|
|
49
|
+
*/
|
|
50
|
+
process(model: FragmentsGroup): Promise<Map<number, Map<number, number[]>>>;
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves the relations of a specific entity within a model based on the given relation name.
|
|
53
|
+
* This method searches the indexed relation maps for the specified model and entity,
|
|
54
|
+
* returning the IDs of related entities if a match is found.
|
|
55
|
+
*
|
|
56
|
+
* @param model The `FragmentsGroup` model containing the entity.
|
|
57
|
+
* @param expressID The unique identifier of the entity within the model.
|
|
58
|
+
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
59
|
+
* @returns An array of express IDs representing the related entities, or `null` if no relations are found
|
|
60
|
+
* or the specified relation name is not indexed.
|
|
61
|
+
*/
|
|
62
|
+
getEntityRelations(model: FragmentsGroup, expressID: number, relationName: string): number[] | null;
|
|
63
|
+
/**
|
|
64
|
+
* Serializes the relations of a specific model into a JSON string.
|
|
65
|
+
* This method iterates through the relations indexed for the given model,
|
|
66
|
+
* organizing them into a structured object where each key is an expressID of an entity,
|
|
67
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
68
|
+
* The resulting object is then serialized into a JSON string.
|
|
69
|
+
*
|
|
70
|
+
* @param model The `FragmentsGroup` model whose relations are to be serialized.
|
|
71
|
+
* @returns A JSON string representing the serialized relations of the specified model.
|
|
72
|
+
* If the model has no indexed relations, `null` is returned.
|
|
73
|
+
*/
|
|
74
|
+
serializeModelRelations(model: FragmentsGroup): string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
77
|
+
* This method iterates through each model's relations indexed in `relationMaps`, organizing them
|
|
78
|
+
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
79
|
+
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
80
|
+
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
81
|
+
*
|
|
82
|
+
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
83
|
+
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
84
|
+
*/
|
|
85
|
+
serializeRelations(): string;
|
|
86
|
+
/**
|
|
87
|
+
* Converts a JSON string representing relations between entities into a structured map.
|
|
88
|
+
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
89
|
+
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
90
|
+
* and the values are maps where each key is a relation type ID and its value is an array
|
|
91
|
+
* of express IDs of entities related through that relation type.
|
|
92
|
+
*
|
|
93
|
+
* @param json The JSON string to be parsed into the relations map.
|
|
94
|
+
* @returns A `Map` where the key is the express ID of an entity as a number, and the value
|
|
95
|
+
* is another `Map`. This inner map's key is the relation type ID as a number, and its value
|
|
96
|
+
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
97
|
+
*/
|
|
98
|
+
getRelationsMapFromJSON(json: string): Map<number, Map<number, number[]>>;
|
|
99
|
+
/**
|
|
100
|
+
* Disposes the component, cleaning up resources and detaching event listeners.
|
|
101
|
+
* This ensures that the component is properly cleaned up and does not leave behind any
|
|
102
|
+
* references that could prevent garbage collection.
|
|
103
|
+
*/
|
|
104
|
+
dispose(): void;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
package/dist/ifc/index.d.ts
CHANGED