@thatopen/components 2.1.27 → 2.2.0-alpha.1

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.
Files changed (30) hide show
  1. package/dist/core/Components/index.d.ts +1 -1
  2. package/dist/core/Types/src/data-map.d.ts +12 -1
  3. package/dist/core/Types/src/data-set.d.ts +12 -2
  4. package/dist/core/Viewpoints/index.d.ts +27 -0
  5. package/dist/core/Viewpoints/src/Viewpoint.d.ts +43 -0
  6. package/dist/core/Viewpoints/src/index.d.ts +2 -0
  7. package/dist/core/Viewpoints/src/types.d.ts +33 -0
  8. package/dist/core/index.d.ts +1 -0
  9. package/dist/fragments/FragmentsManager/index.d.ts +9 -1
  10. package/dist/index.cjs +2198 -7
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.mjs +17823 -4731
  13. package/dist/namespace.d.ts +3043 -2430
  14. package/dist/openbim/BCFTopics/index.d.ts +92 -0
  15. package/dist/openbim/BCFTopics/src/Comment.d.ts +35 -0
  16. package/dist/openbim/BCFTopics/src/Topic.d.ts +129 -0
  17. package/dist/openbim/BCFTopics/src/TopicComments/index.d.ts +12 -0
  18. package/dist/openbim/BCFTopics/src/TopicComments/src/template.d.ts +20 -0
  19. package/dist/openbim/BCFTopics/src/TopicForm/index.d.ts +10 -0
  20. package/dist/openbim/BCFTopics/src/TopicForm/src/template.d.ts +20 -0
  21. package/dist/openbim/BCFTopics/src/TopicPanel/index.d.ts +12 -0
  22. package/dist/openbim/BCFTopics/src/TopicPanel/src/template.d.ts +46 -0
  23. package/dist/openbim/BCFTopics/src/TopicsList/index.d.ts +12 -0
  24. package/dist/openbim/BCFTopics/src/TopicsList/src/template.d.ts +29 -0
  25. package/dist/openbim/BCFTopics/src/ViewpointsList/index.d.ts +12 -0
  26. package/dist/openbim/BCFTopics/src/ViewpointsList/src/template.d.ts +19 -0
  27. package/dist/openbim/BCFTopics/src/index.d.ts +7 -0
  28. package/dist/openbim/BCFTopics/src/types.d.ts +35 -0
  29. package/dist/openbim/index.d.ts +1 -0
  30. package/package.json +3 -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.27";
9
+ static readonly release = "2.2.0-alpha.0";
10
10
  /** {@link Disposable.onDisposed} */
11
11
  readonly onDisposed: Event<void>;
12
12
  /**
@@ -23,7 +23,7 @@ export declare class DataMap<K, V> extends Map<K, V> {
23
23
  /**
24
24
  * An event triggered when an item is deleted from the map.
25
25
  */
26
- readonly onItemDeleted: Event<unknown>;
26
+ readonly onItemDeleted: Event<K>;
27
27
  /**
28
28
  * An event triggered when the map is cleared.
29
29
  */
