@thatopen/components 2.4.11 → 3.1.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 (161) hide show
  1. package/dist/index.cjs +18440 -25937
  2. package/dist/index.d.ts +4530 -6
  3. package/dist/index.min.cjs +3 -3
  4. package/dist/index.min.mjs +3 -3
  5. package/dist/index.mjs +18442 -25939
  6. package/package.json +8 -10
  7. package/dist/core/Clipper/index.d.ts +0 -142
  8. package/dist/core/Clipper/src/clipper-config.d.ts +0 -33
  9. package/dist/core/Clipper/src/index.d.ts +0 -1
  10. package/dist/core/Clipper/src/simple-plane.d.ts +0 -99
  11. package/dist/core/Components/index.d.ts +0 -93
  12. package/dist/core/ConfigManager/index.d.ts +0 -21
  13. package/dist/core/ConfigManager/src/configurator.d.ts +0 -13
  14. package/dist/core/ConfigManager/src/index.d.ts +0 -1
  15. package/dist/core/Cullers/index.d.ts +0 -56
  16. package/dist/core/Cullers/src/culler-renderer-config.d.ts +0 -74
  17. package/dist/core/Cullers/src/culler-renderer.d.ts +0 -76
  18. package/dist/core/Cullers/src/index.d.ts +0 -3
  19. package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +0 -59
  20. package/dist/core/Cullers/src/screen-culler-helper.d.ts +0 -1
  21. package/dist/core/Disposer/index.d.ts +0 -45
  22. package/dist/core/Grids/index.d.ts +0 -46
  23. package/dist/core/Grids/src/index.d.ts +0 -2
  24. package/dist/core/Grids/src/simple-grid-config.d.ts +0 -80
  25. package/dist/core/Grids/src/simple-grid.d.ts +0 -48
  26. package/dist/core/MiniMap/index.d.ts +0 -50
  27. package/dist/core/MiniMap/src/index.d.ts +0 -2
  28. package/dist/core/MiniMap/src/mini-map-config.d.ts +0 -112
  29. package/dist/core/MiniMap/src/mini-map.d.ts +0 -100
  30. package/dist/core/OrthoPerspectiveCamera/index.d.ts +0 -65
  31. package/dist/core/OrthoPerspectiveCamera/src/first-person-mode.d.ts +0 -16
  32. package/dist/core/OrthoPerspectiveCamera/src/index.d.ts +0 -5
  33. package/dist/core/OrthoPerspectiveCamera/src/orbit-mode.d.ts +0 -16
  34. package/dist/core/OrthoPerspectiveCamera/src/plan-mode.d.ts +0 -20
  35. package/dist/core/OrthoPerspectiveCamera/src/projections.d.ts +0 -45
  36. package/dist/core/OrthoPerspectiveCamera/src/types.d.ts +0 -26
  37. package/dist/core/Raycasters/index.d.ts +0 -43
  38. package/dist/core/Raycasters/src/index.d.ts +0 -2
  39. package/dist/core/Raycasters/src/mouse.d.ts +0 -24
  40. package/dist/core/Raycasters/src/simple-raycaster.d.ts +0 -54
  41. package/dist/core/ShadowedScene/index.d.ts +0 -57
  42. package/dist/core/ShadowedScene/src/distance-renderer.d.ts +0 -67
  43. package/dist/core/ShadowedScene/src/index.d.ts +0 -1
  44. package/dist/core/Types/index.d.ts +0 -1
  45. package/dist/core/Types/src/async-event.d.ts +0 -32
  46. package/dist/core/Types/src/base-camera.d.ts +0 -28
  47. package/dist/core/Types/src/base-renderer.d.ts +0 -65
  48. package/dist/core/Types/src/base-scene.d.ts +0 -25
  49. package/dist/core/Types/src/base-world-item.d.ts +0 -23
  50. package/dist/core/Types/src/base.d.ts +0 -19
  51. package/dist/core/Types/src/component-with-ui.d.ts +0 -18
  52. package/dist/core/Types/src/component.d.ts +0 -13
  53. package/dist/core/Types/src/config-types.d.ts +0 -47
  54. package/dist/core/Types/src/data-map.d.ts +0 -73
  55. package/dist/core/Types/src/data-set.d.ts +0 -58
  56. package/dist/core/Types/src/event-manager.d.ts +0 -30
  57. package/dist/core/Types/src/event.d.ts +0 -32
  58. package/dist/core/Types/src/index.d.ts +0 -15
  59. package/dist/core/Types/src/interfaces.d.ts +0 -117
  60. package/dist/core/Types/src/world.d.ts +0 -34
  61. package/dist/core/Viewpoints/index.d.ts +0 -38
  62. package/dist/core/Viewpoints/src/index.d.ts +0 -2
  63. package/dist/core/Viewpoints/src/types.d.ts +0 -36
  64. package/dist/core/Viewpoints/src/viewpoint.d.ts +0 -197
  65. package/dist/core/Viewpoints/src/viewpoints-config.d.ts +0 -23
  66. package/dist/core/Worlds/index.d.ts +0 -54
  67. package/dist/core/Worlds/src/index.d.ts +0 -5
  68. package/dist/core/Worlds/src/simple-camera.d.ts +0 -62
  69. package/dist/core/Worlds/src/simple-renderer.d.ts +0 -54
  70. package/dist/core/Worlds/src/simple-scene-config.d.ts +0 -59
  71. package/dist/core/Worlds/src/simple-scene.d.ts +0 -25
  72. package/dist/core/Worlds/src/simple-world.d.ts +0 -79
  73. package/dist/core/index.d.ts +0 -13
  74. package/dist/fragments/BoundingBoxer/index.d.ts +0 -208
  75. package/dist/fragments/Classifier/index.d.ts +0 -197
  76. package/dist/fragments/Exploder/index.d.ts +0 -50
  77. package/dist/fragments/FragmentsManager/index.d.ts +0 -152
  78. package/dist/fragments/Hider/index.d.ts +0 -38
  79. package/dist/fragments/IfcGeometryTiler/index.d.ts +0 -103
  80. package/dist/fragments/IfcGeometryTiler/src/base-types.d.ts +0 -29
  81. package/dist/fragments/IfcGeometryTiler/src/index.d.ts +0 -2
  82. package/dist/fragments/IfcGeometryTiler/src/streaming-settings.d.ts +0 -20
  83. package/dist/fragments/IfcLoader/index.d.ts +0 -116
  84. package/dist/fragments/IfcLoader/src/civil-reader.d.ts +0 -15
  85. package/dist/fragments/IfcLoader/src/ifc-fragment-settings.d.ts +0 -41
  86. package/dist/fragments/IfcLoader/src/ifc-metadata-reader.d.ts +0 -5
  87. package/dist/fragments/IfcLoader/src/index.d.ts +0 -5
  88. package/dist/fragments/IfcLoader/src/spatial-ids-finder.d.ts +0 -5
  89. package/dist/fragments/IfcLoader/src/spatial-structure.d.ts +0 -8
  90. package/dist/fragments/IfcLoader/src/transform-helper.d.ts +0 -5
  91. package/dist/fragments/IfcLoader/src/units.d.ts +0 -10
  92. package/dist/fragments/IfcPropertiesTiler/index.d.ts +0 -66
  93. package/dist/fragments/IfcPropertiesTiler/src/index.d.ts +0 -1
  94. package/dist/fragments/IfcPropertiesTiler/src/streaming-settings.d.ts +0 -11
  95. package/dist/fragments/index.d.ts +0 -8
  96. package/dist/ifc/IfcFinder/index.d.ts +0 -50
  97. package/dist/ifc/IfcFinder/src/ifc-basic-query.d.ts +0 -35
  98. package/dist/ifc/IfcFinder/src/ifc-finder-query.d.ts +0 -96
  99. package/dist/ifc/IfcFinder/src/ifc-property-query.d.ts +0 -36
  100. package/dist/ifc/IfcFinder/src/ifc-query-group.d.ts +0 -69
  101. package/dist/ifc/IfcFinder/src/index.d.ts +0 -4
  102. package/dist/ifc/IfcFinder/src/types.d.ts +0 -84
  103. package/dist/ifc/IfcIsolator/index.d.ts +0 -24
  104. package/dist/ifc/IfcJsonExporter/index.d.ts +0 -26
  105. package/dist/ifc/IfcJsonExporter/src/ifc-geometry-types.d.ts +0 -4
  106. package/dist/ifc/IfcJsonExporter/src/index.d.ts +0 -1
  107. package/dist/ifc/IfcPropertiesManager/index.d.ts +0 -289
  108. package/dist/ifc/IfcPropertiesManager/src/index.d.ts +0 -3
  109. package/dist/ifc/IfcPropertiesManager/src/rel-attrs.d.ts +0 -7
  110. package/dist/ifc/IfcPropertiesManager/src/rel-names.d.ts +0 -3
  111. package/dist/ifc/IfcPropertiesManager/src/types.d.ts +0 -18
  112. package/dist/ifc/IfcRelationsIndexer/index.d.ts +0 -195
  113. package/dist/ifc/IfcRelationsIndexer/src/index.d.ts +0 -2
  114. package/dist/ifc/IfcRelationsIndexer/src/newVersion.d.ts +0 -51
  115. package/dist/ifc/IfcRelationsIndexer/src/relToAttributesMap.d.ts +0 -5
  116. package/dist/ifc/IfcRelationsIndexer/src/types.d.ts +0 -73
  117. package/dist/ifc/Utils/ifc-categories.d.ts +0 -7
  118. package/dist/ifc/Utils/ifc-category-case.d.ts +0 -3
  119. package/dist/ifc/Utils/ifc-category-map.d.ts +0 -6
  120. package/dist/ifc/Utils/ifc-elements-map.d.ts +0 -11
  121. package/dist/ifc/Utils/index.d.ts +0 -5
  122. package/dist/ifc/Utils/properties-utils.d.ts +0 -25
  123. package/dist/ifc/index.d.ts +0 -6
  124. package/dist/measurement/MeasurementUtils/index.d.ts +0 -105
  125. package/dist/measurement/index.d.ts +0 -1
  126. package/dist/namespace.d.ts +0 -6018
  127. package/dist/openbim/BCFTopics/index.d.ts +0 -114
  128. package/dist/openbim/BCFTopics/src/Comment.d.ts +0 -40
  129. package/dist/openbim/BCFTopics/src/Topic.d.ts +0 -127
  130. package/dist/openbim/BCFTopics/src/bcf-topics-config.d.ts +0 -121
  131. package/dist/openbim/BCFTopics/src/importers/extensions.d.ts +0 -2
  132. package/dist/openbim/BCFTopics/src/importers/index.d.ts +0 -1
  133. package/dist/openbim/BCFTopics/src/index.d.ts +0 -5
  134. package/dist/openbim/BCFTopics/src/types.d.ts +0 -19
  135. package/dist/openbim/IDSSpecifications/index.d.ts +0 -60
  136. package/dist/openbim/IDSSpecifications/src/Specification.d.ts +0 -40
  137. package/dist/openbim/IDSSpecifications/src/exporters/parameter.d.ts +0 -2
  138. package/dist/openbim/IDSSpecifications/src/facets/Attribute.d.ts +0 -13
  139. package/dist/openbim/IDSSpecifications/src/facets/Classification.d.ts +0 -21
  140. package/dist/openbim/IDSSpecifications/src/facets/Entity.d.ts +0 -15
  141. package/dist/openbim/IDSSpecifications/src/facets/Facet.d.ts +0 -26
  142. package/dist/openbim/IDSSpecifications/src/facets/Material.d.ts +0 -10
  143. package/dist/openbim/IDSSpecifications/src/facets/PartOf.d.ts +0 -26
  144. package/dist/openbim/IDSSpecifications/src/facets/Property.d.ts +0 -25
  145. package/dist/openbim/IDSSpecifications/src/facets/index.d.ts +0 -5
  146. package/dist/openbim/IDSSpecifications/src/importers/attribute.d.ts +0 -3
  147. package/dist/openbim/IDSSpecifications/src/importers/classification.d.ts +0 -3
  148. package/dist/openbim/IDSSpecifications/src/importers/entity.d.ts +0 -3
  149. package/dist/openbim/IDSSpecifications/src/importers/index.d.ts +0 -3
  150. package/dist/openbim/IDSSpecifications/src/importers/parameter.d.ts +0 -2
  151. package/dist/openbim/IDSSpecifications/src/importers/property.d.ts +0 -3
  152. package/dist/openbim/IDSSpecifications/src/index.d.ts +0 -3
  153. package/dist/openbim/IDSSpecifications/src/types.d.ts +0 -70
  154. package/dist/openbim/index.d.ts +0 -2
  155. package/dist/utils/bbox.d.ts +0 -7
  156. package/dist/utils/geometry.d.ts +0 -1
  157. package/dist/utils/index.d.ts +0 -6
  158. package/dist/utils/materials.d.ts +0 -4
  159. package/dist/utils/section-generator.d.ts +0 -31
  160. package/dist/utils/uuid.d.ts +0 -6
  161. package/dist/utils/vertex-picker.d.ts +0 -116
