@thatopen/components 2.1.16 → 2.1.17
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/Components/index.d.ts +1 -1
- package/dist/core/Types/src/data-map.d.ts +42 -0
- package/dist/core/Types/src/data-set.d.ts +38 -0
- package/dist/fragments/FragmentsManager/index.d.ts +13 -5
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +383 -301
- package/dist/namespace.d.ts +2335 -2247
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export declare class Components implements Disposable {
|
|
|
6
6
|
/**
|
|
7
7
|
* The version of the @thatopen/components library.
|
|
8
8
|
*/
|
|
9
|
-
static readonly release = "2.1.
|
|
9
|
+
static readonly release = "2.1.17";
|
|
10
10
|
/** {@link Disposable.onDisposed} */
|
|
11
11
|
readonly onDisposed: Event<void>;
|
|
12
12
|
/**
|
|
@@ -1,18 +1,60 @@
|
|
|
1
1
|
import { Event } from "./event";
|
|
2
|
+
/**
|
|
3
|
+
* A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
|
|
4
|
+
*
|
|
5
|
+
* @template K - The type of keys in the map.
|
|
6
|
+
* @template V - The type of values in the map.
|
|
7
|
+
*/
|
|
2
8
|
export declare class DataMap<K, V> extends Map<K, V> {
|
|
9
|
+
/**
|
|
10
|
+
* An event triggered when a new item is set in the map.
|
|
11
|
+
*/
|
|
3
12
|
readonly onItemSet: Event<{
|
|
4
13
|
key: K;
|
|
5
14
|
value: V;
|
|
6
15
|
}>;
|
|
16
|
+
/**
|
|
17
|
+
* An event triggered when an existing item in the map is updated.
|
|
18
|
+
*/
|
|
7
19
|
readonly onItemUpdated: Event<{
|
|
8
20
|
key: K;
|
|
9
21
|
value: V;
|
|
10
22
|
}>;
|
|
23
|
+
/**
|
|
24
|
+
* An event triggered when an item is deleted from the map.
|
|
25
|
+
*/
|
|
11
26
|
readonly onItemDeleted: Event<unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* An event triggered when the map is cleared.
|
|
29
|
+
*/
|
|
12
30
|
readonly onCleared: Event<unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a new DataMap instance.
|
|
33
|
+
*
|
|
34
|
+
* @param iterable - An iterable object containing key-value pairs to populate the map.
|
|
35
|
+
*/
|
|
13
36
|
constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
|
|
37
|
+
/**
|
|
38
|
+
* Clears the map and triggers the onCleared event.
|
|
39
|
+
*/
|
|
14
40
|
clear(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
|
|
43
|
+
*
|
|
44
|
+
* @param key - The key of the item to set.
|
|
45
|
+
* @param value - The value of the item to set.
|
|
46
|
+
* @returns The DataMap instance.
|
|
47
|
+
*/
|
|
15
48
|
set(key: K, value: V): this;
|
|
49
|
+
/**
|
|
50
|
+
* Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
|
|
51
|
+
*
|
|
52
|
+
* @param key - The key of the item to delete.
|
|
53
|
+
* @returns True if the key was found and deleted; otherwise, false.
|
|
54
|
+
*/
|
|
16
55
|
delete(key: K): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Clears the map and resets the events.
|
|
58
|
+
*/
|
|
17
59
|
dispose(): void;
|
|
18
60
|
}
|
|
@@ -1,11 +1,49 @@
|
|
|
1
1
|
import { Event } from "./event";
|
|
2
|
+
/**
|
|
3
|
+
* A class that extends the built-in Set class and provides additional functionality.
|
|
4
|
+
* It triggers events when items are added, deleted, or the set is cleared.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type of elements in the set.
|
|
7
|
+
*/
|
|
2
8
|
export declare class DataSet<T> extends Set<T> {
|
|
9
|
+
/**
|
|
10
|
+
* An event that is triggered when a new item is added to the set.
|
|
11
|
+
*/
|
|
3
12
|
readonly onItemAdded: Event<T>;
|
|
13
|
+
/**
|
|
14
|
+
* An event that is triggered when an item is deleted from the set.
|
|
15
|
+
*/
|
|
4
16
|
readonly onItemDeleted: Event<unknown>;
|
|
17
|
+
/**
|
|
18
|
+
* An event that is triggered when the set is cleared.
|
|
19
|
+
*/
|
|
5
20
|
readonly onCleared: Event<unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a new instance of the DataSet class.
|
|
23
|
+
*
|
|
24
|
+
* @param iterable - An optional iterable object to initialize the set with.
|
|
25
|
+
*/
|
|
6
26
|
constructor(iterable?: Iterable<T> | null);
|
|
27
|
+
/**
|
|
28
|
+
* Clears the set and triggers the onCleared event.
|
|
29
|
+
*/
|
|
7
30
|
clear(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Adds a value to the set and triggers the onItemAdded event.
|
|
33
|
+
*
|
|
34
|
+
* @param value - The value to add to the set.
|
|
35
|
+
* @returns - The set instance.
|
|
36
|
+
*/
|
|
8
37
|
add(value: T): this;
|
|
38
|
+
/**
|
|
39
|
+
* Deletes a value from the set and triggers the onItemDeleted event.
|
|
40
|
+
*
|
|
41
|
+
* @param value - The value to delete from the set.
|
|
42
|
+
* @returns - True if the value was successfully deleted, false otherwise.
|
|
43
|
+
*/
|
|
9
44
|
delete(value: T): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
|
|
47
|
+
*/
|
|
10
48
|
dispose(): void;
|
|
11
49
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
2
2
|
import * as THREE from "three";
|
|
3
3
|
import * as FRAGS from "@thatopen/fragments";
|
|
4
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
4
|
+
import { Component, Components, Event, Disposable, DataMap } from "../../core";
|
|
5
5
|
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
6
6
|
/**
|
|
7
7
|
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
@@ -26,15 +26,15 @@ export declare class FragmentsManager extends Component implements Disposable {
|
|
|
26
26
|
fragmentIDs: string[];
|
|
27
27
|
}>;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* DataMap containing all loaded fragments.
|
|
30
30
|
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
31
31
|
*/
|
|
32
|
-
readonly list:
|
|
32
|
+
readonly list: DataMap<string, Fragment>;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* DataMap containing all loaded fragment groups.
|
|
35
35
|
* The key is the group's unique identifier, and the value is the group itself.
|
|
36
36
|
*/
|
|
37
|
-
readonly groups:
|
|
37
|
+
readonly groups: DataMap<string, FragmentsGroup>;
|
|
38
38
|
baseCoordinationModel: string;
|
|
39
39
|
baseCoordinationMatrix: THREE.Matrix4;
|
|
40
40
|
/** {@link Component.enabled} */
|
|
@@ -125,4 +125,12 @@ export declare class FragmentsManager extends Component implements Disposable {
|
|
|
125
125
|
* This should be a THREE.Matrix4 representing the object's transformation matrix.
|
|
126
126
|
*/
|
|
127
127
|
applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
|
|
128
|
+
/**
|
|
129
|
+
* Creates a copy of the whole model or a part of it.
|
|
130
|
+
*
|
|
131
|
+
* @param model - The model to clone.
|
|
132
|
+
* @param items - Optional - The part of the model to be cloned. If not given, the whole group is cloned.
|
|
133
|
+
*
|
|
134
|
+
*/
|
|
135
|
+
clone(model: FRAGS.FragmentsGroup, items?: FRAGS.FragmentIdMap): FragmentsGroup;
|
|
128
136
|
}
|