@@ -46,6 +46,17 @@ export declare class DataMap<K, V> extends Map<K, V> {
46
46
  * @returns The DataMap instance.
47
47
  */
48
48
  set(key: K, value: V): this;
49
+ /**
50
+ * A function that acts as a guard for adding items to the set.
51
+ * It determines whether a given value should be allowed to be added to the set.
52
+ *
53
+ * @param key - The key of the entry to be checked against the guard.
54
+ * @param value - The value of the entry to be checked against the guard.
55
+ * @returns A boolean indicating whether the value should be allowed to be added to the set.
56
+ * By default, this function always returns true, allowing all values to be added.
57
+ * You can override this behavior by providing a custom implementation.
58
+ */
59
+ guard: (key: K, value: V) => boolean;
49
60
  /**
50
61
  * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
51
62
  *
@@ -29,12 +29,22 @@ export declare class DataSet<T> extends Set<T> {
29
29
  */
30
30
  clear(): void;
31
31
  /**
32
- * Adds a value to the set and triggers the onItemAdded event.
32
+ * Adds one or multiple values to the set and triggers the onItemAdded event per each.
33
33
  *
34
34
  * @param value - The value to add to the set.
35
35
  * @returns - The set instance.
36
36
  */
37
- add(value: T): this;
37
+ add(...value: T[]): this;
38
+ /**
39
+ * A function that acts as a guard for adding items to the set.
40
+ * It determines whether a given value should be allowed to be added to the set.
41
+ *
42
+ * @param value - The value to be checked against the guard.
43
+ * @returns A boolean indicating whether the value should be allowed to be added to the set.
44
+ * By default, this function always returns true, allowing all values to be added.
45
+ * You can override this behavior by providing a custom implementation.
46
+ */
47
+ guard: (value: T) => boolean;
38
48
  /**
39
49
  * Deletes a value from the set and triggers the onItemDeleted event.
40
50
  *
@@ -0,0 +1,27 @@
1
+ import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
2
+ import { Components } from "../Components";
3
+ import { BCFViewpoint, Viewpoint } from "./src";
4
+ /**
5
+ * Configuration interface for the Viewpoints general behavior.
6
+ */
7
+ interface ViewpointsConfig {
8
+ /**
9
+ * Indicates whether to overwrite the fragments colors when applying viewpoints.
10
+ * @default false
11
+ */
12
+ overwriteColors: boolean;
13
+ }
14
+ export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfig> {
15
+ static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
16
+ enabled: boolean;
17
+ readonly list: DataMap<string, Viewpoint>;
18
+ create(world: World, data?: Partial<BCFViewpoint>): Viewpoint;
19
+ constructor(components: Components);
20
+ isSetup: boolean;
21
+ setup(): void;
22
+ onSetup: Event<unknown>;
23
+ config: Required<ViewpointsConfig>;
24
+ readonly onDisposed: Event<unknown>;
25
+ dispose(): void;
26
+ }
27
+ export * from "./src";
@@ -0,0 +1,43 @@
1
+ import * as THREE from "three";
2
+ import * as FRAGS from "@thatopen/fragments";
3
+ import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
4
+ import { CameraProjection } from "../../OrthoPerspectiveCamera";
5
+ import { Components } from "../../Components";
6
+ import { DataMap, DataSet, World } from "../../Types";
7
+ import { SimplePlane } from "../../Clipper";
8
+ export declare class Viewpoint implements BCFViewpoint {
9
+ title?: string;
10
+ guid: string;
11
+ clippingPlanes: DataSet<SimplePlane>;
12
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
13
+ readonly exceptionComponents: DataSet<string>;
14
+ readonly selectionComponents: DataSet<string>;
15
+ readonly componentColors: DataMap<string, string[]>;
16
+ spacesVisible: boolean;
17
+ spaceBoundariesVisible: boolean;
18
+ openingsVisible: boolean;
19
+ defaultVisibility: boolean;
20
+ private get _selectionModelIdMap();
21
+ private get _exceptionModelIdMap();
22
+ get selection(): FRAGS.FragmentIdMap;
23
+ get exception(): FRAGS.FragmentIdMap;
24
+ get projection(): CameraProjection;
25
+ get position(): THREE.Vector3;
26
+ get direction(): THREE.Vector3;
27
+ private _components;
28
+ readonly world: World;
29
+ private get _managerVersion();
30
+ get topics(): import("../../../openbim/BCFTopics").Topic[];
31
+ constructor(components: Components, world: World, _config?: {
32
+ data?: Partial<BCFViewpoint>;
33
+ setCamera?: boolean;
34
+ });
35
+ addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): Promise<void>;
36
+ set(data: Partial<BCFViewpoint>): this;
37
+ go(transition?: boolean): Promise<void>;
38
+ updateCamera(): void;
39
+ colorize(): void;
40
+ resetColors(): void;
41
+ private createComponentTags;
42
+ serialize(version?: import("../../../openbim/BCFTopics").BCFVersion): Promise<string>;
43
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./Viewpoint";
@@ -0,0 +1,33 @@
1
+ import { SimplePlane } from "../../Clipper";
2
+ import { DataSet } from "../../Types";
3
+ export interface ViewpointCamera {
4
+ direction: {
5
+ x: number;
6
+ y: number;
7
+ z: number;
8
+ };
9
+ position: {
10
+ x: number;
11
+ y: number;
12
+ z: number;
13
+ };
14
+ aspectRatio: number;
15
+ }
16
+ export interface ViewpointPerspectiveCamera extends ViewpointCamera {
17
+ fov: number;
18
+ }
19
+ export interface ViewpointOrthographicCamera extends ViewpointCamera {
20
+ viewToWorldScale: number;
21
+ }
22
+ export interface BCFViewpoint {
23
+ title?: string;
24
+ guid: string;
25
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
26
+ selectionComponents: Iterable<string>;
27
+ exceptionComponents: Iterable<string>;
28
+ clippingPlanes: DataSet<SimplePlane>;
29
+ spacesVisible: boolean;
30
+ spaceBoundariesVisible: boolean;
31
+ openingsVisible: boolean;
32
+ defaultVisibility: boolean;
33
+ }
@@ -7,5 +7,6 @@ export * from "./Worlds";
7
7
  export * from "./Grids";
8
8
  export * from "./Clipper";
9
9
  export * from "./Cullers";
10
+ export * from "./Viewpoints";
10
11
  export * from "./MiniMap";
11
12
  export * from "./OrthoPerspectiveCamera";
@@ -100,6 +100,14 @@ export declare class FragmentsManager extends Component implements Disposable {
100
100
  modelIdToFragmentIdMap(modelIdMap: {
101
101
  [modelID: string]: Set<number>;
102
102
  }): FRAGS.FragmentIdMap;
103
+ /**
104
+ * Converts a collection of IFC GUIDs to a fragmentIdMap.
105
+ *
106
+ * @param guids - An iterable collection of global IDs to be converted to a fragment ID map.
107
+ *
108
+ * @returns A fragment ID map, where the keys are fragment IDs and the values are the corresponding express IDs.
109
+ */
110
+ guidToFragmentIdMap(guids: Iterable<string>): FRAGS.FragmentIdMap;
103
111
  /**
104
112
  * Applies coordinate transformation to the provided models.
105
113
  * If no models are provided, all groups are used.
@@ -124,7 +132,7 @@ export declare class FragmentsManager extends Component implements Disposable {
124
132
  * @param originalCoordinateSystem - The original coordinate system of the object.
125
133
  * This should be a THREE.Matrix4 representing the object's transformation matrix.
126
134
  */
127
- applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem: THREE.Matrix4): void;
135
+ applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem?: THREE.Matrix4): void;
128
136
  /**
129
137
  * Creates a copy of the whole model or a part of it.
130
138
  *