@@ -1,73 +0,0 @@
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
- */
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
- */
12
- readonly onItemSet: Event<{
13
- key: K;
14
- value: V;
15
- }>;
16
- /**
17
- * An event triggered when an existing item in the map is updated.
18
- */
19
- readonly onItemUpdated: Event<{
20
- key: K;
21
- value: V;
22
- }>;
23
- /**
24
- * An event triggered when an item is deleted from the map.
25
- */
26
- readonly onItemDeleted: Event<K>;
27
- /**
28
- * An event triggered when the map is cleared.
29
- */
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
- */
36
- constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
37
- /**
38
- * Clears the map and triggers the onCleared event.
39
- */
40
- clear(): void;
41
- /**
42
- * Sets the value for the specified key in the map.
43
- * If the item is new, then onItemSet is triggered.
44
- * If the item is already in the map, then onItemUpdated is triggered.
45
- *
46
- * @param key - The key of the item to set.
47
- * @param value - The value of the item to set.
48
- * @returns The DataMap instance.
49
- */
50
- set(key: K, value: V): this;
51
- /**
52
- * A function that acts as a guard for adding items to the set.
53
- * It determines whether a given value should be allowed to be added to the set.
54
- *
55
- * @param key - The key of the entry to be checked against the guard.
56
- * @param value - The value of the entry to be checked against the guard.
57
- * @returns A boolean indicating whether the value should be allowed to be added to the set.
58
- * By default, this function always returns true, allowing all values to be added.
59
- * You can override this behavior by providing a custom implementation.
60
- */
61
- guard: (key: K, value: V) => boolean;
62
- /**
63
- * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
64
- *
65
- * @param key - The key of the item to delete.
66
- * @returns True if the key was found and deleted; otherwise, false.
67
- */
68
- delete(key: K): boolean;
69
- /**
70
- * Clears the map and resets the events.
71
- */
72
- dispose(): void;
73
- }
@@ -1,58 +0,0 @@
1
- import { Event } from "./event";
2
- /**
3
- * A class that extends the built-in Set class and provides additional functionality. It triggers events when items are added, deleted, or the set is cleared.
4
- *
5
- * @template T - The type of elements in the set.
6
- */
7
- export declare class DataSet<T> extends Set<T> {
8
- /**
9
- * An event that is triggered when a new item is added to the set.
10
- */
11
- readonly onItemAdded: Event<T>;
12
- /**
13
- * An event that is triggered when an item is deleted from the set.
14
- */
15
- readonly onItemDeleted: Event<unknown>;
16
- /**
17
- * An event that is triggered when the set is cleared.
18
- */
19
- readonly onCleared: Event<unknown>;
20
- /**
21
- * Constructs a new instance of the DataSet class.
22
- *
23
- * @param iterable - An optional iterable object to initialize the set with.
24
- */
25
- constructor(iterable?: Iterable<T> | null);
26
- /**
27
- * Clears the set and triggers the onCleared event.
28
- */
29
- clear(): void;
30
- /**
31
- * Adds one or multiple values to the set and triggers the onItemAdded event per each.
32
- *
33
- * @param value - The value to add to the set.
34
- * @returns - The set instance.
35
- */
36
- add(...value: T[]): this;
37
- /**
38
- * A function that acts as a guard for adding items to the set.
39
- * It determines whether a given value should be allowed to be added to the set.
40
- *
41
- * @param value - The value to be checked against the guard.
42
- * @returns A boolean indicating whether the value should be allowed to be added to the set.
43
- * By default, this function always returns true, allowing all values to be added.
44
- * You can override this behavior by providing a custom implementation.
45
- */
46
- guard: (value: T) => boolean;
47
- /**
48
- * Deletes a value from the set and triggers the onItemDeleted event.
49
- *
50
- * @param value - The value to delete from the set.
51
- * @returns - True if the value was successfully deleted, false otherwise.
52
- */
53
- delete(value: T): boolean;
54
- /**
55
- * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
56
- */
57
- dispose(): void;
58
- }
@@ -1,30 +0,0 @@
1
- import { Event } from "./event";
2
- import { AsyncEvent } from "./async-event";
3
- /**
4
- * Simple class to easily toggle and reset event lists.
5
- */
6
- export declare class EventManager {
7
- /**
8
- * The list of events managed by this instance.
9
- */
10
- list: Set<Event<any> | AsyncEvent<any>>;
11
- /**
12
- * Adds events to this manager.
13
- * @param events the events to add.
14
- */
15
- add(events: Iterable<Event<any> | AsyncEvent<any>>): void;
16
- /**
17
- * Removes events from this manager.
18
- * @param events the events to remove.
19
- */
20
- remove(events: Iterable<Event<any> | AsyncEvent<any>>): void;
21
- /**
22
- * Sets all the events managed by this instance as enabled or disabled.
23
- * @param active whether to turn on or off the events.
24
- */
25
- set(active: boolean): void;
26
- /**
27
- * Resets all the events managed by this instance.
28
- */
29
- reset(): void;
30
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to `this`, you will need to declare the callback as an arrow function.
3
- */
4
- export declare class Event<T> {
5
- /**
6
- * Whether this event is active or not. If not, it won't trigger.
7
- */
8
- enabled: boolean;
9
- /**
10
- * Add a callback to this event instance.
11
- * @param handler - the callback to be added to this event.
12
- */
13
- add(handler: T extends void ? {
14
- (): void;
15
- } : {
16
- (data: T): void;
17
- }): void;
18
- /**
19
- * Removes a callback from this event instance.
20
- * @param handler - the callback to be removed from this event.
21
- */
22
- remove(handler: T extends void ? {
23
- (): void;
24
- } : {
25
- (data: T): void;
26
- }): void;
27
- /** Triggers all the callbacks assigned to this event. */
28
- trigger: (data?: T) => void;
29
- /** Gets rid of all the suscribed events. */
30
- reset(): void;
31
- private handlers;
32
- }
@@ -1,15 +0,0 @@
1
- export * from "./event";
2
- export * from "./async-event";
3
- export * from "./interfaces";
4
- export * from "./component";
5
- export * from "./base";
6
- export * from "./base-world-item";
7
- export * from "./base-camera";
8
- export * from "./base-renderer";
9
- export * from "./base-scene";
10
- export * from "./world";
11
- export * from "./data-set";
12
- export * from "./data-map";
13
- export * from "./component-with-ui";
14
- export * from "./config-types";
15
- export * from "./event-manager";
@@ -1,117 +0,0 @@
1
- import * as THREE from "three";
2
- import CameraControls from "camera-controls";
3
- import { Event } from "./event";
4
- import { EventManager } from "./event-manager";
5
- /**
6
- * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
7
- */
8
- export interface Disposable {
9
- /**
10
- * Destroys the object from memory to prevent a
11
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
12
- */
13
- dispose: () => void | Promise<void>;
14
- /** Fired after the tool has been disposed. */
15
- readonly onDisposed: Event<any>;
16
- }
17
- /**
18
- * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
19
- */
20
- export interface Hideable {
21
- /**
22
- * Whether the geometric representation of this component is
23
- * currently visible or not in the
24
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
25
- */
26
- visible: boolean;
27
- }
28
- /**
29
- * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
30
- */
31
- export interface Resizeable {
32
- /**
33
- * Sets size of this component (e.g. the resolution of a
34
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
35
- * component.
36
- */
37
- resize: (size?: THREE.Vector2) => void;
38
- /** Event that fires when the component has been resized. */
39
- onResize: Event<THREE.Vector2>;
40
- /**
41
- * Gets the current size of this component (e.g. the resolution of a
42
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
43
- * component.
44
- */
45
- getSize: () => THREE.Vector2;
46
- }
47
- /** Whether this component should be updated each frame. */
48
- export interface Updateable {
49
- /** Actions that should be executed after updating the component. */
50
- onAfterUpdate: Event<any>;
51
- /** Actions that should be executed before updating the component. */
52
- onBeforeUpdate: Event<any>;
53
- /**
54
- * Function used to update the state of this component each frame. For
55
- * instance, a renderer component will make a render each frame.
56
- */
57
- update(delta?: number): void;
58
- }
59
- /** Basic type to describe the progress of any kind of process. */
60
- export interface Progress {
61
- /** The amount of things that have been done already. */
62
- current: number;
63
- /** The total amount of things to be done by the process. */
64
- total: number;
65
- }
66
- /**
67
- * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
68
- */
69
- export interface Createable {
70
- /** Creates a new instance of an element (e.g. a new Dimension). */
71
- create: (data: any) => void;
72
- /**
73
- * Finish the creation process of the component, successfully creating an
74
- * instance of whatever the component creates.
75
- */
76
- endCreation?: (data: any) => void;
77
- /**
78
- * Cancels the creation process of the component, going back to the state
79
- * before starting to create.
80
- */
81
- cancelCreation?: (data: any) => void;
82
- /** Deletes an existing instance of an element (e.g. a Dimension). */
83
- delete: (data: any) => void;
84
- }
85
- /**
86
- * Whether this component supports to be configured.
87
- */
88
- export interface Configurable<T, U> {
89
- /** Wether this components has been already configured. */
90
- isSetup: boolean;
91
- /** Use the provided configuration to set up the tool. */
92
- setup: (config?: Partial<U>) => void | Promise<void>;
93
- /** Fired after successfully calling {@link Configurable.setup()} */
94
- readonly onSetup: Event<any>;
95
- /** Object holding the tool configuration. You can edit this directly to change the object.
96
- */
97
- config: Required<T>;
98
- }
99
- /**
100
- * Whether a camera uses the Camera Controls library.
101
- */
102
- export interface CameraControllable {
103
- /**
104
- * An instance of CameraControls that provides camera control functionalities.
105
- * This instance is used to manipulate the camera.
106
- */
107
- controls: CameraControls;
108
- }
109
- /**
110
- * Whether it has events or not.
111
- */
112
- export interface Eventable {
113
- /**
114
- * The object in charge of managing all the events.
115
- */
116
- eventManager: EventManager;
117
- }
@@ -1,34 +0,0 @@
1
- import * as THREE from "three";
2
- import { BaseScene } from "./base-scene";
3
- import { BaseCamera } from "./base-camera";
4
- import { BaseRenderer } from "./base-renderer";
5
- import { Updateable, Disposable } from "./interfaces";
6
- /**
7
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
8
- */
9
- export interface World extends Disposable, Updateable {
10
- /**
11
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
12
- */
13
- meshes: Set<THREE.Mesh>;
14
- /**
15
- * The base scene of the world.
16
- */
17
- scene: BaseScene;
18
- /**
19
- * The base camera of the world.
20
- */
21
- camera: BaseCamera;
22
- /**
23
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
24
- */
25
- renderer: BaseRenderer | null;
26
- /**
27
- * A unique identifier for the world.
28
- */
29
- uuid: string;
30
- /**
31
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
32
- */
33
- isDisposing: boolean;
34
- }
@@ -1,38 +0,0 @@
1
- import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
2
- import { Components } from "../Components";
3
- import { BCFViewpoint, Viewpoint } from "./src";
4
- import { ViewpointsConfigManager, ViewpointsConfig } from "./src/viewpoints-config";
5
- export * from "./src";
6
- export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfigManager, ViewpointsConfig> {
7
- static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
8
- enabled: boolean;
9
- /**
10
- * A DataMap that stores Viewpoint instances, indexed by their unique identifiers (guid).
11
- * This map is used to manage and retrieve Viewpoint instances within the Viewpoints component.
12
- */
13
- readonly list: DataMap<string, Viewpoint>;
14
- /**
15
- * Creates a new Viewpoint instance and adds it to the list.
16
- *
17
- * @param world - The world in which the Viewpoint will be created.
18
- * @param data - Optional partial data for the Viewpoint. If not provided, default data will be used.
19
- *
20
- * @returns The newly created Viewpoint instance.
21
- */
22
- create(world: World, data?: Partial<BCFViewpoint>): Viewpoint;
23
- constructor(components: Components);
24
- isSetup: boolean;
25
- setup(): void;
26
- onSetup: Event<unknown>;
27
- config: ViewpointsConfigManager;
28
- /** {@link Disposable.onDisposed} */
29
- readonly onDisposed: Event<unknown>;
30
- /**
31
- * Disposes of the Viewpoints component and its associated resources.
32
- *
33
- * This method is responsible for cleaning up any resources held by the Viewpoints component,
34
- * such as disposing of the DataMap of Viewpoint instances and triggering and resetting the
35
- * onDisposed event.
36
- */
37
- dispose(): void;
38
- }
@@ -1,2 +0,0 @@
1
- export * from "./types";
2
- export * from "./viewpoint";
@@ -1,36 +0,0 @@
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
- /**
23
- * Represents a viewpoint in a BCF file.
24
- */
25
- export interface BCFViewpoint {
26
- title?: string;
27
- guid: string;
28
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
29
- selectionComponents: Iterable<string>;
30
- exceptionComponents: Iterable<string>;
31
- clippingPlanes: DataSet<SimplePlane>;
32
- spacesVisible: boolean;
33
- spaceBoundariesVisible: boolean;
34
- openingsVisible: boolean;
35
- defaultVisibility: boolean;
36
- }
@@ -1,197 +0,0 @@
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
- /**
9
- * Represents a BCF compliant viewpoint from BuildingSMART.
10
- *
11
- * The Viewpoint class provides methods for managing and interacting with viewpoints.
12
- * It includes functionality for setting viewpoint properties, updating the camera,
13
- * applying color to components, and serializing the viewpoint for export.
14
- */
15
- export declare class Viewpoint implements BCFViewpoint {
16
- title?: string;
17
- readonly guid: string;
18
- /**
19
- * ClippingPlanes can be used to define a subsection of a building model that is related to the topic.
20
- * Each clipping plane is defined by Location and Direction.
21
- * The Direction vector points in the invisible direction meaning the half-space that is clipped.
22
- * @experimental
23
- */
24
- clippingPlanes: DataSet<SimplePlane>;
25
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
26
- /**
27
- * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false
28
- */
29
- readonly exceptionComponents: DataSet<string>;
30
- /**
31
- * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint.
32
- */
33
- readonly selectionComponents: DataSet<string>;
34
- /**
35
- * A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
36
- * For this to work, call viewpoint.colorize()
37
- */
38
- readonly componentColors: DataMap<THREE.Color, string[]>;
39
- /**
40
- * Boolean flags to allow fine control over the visibility of spaces.
41
- * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
42
- * @default false
43
- */
44
- spacesVisible: boolean;
45
- /**
46
- * Boolean flags to allow fine control over the visibility of space boundaries.
47
- * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden.
48
- * @default false
49
- */
50
- spaceBoundariesVisible: boolean;
51
- /**
52
- * Boolean flags to allow fine control over the visibility of openings.
53
- * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden.
54
- * @default false
55
- */
56
- openingsVisible: boolean;
57
- /**
58
- * When true, all components should be visible unless listed in the exceptions
59
- * When false all components should be invisible unless listed in the exceptions
60
- */
61
- defaultVisibility: boolean;
62
- private get _selectionModelIdMap();
63
- private get _exceptionModelIdMap();
64
- /**
65
- * A list of components that should be selected (highlighted) when displaying a viewpoint.
66
- * @returns The fragmentIdMap for components marked as selections.
67
- */
68
- get selection(): FRAGS.FragmentIdMap;
69
- /**
70
- * A list of components to hide when defaultVisibility = true or to show when defaultVisibility = false
71
- * @returns The fragmentIdMap for components marked as exceptions.
72
- */
73
- get exception(): FRAGS.FragmentIdMap;
74
- /**
75
- * Retrieves the projection type of the viewpoint's camera.
76
- *
77
- * @returns A string representing the projection type of the viewpoint's camera.
78
- * It can be either 'Perspective' or 'Orthographic'.
79
- */
80
- get projection(): CameraProjection;
81
- /**
82
- * Retrieves the position vector of the viewpoint's camera.
83
- *
84
- * @remarks
85
- * The position vector represents the camera's position in the world coordinate system.
86
- * The function applies the base coordinate system transformation to the position vector.
87
- *
88
- * @returns A THREE.Vector3 representing the position of the viewpoint's camera.
89
- */
90
- get position(): THREE.Vector3;
91
- /**
92
- * Retrieves the direction vector of the viewpoint's camera.
93
- *
94
- * @remarks
95
- * The direction vector represents the direction in which the camera is pointing.
96
- * It is calculated by extracting the x, y, and z components from the camera's direction property.
97
- *
98
- * @returns A THREE.Vector3 representing the direction of the viewpoint's camera.
99
- */
100
- get direction(): THREE.Vector3;
101
- private _components;
102
- /**
103
- * Represents the world in which the viewpoints are created and managed.
104
- */
105
- readonly world: World;
106
- private get _managerVersion();
107
- /**
108
- * Retrieves the list of BCF topics associated with the current viewpoint.
109
- *
110
- * @remarks
111
- * This function retrieves the BCFTopics manager from the components,
112
- * then filters the list of topics to find those associated with the current viewpoint.
113
- *
114
- * @returns An array of BCF topics associated with the current viewpoint.
115
- */
116
- get topics(): import("../../../openbim/BCFTopics").Topic[];
117
- constructor(components: Components, world: World, _config?: {
118
- data?: Partial<BCFViewpoint>;
119
- setCamera?: boolean;
120
- });
121
- /**
122
- * Adds components to the viewpoint based on the provided fragment ID map.
123
- *
124
- * @param fragmentIdMap - A map containing fragment IDs as keys and arrays of express IDs as values.
125
- */
126
- addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
127
- /**
128
- * Replace the properties of the viewpoint with the provided data.
129
- *
130
- * @remarks The guid will be ommited as it shouldn't change after it has been initially set.
131
- * @remarks The existing selection and exception components will be fully replaced in case new ones are provided.
132
- *
133
- * @param data - An object containing the properties to be set.
134
- * The properties not included in the object will remain unchanged.
135
- *
136
- * @returns The viewpoint instance with the updated properties.
137
- */
138
- set(data: Partial<BCFViewpoint>): this;
139
- /**
140
- * Sets the viewpoint of the camera in the world.
141
- *
142
- * @remarks
143
- * This function calculates the target position based on the viewpoint information.
144
- * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls.
145
- *
146
- * @param transition - Indicates whether the camera movement should have a transition effect.
147
- * Default value is `true`.
148
- *
149
- * @throws An error if the world's camera does not have camera controls.
150
- *
151
- * @returns A Promise that resolves when the camera has been set.
152
- */
153
- go(world?: World, transition?: boolean): Promise<void>;
154
- /**
155
- * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
156
- *
157
- * @remarks
158
- * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
159
- * It then calculates the camera's perspective or orthographic settings based on the camera type.
160
- * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
161
- *
162
- * @throws An error if the world's camera does not have camera controls.
163
- * @throws An error if the world's renderer is not available.
164
- */
165
- updateCamera(world?: World): void;
166
- applyVisibility(): void;
167
- /**
168
- * Applies color to the components in the viewpoint based on their GUIDs.
169
- *
170
- * This function iterates through the `componentColors` map, retrieves the fragment IDs
171
- * corresponding to each color, and then uses the `Classifier` to apply the color to those fragments.
172
- *
173
- * @remarks
174
- * The color is applied using the `Classifier.setColor` method, which sets the color of the specified fragments.
175
- * The color is provided as a hexadecimal string, prefixed with a '#'.
176
- */
177
- applyColors(): void;
178
- /**
179
- * Resets the colors of all components in the viewpoint to their original color.
180
- */
181
- resetColors(): void;
182
- private createComponentTags;
183
- private createColorTags;
184
- /**
185
- * Serializes the viewpoint into a buildingSMART compliant XML string for export.
186
- *
187
- * @param version - The version of the BCF Manager to use for serialization.
188
- * If not provided, the current version of the manager will be used.
189
- *
190
- * @returns A Promise that resolves to an XML string representing the viewpoint.
191
- * The XML string follows the BCF VisualizationInfo schema.
192
- *
193
- * @throws An error if the world's camera does not have camera controls.
194
- * @throws An error if the world's renderer is not available.
195
- */
196
- serialize(version?: string): Promise<string>;
197
- }
@@ -1,23 +0,0 @@
1
- import { BooleanSettingsControl } from "../../Types";
2
- import { Viewpoints } from "../index";
3
- import { Configurator } from "../../ConfigManager";
4
- /**
5
- * Configuration interface for the Viewpoints general behavior.
6
- */
7
- export interface ViewpointsConfig {
8
- /**
9
- * Indicates whether to overwrite the fragments colors when applying viewpoints.
10
- * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any.
11
- * @default false
12
- */
13
- overwriteColors: boolean;
14
- }
15
- type ViewpointsConfigType = {
16
- overwriteColors: BooleanSettingsControl;
17
- };
18
- export declare class ViewpointsConfigManager extends Configurator<Viewpoints, ViewpointsConfigType> {
19
- protected _config: ViewpointsConfigType;
20
- get overwriteColors(): boolean;
21
- set overwriteColors(value: boolean);
22
- }
23
- export {};