@thatopen/components 2.2.0-alpha.1 → 2.2.0

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.
@@ -381,44 +381,6 @@ export declare class Classifier extends Component implements Disposable {
381
381
  resetColor(items: FRAGS.FragmentIdMap): void;
382
382
  protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
383
383
  }
384
- import * as FRAGS from "@thatopen/fragments";
385
- import { Components, Component } from "../../core";
386
- /**
387
- * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
388
- */
389
- export declare class Hider extends Component {
390
- /**
391
- * A unique identifier for the component.
392
- * This UUID is used to register the component within the Components system.
393
- */
394
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
395
- /** {@link Component.enabled} */
396
- enabled: boolean;
397
- constructor(components: Components);
398
- /**
399
- * Sets the visibility of fragments within the 3D scene.
400
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
401
- * If 'items' is provided, only the specified fragments will be affected.
402
- *
403
- * @param visible - The visibility state to set for the fragments.
404
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
405
- * If not provided, all fragments will be affected.
406
- *
407
- * @returns {void}
408
- */
409
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
410
- /**
411
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
412
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
413
- *
414
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
415
- * If not provided, all fragments will be isolated.
416
- *
417
- * @returns {void}
418
- */
419
- isolate(items: FRAGS.FragmentIdMap): void;
420
- private updateCulledVisibility;
421
- }
422
384
  import { Component, Disposable, Event, Components } from "../../core";
423
385
  /**
424
386
  * The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
@@ -469,6 +431,44 @@ export declare class Exploder extends Component implements Disposable {
469
431
  */
470
432
  set(active: boolean): void;
471
433
  }
434
+ import * as FRAGS from "@thatopen/fragments";
435
+ import { Components, Component } from "../../core";
436
+ /**
437
+ * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
438
+ */
439
+ export declare class Hider extends Component {
440
+ /**
441
+ * A unique identifier for the component.
442
+ * This UUID is used to register the component within the Components system.
443
+ */
444
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
445
+ /** {@link Component.enabled} */
446
+ enabled: boolean;
447
+ constructor(components: Components);
448
+ /**
449
+ * Sets the visibility of fragments within the 3D scene.
450
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
451
+ * If 'items' is provided, only the specified fragments will be affected.
452
+ *
453
+ * @param visible - The visibility state to set for the fragments.
454
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
455
+ * If not provided, all fragments will be affected.
456
+ *
457
+ * @returns {void}
458
+ */
459
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
460
+ /**
461
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
462
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
463
+ *
464
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
465
+ * If not provided, all fragments will be isolated.
466
+ *
467
+ * @returns {void}
468
+ */
469
+ isolate(items: FRAGS.FragmentIdMap): void;
470
+ private updateCulledVisibility;
471
+ }
472
472
  import * as WEBIFC from "web-ifc";
473
473
  import * as FRAGS from "@thatopen/fragments";
474
474
  import { IfcFragmentSettings } from "./src";
@@ -1417,23 +1417,51 @@ export declare class Cullers extends Component implements Disposable {
1417
1417
  */
1418
1418
  updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
1419
1419
  }
1420
- import * as THREE from "three";
1421
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
1422
- center: THREE.Vector3;
1423
- halfSizes: THREE.Vector3;
1424
- rotation: THREE.Matrix3;
1425
- transformation: THREE.Matrix4;
1426
- };
1427
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1428
- import * as THREE from "three";
1429
- export declare class MaterialsUtils {
1430
- static isTransparent(material: THREE.Material): boolean;
1420
+ import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
1421
+ import { Components } from "../Components";
1422
+ import { BCFViewpoint, Viewpoint } from "./src";
1423
+ /**
1424
+ * Configuration interface for the Viewpoints general behavior.
1425
+ */
1426
+ interface ViewpointsConfig {
1427
+ /**
1428
+ * Indicates whether to overwrite the fragments colors when applying viewpoints.
1429
+ * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any.
1430
+ * @default false
1431
+ */
1432
+ overwriteColors: boolean;
1431
1433
  }
1432
- export declare class UUID {
1433
- private static _pattern;
1434
- private static _lut;
1435
- static create(): string;
1436
- static validate(uuid: string): void;
1434
+ export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfig> {
1435
+ static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
1436
+ enabled: boolean;
1437
+ /**
1438
+ * A DataMap that stores Viewpoint instances, indexed by their unique identifiers (guid).
1439
+ * This map is used to manage and retrieve Viewpoint instances within the Viewpoints component.
1440
+ */
1441
+ readonly list: DataMap<string, Viewpoint>;
1442
+ /**
1443
+ * Creates a new Viewpoint instance and adds it to the list.
1444
+ *
1445
+ * @param world - The world in which the Viewpoint will be created.
1446
+ * @param data - Optional partial data for the Viewpoint. If not provided, default data will be used.
1447
+ *
1448
+ * @returns The newly created Viewpoint instance.
1449
+ */
1450
+ create(world: World, data?: Partial<BCFViewpoint>): Viewpoint;
1451
+ constructor(components: Components);
1452
+ isSetup: boolean;
1453
+ setup(): void;
1454
+ onSetup: Event<unknown>;
1455
+ config: Required<ViewpointsConfig>;
1456
+ readonly onDisposed: Event<unknown>;
1457
+ /**
1458
+ * Disposes of the Viewpoints component and its associated resources.
1459
+ *
1460
+ * This method is responsible for cleaning up any resources held by the Viewpoints component,
1461
+ * such as disposing of the DataMap of Viewpoint instances and triggering and resetting the
1462
+ * onDisposed event.
1463
+ */
1464
+ dispose(): void;
1437
1465
  }
1438
1466
  import { MiniMap } from "./src";
1439
1467
  import { Component, Updateable, World, Event, Disposable } from "../Types";
@@ -1483,122 +1511,6 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
1483
1511
  update(): void;
1484
1512
  }
1485
1513
  import * as THREE from "three";
1486
- import { Component, Components, Disposable, Event, World } from "../core";
1487
- /**
1488
- * Configuration interface for the VertexPicker component.
1489
- */
1490
- export interface VertexPickerConfig {
1491
- /**
1492
- * If true, only vertices will be picked, not the closest point on the face.
1493
- */
1494
- showOnlyVertex: boolean;
1495
- /**
1496
- * The maximum distance for snapping to a vertex.
1497
- */
1498
- snapDistance: number;
1499
- /**
1500
- * The HTML element to use for previewing the picked vertex.
1501
- */
1502
- previewElement: HTMLElement;
1503
- }
1504
- /**
1505
- * A class that provides functionality for picking vertices in a 3D scene.
1506
- */
1507
- export declare class VertexPicker extends Component implements Disposable {
1508
- /** {@link Disposable.onDisposed} */
1509
- readonly onDisposed: Event<unknown>;
1510
- /**
1511
- * An event that is triggered when a vertex is found.
1512
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1513
- */
1514
- readonly onVertexFound: Event<THREE.Vector3>;
1515
- /**
1516
- * An event that is triggered when a vertex is lost.
1517
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1518
- */
1519
- readonly onVertexLost: Event<THREE.Vector3>;
1520
- /**
1521
- * An event that is triggered when the picker is enabled or disabled
1522
- */
1523
- readonly onEnabled: Event<boolean>;
1524
- /**
1525
- * A reference to the Components instance associated with this VertexPicker.
1526
- */
1527
- components: Components;
1528
- /**
1529
- * A reference to the working plane used for vertex picking.
1530
- * This plane is used to determine which vertices are considered valid for picking.
1531
- * If this value is null, all vertices are considered valid.
1532
- */
1533
- workingPlane: THREE.Plane | null;
1534
- private _pickedPoint;
1535
- private _config;
1536
- private _enabled;
1537
- /**
1538
- * Sets the enabled state of the VertexPicker.
1539
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1540
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1541
- *
1542
- * @param value - The new enabled state.
1543
- */
1544
- set enabled(value: boolean);
1545
- /**
1546
- * Gets the current enabled state of the VertexPicker.
1547
- *
1548
- * @returns The current enabled state.
1549
- */
1550
- get enabled(): boolean;
1551
- /**
1552
- * Sets the configuration for the VertexPicker component.
1553
- *
1554
- * @param value - A Partial object containing the configuration properties to update.
1555
- * The properties not provided in the value object will retain their current values.
1556
- *
1557
- * @example
1558
- * '''typescript
1559
- * vertexPicker.config = {
1560
- * snapDistance: 0.5,
1561
- * showOnlyVertex: true,
1562
- * };
1563
- * '''
1564
- */
1565
- set config(value: Partial<VertexPickerConfig>);
1566
- /**
1567
- * Gets the current configuration for the VertexPicker component.
1568
- *
1569
- * @returns A copy of the current VertexPickerConfig object.
1570
- *
1571
- * @example
1572
- * '''typescript
1573
- * const currentConfig = vertexPicker.config;
1574
- * console.log(currentConfig.snapDistance); // Output: 0.25
1575
- * '''
1576
- */
1577
- get config(): Partial<VertexPickerConfig>;
1578
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
1579
- /** {@link Disposable.dispose} */
1580
- dispose(): void;
1581
- /**
1582
- * Performs the vertex picking operation based on the current state of the VertexPicker.
1583
- *
1584
- * @param world - The World instance to use for raycasting.
1585
- *
1586
- * @returns The current picked point, or null if no point is picked.
1587
- *
1588
- * @remarks
1589
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1590
- * If enabled, it performs raycasting to find the closest intersecting object.
1591
- * It then determines the closest vertex or point on the face, based on the configuration settings.
1592
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1593
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1594
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1595
- */
1596
- get(world: World): THREE.Vector3 | null;
1597
- private getClosestVertex;
1598
- private getVertices;
1599
- private getVertex;
1600
- }
1601
- import * as THREE from "three";
1602
1514
  import { Components } from "../Components";
1603
1515
  import { SimpleCamera } from "..";
1604
1516
  import { NavigationMode, NavModeID, ProjectionManager } from "./src";
@@ -1662,42 +1574,16 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
1662
1574
  private newOrthoCamera;
1663
1575
  private setOrthoPerspCameraAspect;
1664
1576
  }
1665
- import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
1666
- import { Components } from "../Components";
1667
- import { BCFViewpoint, Viewpoint } from "./src";
1577
+ import * as WEBIFC from "web-ifc";
1578
+ import * as FRAG from "@thatopen/fragments";
1579
+ import { Component, Components } from "../../core";
1668
1580
  /**
1669
- * Configuration interface for the Viewpoints general behavior.
1581
+ * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
1670
1582
  */
1671
- interface ViewpointsConfig {
1583
+ export declare class IfcJsonExporter extends Component {
1672
1584
  /**
1673
- * Indicates whether to overwrite the fragments colors when applying viewpoints.
1674
- * @default false
1675
- */
1676
- overwriteColors: boolean;
1677
- }
1678
- export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfig> {
1679
- static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
1680
- enabled: boolean;
1681
- readonly list: DataMap<string, Viewpoint>;
1682
- create(world: World, data?: Partial<BCFViewpoint>): Viewpoint;
1683
- constructor(components: Components);
1684
- isSetup: boolean;
1685
- setup(): void;
1686
- onSetup: Event<unknown>;
1687
- config: Required<ViewpointsConfig>;
1688
- readonly onDisposed: Event<unknown>;
1689
- dispose(): void;
1690
- }
1691
- import * as WEBIFC from "web-ifc";
1692
- import * as FRAG from "@thatopen/fragments";
1693
- import { Component, Components } from "../../core";
1694
- /**
1695
- * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
1696
- */
1697
- export declare class IfcJsonExporter extends Component {
1698
- /**
1699
- * A unique identifier for the component.
1700
- * This UUID is used to register the component within the Components system.
1585
+ * A unique identifier for the component.
1586
+ * This UUID is used to register the component within the Components system.
1701
1587
  */
1702
1588
  static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1703
1589
  /** {@link Component.enabled} */
@@ -1713,6 +1599,13 @@ export declare class IfcJsonExporter extends Component {
1713
1599
  */
1714
1600
  export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1715
1601
  }
1602
+ import * as THREE from "three";
1603
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
1604
+ center: THREE.Vector3;
1605
+ halfSizes: THREE.Vector3;
1606
+ rotation: THREE.Matrix3;
1607
+ transformation: THREE.Matrix4;
1608
+ };
1716
1609
  import * as WEBIFC from "web-ifc";
1717
1610
  import { FragmentsGroup } from "@thatopen/fragments";
1718
1611
  import { Disposable, Event, Component, Components } from "../../core";
@@ -2001,7 +1894,7 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
2001
1894
  */
2002
1895
  static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
2003
1896
  /**
2004
- * Method to set properties data in the model.
1897
+ * Method to add or update entity attributes in the model.
2005
1898
  *
2006
1899
  * @param model - The FragmentsGroup model in which to set the properties.
2007
1900
  * @param dataToSave - An array of objects representing the properties to be saved.
@@ -2123,6 +2016,17 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
2123
2016
  * @throws Will throw an error if any issues occur during the saving process.
2124
2017
  */
2125
2018
  saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
2019
+ /**
2020
+ * Retrieves all the entities of a specific type from the model and returns their express IDs wrapped in Handles.
2021
+ * This is used to make references of an entity inside another entity attributes.
2022
+ *
2023
+ * @param model - The FragmentsGroup model from which to retrieve the entities.
2024
+ * @param type - The type of the entities to retrieve. This should be the express ID of the IFC type.
2025
+ *
2026
+ * @returns A promise that resolves with an array of Handles, each containing the express ID of an entity of the specified type.
2027
+ * @returns null if the model doesn't have any entity of that type
2028
+ */
2029
+ getEntityRef(model: FragmentsGroup, type: number): Promise<WEBIFC.Handle<unknown>[] | null>;
2126
2030
  /**
2127
2031
  * Sets an attribute listener for a specific attribute of an entity in the model.
2128
2032
  * The listener will trigger an event whenever the attribute's value changes.
@@ -2145,6 +2049,133 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
2145
2049
  private newSingleProperty;
2146
2050
  }
2147
2051
  import * as THREE from "three";
2052
+ export declare class MaterialsUtils {
2053
+ static isTransparent(material: THREE.Material): boolean;
2054
+ }
2055
+ export declare class UUID {
2056
+ private static _pattern;
2057
+ private static _lut;
2058
+ static create(): string;
2059
+ static validate(uuid: string): void;
2060
+ }
2061
+ import * as THREE from "three";
2062
+ import { Component, Components, Disposable, Event, World } from "../core";
2063
+ /**
2064
+ * Configuration interface for the VertexPicker component.
2065
+ */
2066
+ export interface VertexPickerConfig {
2067
+ /**
2068
+ * If true, only vertices will be picked, not the closest point on the face.
2069
+ */
2070
+ showOnlyVertex: boolean;
2071
+ /**
2072
+ * The maximum distance for snapping to a vertex.
2073
+ */
2074
+ snapDistance: number;
2075
+ /**
2076
+ * The HTML element to use for previewing the picked vertex.
2077
+ */
2078
+ previewElement: HTMLElement;
2079
+ }
2080
+ /**
2081
+ * A class that provides functionality for picking vertices in a 3D scene.
2082
+ */
2083
+ export declare class VertexPicker extends Component implements Disposable {
2084
+ /** {@link Disposable.onDisposed} */
2085
+ readonly onDisposed: Event<unknown>;
2086
+ /**
2087
+ * An event that is triggered when a vertex is found.
2088
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
2089
+ */
2090
+ readonly onVertexFound: Event<THREE.Vector3>;
2091
+ /**
2092
+ * An event that is triggered when a vertex is lost.
2093
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
2094
+ */
2095
+ readonly onVertexLost: Event<THREE.Vector3>;
2096
+ /**
2097
+ * An event that is triggered when the picker is enabled or disabled
2098
+ */
2099
+ readonly onEnabled: Event<boolean>;
2100
+ /**
2101
+ * A reference to the Components instance associated with this VertexPicker.
2102
+ */
2103
+ components: Components;
2104
+ /**
2105
+ * A reference to the working plane used for vertex picking.
2106
+ * This plane is used to determine which vertices are considered valid for picking.
2107
+ * If this value is null, all vertices are considered valid.
2108
+ */
2109
+ workingPlane: THREE.Plane | null;
2110
+ private _pickedPoint;
2111
+ private _config;
2112
+ private _enabled;
2113
+ /**
2114
+ * Sets the enabled state of the VertexPicker.
2115
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
2116
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
2117
+ *
2118
+ * @param value - The new enabled state.
2119
+ */
2120
+ set enabled(value: boolean);
2121
+ /**
2122
+ * Gets the current enabled state of the VertexPicker.
2123
+ *
2124
+ * @returns The current enabled state.
2125
+ */
2126
+ get enabled(): boolean;
2127
+ /**
2128
+ * Sets the configuration for the VertexPicker component.
2129
+ *
2130
+ * @param value - A Partial object containing the configuration properties to update.
2131
+ * The properties not provided in the value object will retain their current values.
2132
+ *
2133
+ * @example
2134
+ * '''typescript
2135
+ * vertexPicker.config = {
2136
+ * snapDistance: 0.5,
2137
+ * showOnlyVertex: true,
2138
+ * };
2139
+ * '''
2140
+ */
2141
+ set config(value: Partial<VertexPickerConfig>);
2142
+ /**
2143
+ * Gets the current configuration for the VertexPicker component.
2144
+ *
2145
+ * @returns A copy of the current VertexPickerConfig object.
2146
+ *
2147
+ * @example
2148
+ * '''typescript
2149
+ * const currentConfig = vertexPicker.config;
2150
+ * console.log(currentConfig.snapDistance); // Output: 0.25
2151
+ * '''
2152
+ */
2153
+ get config(): Partial<VertexPickerConfig>;
2154
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
2155
+ /** {@link Disposable.dispose} */
2156
+ dispose(): void;
2157
+ /**
2158
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
2159
+ *
2160
+ * @param world - The World instance to use for raycasting.
2161
+ *
2162
+ * @returns The current picked point, or null if no point is picked.
2163
+ *
2164
+ * @remarks
2165
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
2166
+ * If enabled, it performs raycasting to find the closest intersecting object.
2167
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
2168
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
2169
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
2170
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
2171
+ */
2172
+ get(world: World): THREE.Vector3 | null;
2173
+ private getClosestVertex;
2174
+ private getVertices;
2175
+ private getVertex;
2176
+ }
2177
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
2178
+ import * as THREE from "three";
2148
2179
  import * as FRAGS from "@thatopen/fragments";
2149
2180
  import { Component, Components } from "../../core";
2150
2181
  /**
@@ -2249,13 +2280,14 @@ export declare class MeasurementUtils extends Component {
2249
2280
  private getVolumeOfMesh;
2250
2281
  private getSignedVolumeOfTriangle;
2251
2282
  }
2283
+ import { XMLParser } from "fast-xml-parser";
2252
2284
  import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core/Types";
2253
2285
  import { BCFTopic, BCFTopicsConfig, Topic } from "./src";
2254
2286
  import { Viewpoint } from "../../core/Viewpoints";
2255
2287
  export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfig> {
2256
2288
  static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
2257
2289
  enabled: boolean;
2258
- private _xmlParser;
2290
+ static xmlParser: XMLParser;
2259
2291
  config: Required<BCFTopicsConfig>;
2260
2292
  readonly list: DataMap<string, Topic>;
2261
2293
  readonly onSetup: Event<unknown>;
@@ -2271,6 +2303,13 @@ export declare class BCFTopics extends Component implements Disposable, Configur
2271
2303
  */
2272
2304
  create(data?: Partial<BCFTopic>): Topic;
2273
2305
  readonly onDisposed: Event<unknown>;
2306
+ /**
2307
+ * Disposes of the BCFTopics component and triggers the onDisposed event.
2308
+ *
2309
+ * @remarks
2310
+ * This method clears the list of topics and triggers the onDisposed event.
2311
+ * It also resets the onDisposed event listener.
2312
+ */
2274
2313
  dispose(): void;
2275
2314
  /**
2276
2315
  * Retrieves the unique set of topic types used across all topics.
@@ -2335,11 +2374,33 @@ export declare class BCFTopics extends Component implements Disposable, Configur
2335
2374
  private getMarkupLabels;
2336
2375
  private getMarkupViewpoints;
2337
2376
  private getMarkupRelatedTopics;
2338
- load(world: World, data: Uint8Array): Promise<{
2377
+ /**
2378
+ * Loads BCF (Building Collaboration Format) data into the engine.
2379
+ *
2380
+ * @param world - The default world where the viewpoints are going to be created.
2381
+ * @param data - The BCF data to load.
2382
+ *
2383
+ * @returns A promise that resolves to an object containing the created viewpoints and topics.
2384
+ *
2385
+ * @throws An error if the BCF version is not supported.
2386
+ */
2387
+ load(data: Uint8Array, world: World): Promise<{
2339
2388
  viewpoints: Viewpoint[];
2340
2389
  topics: Topic[];
2341
2390
  }>;
2342
2391
  }
2392
+ /**
2393
+ * A Set of unique numbers representing different types of IFC geometries.
2394
+ */
2395
+ export declare const GeometryTypes: Set<number>;
2396
+ import * as WEBIFC from "web-ifc";
2397
+ import { IfcItemsCategories } from "../../../ifc";
2398
+ export declare class SpatialStructure {
2399
+ itemsByFloor: IfcItemsCategories;
2400
+ private _units;
2401
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2402
+ cleanUp(): void;
2403
+ }
2343
2404
  import * as THREE from "three";
2344
2405
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2345
2406
  /**
@@ -2429,10 +2490,6 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2429
2490
  resize(size?: THREE.Vector2): void;
2430
2491
  private updatePlanes;
2431
2492
  }
2432
- /**
2433
- * A Set of unique numbers representing different types of IFC geometries.
2434
- */
2435
- export declare const GeometryTypes: Set<number>;
2436
2493
  import * as FRAGS from "@thatopen/fragments";
2437
2494
  import * as WEBIFC from "web-ifc";
2438
2495
  export declare class SpatialIdsFinder {
@@ -2505,14 +2562,6 @@ export declare const IfcElements: {
2505
2562
  export declare const IfcCategoryMap: {
2506
2563
  [key: number]: string;
2507
2564
  };
2508
- import * as WEBIFC from "web-ifc";
2509
- import { IfcItemsCategories } from "../../../ifc";
2510
- export declare class SpatialStructure {
2511
- itemsByFloor: IfcItemsCategories;
2512
- private _units;
2513
- setUp(webIfc: WEBIFC.IfcAPI): void;
2514
- cleanUp(): void;
2515
- }
2516
2565
  import * as FRAGS from "@thatopen/fragments";
2517
2566
  export declare class IfcPropertiesUtils {
2518
2567
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
@@ -2538,528 +2587,381 @@ export declare class IfcPropertiesUtils {
2538
2587
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2539
2588
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2540
2589
  }
2541
- import * as THREE from "three";
2542
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2590
+ import { Topic } from "..";
2591
+ import { Viewpoint } from "../../../core/Viewpoints";
2592
+ import { Components } from "../../../core/Components";
2543
2593
  /**
2544
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2545
- *
2546
- * @template T - The type of the scene. Default is BaseScene.
2547
- * @template U - The type of the camera. Default is BaseCamera.
2548
- * @template S - The type of the renderer. Default is BaseRenderer.
2594
+ * Represents a comment in a BCF Topic.
2549
2595
  */
2550
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2551
- /**
2552
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2553
- */
2554
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2555
- /** {@link Updateable.onAfterUpdate} */
2556
- readonly onAfterUpdate: Event<unknown>;
2557
- /** {@link Updateable.onBeforeUpdate} */
2558
- readonly onBeforeUpdate: Event<unknown>;
2559
- /** {@link Disposable.onDisposed} */
2560
- readonly onDisposed: Event<unknown>;
2561
- /**
2562
- * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
2563
- */
2564
- isDisposing: boolean;
2596
+ export declare class Comment {
2597
+ date: Date;
2598
+ author: string;
2599
+ guid: string;
2600
+ viewpoint?: Viewpoint;
2601
+ modifiedAuthor?: string;
2602
+ modifiedDate?: Date;
2603
+ topic?: Topic;
2604
+ private _components;
2605
+ private _comment;
2565
2606
  /**
2566
- * Indicates whether the world is currently enabled.
2567
- * When disabled, the world will not be updated.
2607
+ * Sets the comment text and updates the modified date and author.
2608
+ * The author will be the one defined in BCFTopics.config.author
2609
+ * @param value - The new comment text.
2568
2610
  */
2569
- enabled: boolean;
2611
+ set comment(value: string);
2570
2612
  /**
2571
- * A unique identifier for the world.
2613
+ * Gets the comment text.
2614
+ * @returns The comment text.
2572
2615
  */
2573
- uuid: string;
2616
+ get comment(): string;
2574
2617
  /**
2575
- * An optional name for the world.
2618
+ * Constructs a new BCF Topic Comment instance.
2619
+ * @param components - The Components instance.
2620
+ * @param text - The initial comment text.
2576
2621
  */
2577
- name?: string;
2578
- private _scene?;
2579
- private _camera?;
2580
- private _renderer;
2622
+ constructor(components: Components, text: string);
2581
2623
  /**
2582
- * Getter for the scene. If no scene is initialized, it throws an error.
2583
- * @returns The current scene.
2624
+ * Serializes the Comment instance into a BCF compliant XML string.
2625
+ *
2626
+ * @returns A string representing the Comment in BCFv2 XML format.
2584
2627
  */
2585
- get scene(): T;
2586
- /**
2587
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2588
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2589
- * @param scene - The new scene to be set.
2590
- */
2591
- set scene(scene: T);
2592
- /**
2593
- * Getter for the camera. If no camera is initialized, it throws an error.
2594
- * @returns The current camera.
2595
- */
2596
- get camera(): U;
2597
- /**
2598
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2599
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2600
- * @param camera - The new camera to be set.
2601
- */
2602
- set camera(camera: U);
2603
- /**
2604
- * Getter for the renderer.
2605
- * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
2606
- */
2607
- get renderer(): S | null;
2628
+ serialize(): string;
2629
+ }
2630
+ import { InverseAttribute } from "./types";
2631
+ export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
2632
+ forRelating: InverseAttribute;
2633
+ forRelated: InverseAttribute;
2634
+ }>;
2635
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
2636
+ /**
2637
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2638
+ */
2639
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2608
2640
  /**
2609
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2610
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2611
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2612
- * @param renderer - The new renderer to be set or null to remove the current renderer.
2641
+ * Amount of properties to be streamed.
2642
+ * Defaults to 100 properties.
2613
2643
  */
2614
- set renderer(renderer: S | null);
2615
- /** {@link Updateable.update} */
2616
- update(delta?: number): void;
2617
- /** {@link Disposable.dispose} */
2618
- dispose(disposeResources?: boolean): void;
2644
+ propertiesSize: number;
2619
2645
  }
2620
2646
  import * as THREE from "three";
2621
- import { BaseScene, Configurable, Event } from "../../Types";
2622
2647
  import { Components } from "../../Components";
2648
+ import { AsyncEvent, Event, World } from "../../Types";
2623
2649
  /**
2624
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
2625
- */
2626
- export interface SimpleSceneConfig {
2627
- directionalLight: {
2628
- color: THREE.Color;
2629
- intensity: number;
2630
- position: THREE.Vector3;
2631
- };
2632
- ambientLight: {
2633
- color: THREE.Color;
2634
- intensity: number;
2635
- };
2636
- }
2637
- /**
2638
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2650
+ * Settings to configure the CullerRenderer.
2639
2651
  */
2640
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2641
- /** {@link Configurable.isSetup} */
2642
- isSetup: boolean;
2652
+ export interface CullerRendererSettings {
2643
2653
  /**
2644
- * The underlying Three.js scene object.
2645
- * It is used to define the 3D space containing objects, lights, and cameras.
2654
+ * Interval in milliseconds at which the visibility check should be performed.
2655
+ * Default value is 1000.
2646
2656
  */
2647
- three: THREE.Scene;
2648
- /** {@link Configurable.onSetup} */
2649
- readonly onSetup: Event<SimpleScene>;
2657
+ updateInterval?: number;
2650
2658
  /**
2651
- * Configuration interface for the {@link SimpleScene}.
2652
- * Defines properties for directional and ambient lights.
2659
+ * Width of the render target used for visibility checks.
2660
+ * Default value is 512.
2653
2661
  */
2654
- config: Required<SimpleSceneConfig>;
2655
- constructor(components: Components);
2656
- /** {@link Configurable.setup} */
2657
- setup(config?: Partial<SimpleSceneConfig>): void;
2662
+ width?: number;
2663
+ /**
2664
+ * Height of the render target used for visibility checks.
2665
+ * Default value is 512.
2666
+ */
2667
+ height?: number;
2668
+ /**
2669
+ * Whether the visibility check should be performed automatically.
2670
+ * Default value is true.
2671
+ */
2672
+ autoUpdate?: boolean;
2658
2673
  }
2659
- import * as THREE from "three";
2660
- import { BaseRenderer, Event } from "../../Types";
2661
- import { Components } from "../../Components";
2662
2674
  /**
2663
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2675
+ * A base renderer to determine visibility on screen.
2664
2676
  */
2665
- export declare class SimpleRenderer extends BaseRenderer {
2677
+ export declare class CullerRenderer {
2678
+ /** {@link Disposable.onDisposed} */
2679
+ readonly onDisposed: Event<string>;
2666
2680
  /**
2667
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2668
- * Default is 'true'.
2681
+ * Fires after making the visibility check to the meshes. It lists the
2682
+ * meshes that are currently visible, and the ones that were visible
2683
+ * just before but not anymore.
2669
2684
  */
2670
- enabled: boolean;
2685
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2671
2686
  /**
2672
- * The HTML container of the THREE.js canvas where the scene is rendered.
2687
+ * Whether this renderer is active or not. If not, it won't render anything.
2673
2688
  */
2674
- container: HTMLElement;
2689
+ enabled: boolean;
2675
2690
  /**
2676
- * The THREE.js WebGLRenderer instance.
2691
+ * Needs to check whether there are objects that need to be hidden or shown.
2692
+ * You can bind this to the camera movement, to a certain interval, etc.
2677
2693
  */
2678
- three: THREE.WebGLRenderer;
2679
- protected _canvas: HTMLCanvasElement;
2680
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2681
- protected _resizeObserver: ResizeObserver | null;
2682
- protected onContainerUpdated: Event<unknown>;
2683
- private _resizing;
2694
+ needsUpdate: boolean;
2684
2695
  /**
2685
- * Constructor for the SimpleRenderer class.
2686
- *
2687
- * @param components - The components instance.
2688
- * @param container - The HTML container where the THREE.js canvas will be rendered.
2689
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2696
+ * Render the internal scene used to determine the object visibility. Used
2697
+ * for debugging purposes.
2690
2698
  */
2691
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2692
- /** {@link Updateable.update} */
2693
- update(): void;
2699
+ renderDebugFrame: boolean;
2700
+ /** The components instance to which this renderer belongs. */
2701
+ components: Components;
2702
+ /** The world instance to which this renderer belongs. */
2703
+ readonly world: World;
2704
+ /** The THREE.js renderer used to make the visibility test. */
2705
+ readonly renderer: THREE.WebGLRenderer;
2706
+ protected autoUpdate: boolean;
2707
+ protected updateInterval: number;
2708
+ protected readonly worker: Worker;
2709
+ protected readonly scene: THREE.Scene;
2710
+ private _width;
2711
+ private _height;
2712
+ private _availableColor;
2713
+ private readonly renderTarget;
2714
+ private readonly bufferSize;
2715
+ private readonly _buffer;
2716
+ protected _isWorkerBusy: boolean;
2717
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2694
2718
  /** {@link Disposable.dispose} */
2695
2719
  dispose(): void;
2696
- /** {@link Resizeable.getSize}. */
2697
- getSize(): THREE.Vector2;
2698
- /** {@link Resizeable.resize} */
2699
- resize: (size?: THREE.Vector2) => void;
2700
2720
  /**
2701
- * Sets up and manages the event listeners for the renderer.
2702
- *
2703
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2704
- *
2705
- * @throws Will throw an error if the renderer does not have an HTML container.
2721
+ * The function that the culler uses to reprocess the scene. Generally it's
2722
+ * better to call needsUpdate, but you can also call this to force it.
2723
+ * @param force if true, it will refresh the scene even if needsUpdate is
2724
+ * not true.
2706
2725
  */
2707
- setupEvents(active: boolean): void;
2708
- private resizeEvent;
2709
- private setupRenderer;
2710
- private onContextLost;
2711
- private onContextBack;
2726
+ updateVisibility: (force?: boolean) => Promise<void>;
2727
+ protected getAvailableColor(): {
2728
+ r: number;
2729
+ g: number;
2730
+ b: number;
2731
+ code: string;
2732
+ };
2733
+ protected increaseColor(): void;
2734
+ protected decreaseColor(): void;
2735
+ private applySettings;
2712
2736
  }
2713
2737
  import * as THREE from "three";
2714
- import CameraControls from "camera-controls";
2715
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2738
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2716
2739
  import { Components } from "../../Components";
2740
+ import { Event, World, Disposable } from "../../Types";
2717
2741
  /**
2718
- * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
2742
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2719
2743
  */
2720
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2721
- /** {@link Updateable.onBeforeUpdate} */
2722
- readonly onBeforeUpdate: Event<SimpleCamera>;
2723
- /** {@link Updateable.onAfterUpdate} */
2724
- readonly onAfterUpdate: Event<SimpleCamera>;
2725
- /**
2726
- * Event that is triggered when the aspect of the camera has been updated.
2727
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
2728
- */
2729
- readonly onAspectUpdated: Event<unknown>;
2730
- /** {@link Disposable.onDisposed} */
2731
- readonly onDisposed: Event<string>;
2744
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2732
2745
  /**
2733
- * A three.js PerspectiveCamera or OrthographicCamera instance.
2734
- * This camera is used for rendering the scene.
2746
+ * Event triggered when the visibility of meshes is updated.
2747
+ * Contains two sets: seen and unseen.
2735
2748
  */
2736
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2737
- private _allControls;
2749
+ readonly onViewUpdated: Event<{
2750
+ seen: Set<THREE.Mesh>;
2751
+ unseen: Set<THREE.Mesh>;
2752
+ }>;
2738
2753
  /**
2739
- * The object that controls the camera. An instance of
2740
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2741
- * Transforming the camera directly will have no effect: you need to use this
2742
- * object to move, rotate, look at objects, etc.
2754
+ * Pixels in screen a geometry must occupy to be considered "seen".
2755
+ * Default value is 100.
2743
2756
  */
2744
- get controls(): CameraControls;
2757
+ threshold: number;
2745
2758
  /**
2746
- * Getter for the enabled state of the camera controls.
2747
- * If the current world is null, it returns false.
2748
- * Otherwise, it returns the enabled state of the camera controls.
2749
- *
2750
- * @returns {boolean} The enabled state of the camera controls.
2759
+ * Map of color code to THREE.InstancedMesh.
2760
+ * Used to keep track of color-coded meshes.
2751
2761
  */
2752
- get enabled(): boolean;
2762
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2753
2763
  /**
2754
- * Setter for the enabled state of the camera controls.
2755
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2756
- *
2757
- * @param {boolean} enabled - The new enabled state of the camera controls.
2764
+ * Flag to indicate if the renderer is currently processing.
2765
+ * Used to prevent concurrent processing.
2758
2766
  */
2759
- set enabled(enabled: boolean);
2760
- constructor(components: Components);
2767
+ isProcessing: boolean;
2768
+ private _colorCodeMeshMap;
2769
+ private _meshIDColorCodeMap;
2770
+ private _currentVisibleMeshes;
2771
+ private _recentlyHiddenMeshes;
2772
+ private _intervalID;
2773
+ private readonly _transparentMat;
2774
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2761
2775
  /** {@link Disposable.dispose} */
2762
2776
  dispose(): void;
2763
- /** {@link Updateable.update} */
2764
- update(_delta: number): void;
2765
2777
  /**
2766
- * Updates the aspect of the camera to match the size of the
2767
- * {@link Components.renderer}.
2778
+ * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
2779
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2780
+ * @returns {void}
2768
2781
  */
2769
- updateAspect: () => void;
2770
- private setupCamera;
2771
- private newCameraControls;
2772
- private setupEvents;
2773
- private static getSubsetOfThree;
2774
- }
2775
- import { IfcFragmentSettings } from "../../IfcLoader/src";
2776
- /**
2777
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2778
- */
2779
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2782
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2780
2783
  /**
2781
- * Amount of properties to be streamed.
2782
- * Defaults to 100 properties.
2784
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2785
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2786
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2787
+ * @returns {void}
2783
2788
  */
2784
- propertiesSize: number;
2789
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2790
+ /**
2791
+ * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
2792
+ *
2793
+ * @param meshes - The meshes to update.
2794
+ *
2795
+ * @returns {void}
2796
+ */
2797
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
2798
+ private handleWorkerMessage;
2799
+ private getAvailableMaterial;
2785
2800
  }
2786
- import { Topic } from "..";
2787
- import { Viewpoint } from "../../../core/Viewpoints";
2788
- import { Components } from "../../../core/Components";
2801
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2789
2802
  /**
2790
- * Represents a comment in a BCF Topic.
2803
+ * 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.
2791
2804
  */
2792
- export declare class Comment {
2793
- date: Date;
2794
- author: string;
2795
- guid: string;
2796
- viewpoint?: Viewpoint;
2797
- modifiedAuthor?: string;
2798
- modifiedDate?: Date;
2799
- topic?: Topic;
2800
- private _components;
2801
- private _comment;
2802
- /**
2803
- * Sets the comment text and updates the modified date and author.
2804
- * The author will be the one defined in BCFTopics.config.author
2805
- * @param value - The new comment text.
2806
- */
2807
- set comment(value: string);
2805
+ export declare class AsyncEvent<T> {
2808
2806
  /**
2809
- * Gets the comment text.
2810
- * @returns The comment text.
2807
+ * Add a callback to this event instance.
2808
+ * @param handler - the callback to be added to this event.
2811
2809
  */
2812
- get comment(): string;
2810
+ add(handler: T extends void ? {
2811
+ (): Promise<void>;
2812
+ } : {
2813
+ (data: T): Promise<void>;
2814
+ }): void;
2813
2815
  /**
2814
- * Constructs a new BCF Topic Comment instance.
2815
- * @param components - The Components instance.
2816
- * @param text - The initial comment text.
2816
+ * Removes a callback from this event instance.
2817
+ * @param handler - the callback to be removed from this event.
2817
2818
  */
2818
- constructor(components: Components, text: string);
2819
- serialize(): string;
2819
+ remove(handler: T extends void ? {
2820
+ (): Promise<void>;
2821
+ } : {
2822
+ (data: T): Promise<void>;
2823
+ }): void;
2824
+ /** Triggers all the callbacks assigned to this event. */
2825
+ trigger: (data?: T) => Promise<void>;
2826
+ /** Gets rid of all the suscribed events. */
2827
+ reset(): void;
2828
+ private handlers;
2820
2829
  }
2821
- import * as THREE from "three";
2822
- import { Components } from "../../Components";
2823
- import { Event, World, Disposable } from "../../Types";
2824
- import { Mouse } from "./mouse";
2825
2830
  /**
2826
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
2831
+ * 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.
2827
2832
  */
2828
- export declare class SimpleRaycaster implements Disposable {
2829
- /** {@link Component.enabled} */
2830
- enabled: boolean;
2831
- /** The components instance to which this Raycaster belongs. */
2832
- components: Components;
2833
- /** {@link Disposable.onDisposed} */
2834
- readonly onDisposed: Event<unknown>;
2835
- /** The position of the mouse in the screen. */
2836
- readonly mouse: Mouse;
2837
- /**
2838
- * A reference to the Three.js Raycaster instance.
2839
- * This is used for raycasting operations.
2840
- */
2841
- readonly three: THREE.Raycaster;
2842
- /**
2843
- * A reference to the world instance to which this Raycaster belongs.
2844
- * This is used to access the camera and meshes.
2845
- */
2846
- world: World;
2847
- constructor(components: Components, world: World);
2848
- /** {@link Disposable.dispose} */
2849
- dispose(): void;
2833
+ export declare class Event<T> {
2850
2834
  /**
2851
- * Throws a ray from the camera to the mouse or touch event point and returns
2852
- * the first item found. This also takes into account the clipping planes
2853
- * used by the renderer.
2854
- *
2855
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2856
- * to query. If not provided, it will query all the meshes stored in
2857
- * {@link Components.meshes}.
2835
+ * Add a callback to this event instance.
2836
+ * @param handler - the callback to be added to this event.
2858
2837
  */
2859
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2838
+ add(handler: T extends void ? {
2839
+ (): void;
2840
+ } : {
2841
+ (data: T): void;
2842
+ }): void;
2860
2843
  /**
2861
- * Casts a ray from a given origin in a given direction and returns the first item found.
2862
- * This method also takes into account the clipping planes used by the renderer.
2863
- *
2864
- * @param origin - The origin of the ray.
2865
- * @param direction - The direction of the ray.
2866
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2867
- * @returns The first intersection found or 'null' if no intersection was found.
2844
+ * Removes a callback from this event instance.
2845
+ * @param handler - the callback to be removed from this event.
2868
2846
  */
2869
- castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
2870
- private intersect;
2871
- private filterClippingPlanes;
2847
+ remove(handler: T extends void ? {
2848
+ (): void;
2849
+ } : {
2850
+ (data: T): void;
2851
+ }): void;
2852
+ /** Triggers all the callbacks assigned to this event. */
2853
+ trigger: (data?: T) => void;
2854
+ /** Gets rid of all the suscribed events. */
2855
+ reset(): void;
2856
+ private handlers;
2872
2857
  }
2873
2858
  import * as THREE from "three";
2874
- import { Disposable, Event } from "../../Types";
2859
+ import CameraControls from "camera-controls";
2860
+ import { Event } from "./event";
2875
2861
  /**
2876
- * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
2862
+ * 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.
2877
2863
  */
2878
- export declare class Mouse implements Disposable {
2879
- dom: HTMLCanvasElement;
2880
- private _event?;
2881
- private _position;
2882
- /** {@link Disposable.onDisposed} */
2883
- readonly onDisposed: Event<unknown>;
2884
- constructor(dom: HTMLCanvasElement);
2864
+ export interface Disposable {
2885
2865
  /**
2886
- * The real position of the mouse of the Three.js canvas.
2866
+ * Destroys the object from memory to prevent a
2867
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
2887
2868
  */
2888
- get position(): THREE.Vector2;
2889
- /** {@link Disposable.dispose} */
2890
- dispose(): void;
2891
- private getPositionY;
2892
- private getPositionX;
2893
- private updateMouseInfo;
2894
- private setupEvents;
2895
- }
2896
- import { InverseAttribute } from "./types";
2897
- export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
2898
- forRelating: InverseAttribute;
2899
- forRelated: InverseAttribute;
2900
- }>;
2901
- import { SimplePlane } from "../../Clipper";
2902
- import { DataSet } from "../../Types";
2903
- export interface ViewpointCamera {
2904
- direction: {
2905
- x: number;
2906
- y: number;
2907
- z: number;
2908
- };
2909
- position: {
2910
- x: number;
2911
- y: number;
2912
- z: number;
2913
- };
2914
- aspectRatio: number;
2915
- }
2916
- export interface ViewpointPerspectiveCamera extends ViewpointCamera {
2917
- fov: number;
2918
- }
2919
- export interface ViewpointOrthographicCamera extends ViewpointCamera {
2920
- viewToWorldScale: number;
2921
- }
2922
- export interface BCFViewpoint {
2923
- title?: string;
2924
- guid: string;
2925
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
2926
- selectionComponents: Iterable<string>;
2927
- exceptionComponents: Iterable<string>;
2928
- clippingPlanes: DataSet<SimplePlane>;
2929
- spacesVisible: boolean;
2930
- spaceBoundariesVisible: boolean;
2931
- openingsVisible: boolean;
2932
- defaultVisibility: boolean;
2933
- }
2934
- import * as THREE from "three";
2935
- import * as FRAGS from "@thatopen/fragments";
2936
- import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
2937
- import { CameraProjection } from "../../OrthoPerspectiveCamera";
2938
- import { Components } from "../../Components";
2939
- import { DataMap, DataSet, World } from "../../Types";
2940
- import { SimplePlane } from "../../Clipper";
2941
- export declare class Viewpoint implements BCFViewpoint {
2942
- title?: string;
2943
- guid: string;
2944
- clippingPlanes: DataSet<SimplePlane>;
2945
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
2946
- readonly exceptionComponents: DataSet<string>;
2947
- readonly selectionComponents: DataSet<string>;
2948
- readonly componentColors: DataMap<string, string[]>;
2949
- spacesVisible: boolean;
2950
- spaceBoundariesVisible: boolean;
2951
- openingsVisible: boolean;
2952
- defaultVisibility: boolean;
2953
- private get _selectionModelIdMap();
2954
- private get _exceptionModelIdMap();
2955
- get selection(): FRAGS.FragmentIdMap;
2956
- get exception(): FRAGS.FragmentIdMap;
2957
- get projection(): CameraProjection;
2958
- get position(): THREE.Vector3;
2959
- get direction(): THREE.Vector3;
2960
- private _components;
2961
- readonly world: World;
2962
- private get _managerVersion();
2963
- get topics(): import("../../../openbim/BCFTopics").Topic[];
2964
- constructor(components: Components, world: World, _config?: {
2965
- data?: Partial<BCFViewpoint>;
2966
- setCamera?: boolean;
2967
- });
2968
- addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): Promise<void>;
2969
- set(data: Partial<BCFViewpoint>): this;
2970
- go(transition?: boolean): Promise<void>;
2971
- updateCamera(): void;
2972
- colorize(): void;
2973
- resetColors(): void;
2974
- private createComponentTags;
2975
- serialize(version?: import("../../../openbim/BCFTopics").BCFVersion): Promise<string>;
2869
+ dispose: () => void | Promise<void>;
2870
+ /** Fired after the tool has been disposed. */
2871
+ readonly onDisposed: Event<any>;
2976
2872
  }
2977
- import * as THREE from "three";
2978
- import { Hideable, Event, World, Disposable } from "../../Types";
2979
- import { Components } from "../../Components";
2980
2873
  /**
2981
- * Configuration interface for the {@link SimpleGrid} class.
2874
+ * 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).
2982
2875
  */
2983
- export interface GridConfig {
2876
+ export interface Hideable {
2984
2877
  /**
2985
- * The color of the grid lines.
2878
+ * Whether the geometric representation of this component is
2879
+ * currently visible or not in the
2880
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2986
2881
  */
2987
- color: THREE.Color;
2882
+ visible: boolean;
2883
+ }
2884
+ /**
2885
+ * 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.
2886
+ */
2887
+ export interface Resizeable {
2988
2888
  /**
2989
- * The size of the primary grid lines.
2889
+ * Sets size of this component (e.g. the resolution of a
2890
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2891
+ * component.
2990
2892
  */
2991
- size1: number;
2893
+ resize: (size?: THREE.Vector2) => void;
2894
+ /** Event that fires when the component has been resized. */
2895
+ onResize: Event<THREE.Vector2>;
2992
2896
  /**
2993
- * The size of the secondary grid lines.
2897
+ * Gets the current size of this component (e.g. the resolution of a
2898
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2899
+ * component.
2994
2900
  */
2995
- size2: number;
2901
+ getSize: () => THREE.Vector2;
2902
+ }
2903
+ /** Whether this component should be updated each frame. */
2904
+ export interface Updateable {
2905
+ /** Actions that should be executed after updating the component. */
2906
+ onAfterUpdate: Event<any>;
2907
+ /** Actions that should be executed before updating the component. */
2908
+ onBeforeUpdate: Event<any>;
2996
2909
  /**
2997
- * The distance at which the grid lines start to fade away.
2910
+ * Function used to update the state of this component each frame. For
2911
+ * instance, a renderer component will make a render each frame.
2998
2912
  */
2999
- distance: number;
2913
+ update(delta?: number): void;
2914
+ }
2915
+ /** Basic type to describe the progress of any kind of process. */
2916
+ export interface Progress {
2917
+ /** The amount of things that have been done already. */
2918
+ current: number;
2919
+ /** The total amount of things to be done by the process. */
2920
+ total: number;
3000
2921
  }
3001
2922
  /**
3002
- * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
2923
+ * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
3003
2924
  */
3004
- export declare class SimpleGrid implements Hideable, Disposable {
3005
- /** {@link Disposable.onDisposed} */
3006
- readonly onDisposed: Event<unknown>;
3007
- /** The world instance to which this Raycaster belongs. */
3008
- world: World;
3009
- /** The components instance to which this grid belongs. */
3010
- components: Components;
3011
- /** {@link Hideable.visible} */
3012
- get visible(): boolean;
3013
- /** {@link Hideable.visible} */
3014
- set visible(visible: boolean);
3015
- /** The material of the grid. */
3016
- get material(): THREE.ShaderMaterial;
2925
+ export interface Createable {
2926
+ /** Creates a new instance of an element (e.g. a new Dimension). */
2927
+ create: (data: any) => void;
3017
2928
  /**
3018
- * Whether the grid should fade away with distance. Recommended to be true for
3019
- * perspective cameras and false for orthographic cameras.
2929
+ * Finish the creation process of the component, successfully creating an
2930
+ * instance of whatever the component creates.
3020
2931
  */
3021
- get fade(): boolean;
2932
+ endCreation?: (data: any) => void;
3022
2933
  /**
3023
- * Whether the grid should fade away with distance. Recommended to be true for
3024
- * perspective cameras and false for orthographic cameras.
2934
+ * Cancels the creation process of the component, going back to the state
2935
+ * before starting to create.
3025
2936
  */
3026
- set fade(active: boolean);
3027
- /** The Three.js mesh that contains the infinite grid. */
3028
- readonly three: THREE.Mesh;
3029
- private _fade;
3030
- constructor(components: Components, world: World, config: GridConfig);
3031
- /** {@link Disposable.dispose} */
3032
- dispose(): void;
3033
- private setupEvents;
3034
- private updateZoom;
2937
+ cancelCreation?: (data: any) => void;
2938
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
2939
+ delete: (data: any) => void;
3035
2940
  }
3036
2941
  /**
3037
- * 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.
2942
+ * Whether this component supports to be configured.
3038
2943
  */
3039
- export declare class Event<T> {
3040
- /**
3041
- * Add a callback to this event instance.
3042
- * @param handler - the callback to be added to this event.
2944
+ export interface Configurable<T extends Record<string, any>> {
2945
+ /** Wether this components has been already configured. */
2946
+ isSetup: boolean;
2947
+ /** Use the provided configuration to setup the tool. */
2948
+ setup: (config?: Partial<T>) => void | Promise<void>;
2949
+ /** Fired after successfully calling {@link Configurable.setup()} */
2950
+ readonly onSetup: Event<any>;
2951
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
2952
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
3043
2953
  */
3044
- add(handler: T extends void ? {
3045
- (): void;
3046
- } : {
3047
- (data: T): void;
3048
- }): void;
2954
+ config: Required<T>;
2955
+ }
2956
+ /**
2957
+ * Whether a camera uses the Camera Controls library.
2958
+ */
2959
+ export interface CameraControllable {
3049
2960
  /**
3050
- * Removes a callback from this event instance.
3051
- * @param handler - the callback to be removed from this event.
2961
+ * An instance of CameraControls that provides camera control functionalities.
2962
+ * This instance is used to manipulate the camera.
3052
2963
  */
3053
- remove(handler: T extends void ? {
3054
- (): void;
3055
- } : {
3056
- (data: T): void;
3057
- }): void;
3058
- /** Triggers all the callbacks assigned to this event. */
3059
- trigger: (data?: T) => void;
3060
- /** Gets rid of all the suscribed events. */
3061
- reset(): void;
3062
- private handlers;
2964
+ controls: CameraControls;
3063
2965
  }
3064
2966
  import { Base } from "./base";
3065
2967
  /**
@@ -3074,34 +2976,6 @@ export declare abstract class Component extends Base {
3074
2976
  */
3075
2977
  abstract enabled: boolean;
3076
2978
  }
3077
- /**
3078
- * 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.
3079
- */
3080
- export declare class AsyncEvent<T> {
3081
- /**
3082
- * Add a callback to this event instance.
3083
- * @param handler - the callback to be added to this event.
3084
- */
3085
- add(handler: T extends void ? {
3086
- (): Promise<void>;
3087
- } : {
3088
- (data: T): Promise<void>;
3089
- }): void;
3090
- /**
3091
- * Removes a callback from this event instance.
3092
- * @param handler - the callback to be removed from this event.
3093
- */
3094
- remove(handler: T extends void ? {
3095
- (): Promise<void>;
3096
- } : {
3097
- (data: T): Promise<void>;
3098
- }): void;
3099
- /** Triggers all the callbacks assigned to this event. */
3100
- trigger: (data?: T) => Promise<void>;
3101
- /** Gets rid of all the suscribed events. */
3102
- reset(): void;
3103
- private handlers;
3104
- }
3105
2979
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
3106
2980
  import { Components } from "../../Components";
3107
2981
  /**
@@ -3121,574 +2995,842 @@ export declare abstract class Base {
3121
2995
  /** Whether is component is {@link Configurable}. */
3122
2996
  isConfigurable: () => this is Configurable<any>;
3123
2997
  }
2998
+ import { Base } from "./base";
2999
+ import { World } from "./world";
3000
+ import { Event } from "./event";
3001
+ import { Components } from "../../Components";
3002
+ /**
3003
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
3004
+ */
3005
+ export declare abstract class BaseWorldItem extends Base {
3006
+ readonly worlds: Map<string, World>;
3007
+ /**
3008
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
3009
+ * The event payload contains the world instance and the action ("added" or "removed").
3010
+ */
3011
+ readonly onWorldChanged: Event<{
3012
+ world: World;
3013
+ action: "added" | "removed";
3014
+ }>;
3015
+ /**
3016
+ * The current world this item is associated with. It can be null if no world is currently active.
3017
+ */
3018
+ currentWorld: World | null;
3019
+ protected constructor(components: Components);
3020
+ }
3021
+ import * as THREE from "three";
3022
+ import CameraControls from "camera-controls";
3023
+ import { BaseWorldItem } from "./base-world-item";
3024
+ import { CameraControllable } from "./interfaces";
3025
+ /**
3026
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
3027
+ */
3028
+ export declare abstract class BaseCamera extends BaseWorldItem {
3029
+ /**
3030
+ * Whether the camera is enabled or not.
3031
+ */
3032
+ abstract enabled: boolean;
3033
+ /**
3034
+ * The Three.js camera instance.
3035
+ */
3036
+ abstract three: THREE.Camera;
3037
+ /**
3038
+ * Optional CameraControls instance for controlling the camera.
3039
+ * This property is only available if the camera is controllable.
3040
+ */
3041
+ abstract controls?: CameraControls;
3042
+ /**
3043
+ * Checks whether the instance is {@link CameraControllable}.
3044
+ *
3045
+ * @returns True if the instance is controllable, false otherwise.
3046
+ */
3047
+ hasCameraControls: () => this is CameraControllable;
3048
+ }
3049
+ import * as THREE from "three";
3050
+ import { Vector2 } from "three";
3051
+ import { Event } from "./event";
3052
+ import { BaseWorldItem } from "./base-world-item";
3053
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
3054
+ /**
3055
+ * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
3056
+ */
3057
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
3058
+ /**
3059
+ * The three.js WebGLRenderer instance associated with this renderer.
3060
+ *
3061
+ * @abstract
3062
+ * @type {THREE.WebGLRenderer}
3063
+ */
3064
+ abstract three: THREE.WebGLRenderer;
3065
+ /** {@link Updateable.onBeforeUpdate} */
3066
+ onAfterUpdate: Event<unknown>;
3067
+ /** {@link Updateable.onAfterUpdate} */
3068
+ onBeforeUpdate: Event<unknown>;
3069
+ /** {@link Disposable.onDisposed} */
3070
+ readonly onDisposed: Event<undefined>;
3071
+ /** {@link Resizeable.onResize} */
3072
+ readonly onResize: Event<THREE.Vector2>;
3073
+ /**
3074
+ * Event that fires when there has been a change to the list of clipping
3075
+ * planes used by the active renderer.
3076
+ */
3077
+ readonly onClippingPlanesUpdated: Event<unknown>;
3078
+ /** {@link Updateable.update} */
3079
+ abstract update(delta?: number): void | Promise<void>;
3080
+ /** {@link Disposable.dispose} */
3081
+ abstract dispose(): void;
3082
+ /** {@link Resizeable.getSize} */
3083
+ abstract getSize(): Vector2;
3084
+ /** {@link Resizeable.resize} */
3085
+ abstract resize(size: Vector2 | undefined): void;
3086
+ /**
3087
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
3088
+ */
3089
+ clippingPlanes: THREE.Plane[];
3090
+ /**
3091
+ * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
3092
+ *
3093
+ * @remarks
3094
+ * This method is typically called when there is a change to the list of clipping planes
3095
+ * used by the active renderer.
3096
+ */
3097
+ updateClippingPlanes(): void;
3098
+ /**
3099
+ * Sets or removes a clipping plane from the renderer.
3100
+ *
3101
+ * @param active - A boolean indicating whether the clipping plane should be active or not.
3102
+ * @param plane - The clipping plane to be added or removed.
3103
+ * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
3104
+ *
3105
+ * @remarks
3106
+ * This method adds or removes a clipping plane from the 'clippingPlanes' array.
3107
+ * If 'active' is 'true' and the plane is not already in the array, it is added.
3108
+ * If 'active' is 'false' and the plane is in the array, it is removed.
3109
+ * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
3110
+ * excluding any planes marked as local.
3111
+ */
3112
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
3113
+ }
3114
+ import * as THREE from "three";
3115
+ import { Disposable } from "./interfaces";
3116
+ import { Event } from "./event";
3117
+ import { Components } from "../../Components";
3118
+ import { BaseWorldItem } from "./base-world-item";
3119
+ /**
3120
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
3121
+ */
3122
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
3123
+ /** {@link Disposable.onDisposed} */
3124
+ readonly onDisposed: Event<unknown>;
3125
+ /**
3126
+ * Abstract property representing the three.js object associated with this scene.
3127
+ * It should be implemented by subclasses.
3128
+ */
3129
+ abstract three: THREE.Object3D;
3130
+ /** The set of directional lights managed by this scene component. */
3131
+ directionalLights: Map<string, THREE.DirectionalLight>;
3132
+ /** The set of ambient lights managed by this scene component. */
3133
+ ambientLights: Map<string, THREE.AmbientLight>;
3134
+ protected constructor(components: Components);
3135
+ /** {@link Disposable.dispose} */
3136
+ dispose(): void;
3137
+ }
3124
3138
  import * as THREE from "three";
3125
- import CameraControls from "camera-controls";
3126
- import { Event } from "./event";
3139
+ import { BaseScene } from "./base-scene";
3140
+ import { BaseCamera } from "./base-camera";
3141
+ import { BaseRenderer } from "./base-renderer";
3142
+ import { Updateable, Disposable } from "./interfaces";
3127
3143
  /**
3128
- * 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.
3144
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
3129
3145
  */
3130
- export interface Disposable {
3146
+ export interface World extends Disposable, Updateable {
3131
3147
  /**
3132
- * Destroys the object from memory to prevent a
3133
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
3148
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
3134
3149
  */
3135
- dispose: () => void | Promise<void>;
3136
- /** Fired after the tool has been disposed. */
3137
- readonly onDisposed: Event<any>;
3138
- }
3139
- /**
3140
- * 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).
3141
- */
3142
- export interface Hideable {
3150
+ meshes: Set<THREE.Mesh>;
3143
3151
  /**
3144
- * Whether the geometric representation of this component is
3145
- * currently visible or not in the
3146
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
3152
+ * The base scene of the world.
3147
3153
  */
3148
- visible: boolean;
3149
- }
3150
- /**
3151
- * 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.
3152
- */
3153
- export interface Resizeable {
3154
+ scene: BaseScene;
3154
3155
  /**
3155
- * Sets size of this component (e.g. the resolution of a
3156
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
3157
- * component.
3156
+ * The base camera of the world.
3158
3157
  */
3159
- resize: (size?: THREE.Vector2) => void;
3160
- /** Event that fires when the component has been resized. */
3161
- onResize: Event<THREE.Vector2>;
3158
+ camera: BaseCamera;
3162
3159
  /**
3163
- * Gets the current size of this component (e.g. the resolution of a
3164
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
3165
- * component.
3160
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
3166
3161
  */
3167
- getSize: () => THREE.Vector2;
3168
- }
3169
- /** Whether this component should be updated each frame. */
3170
- export interface Updateable {
3171
- /** Actions that should be executed after updating the component. */
3172
- onAfterUpdate: Event<any>;
3173
- /** Actions that should be executed before updating the component. */
3174
- onBeforeUpdate: Event<any>;
3162
+ renderer: BaseRenderer | null;
3175
3163
  /**
3176
- * Function used to update the state of this component each frame. For
3177
- * instance, a renderer component will make a render each frame.
3164
+ * A unique identifier for the world.
3178
3165
  */
3179
- update(delta?: number): void;
3180
- }
3181
- /** Basic type to describe the progress of any kind of process. */
3182
- export interface Progress {
3183
- /** The amount of things that have been done already. */
3184
- current: number;
3185
- /** The total amount of things to be done by the process. */
3186
- total: number;
3166
+ uuid: string;
3167
+ /**
3168
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
3169
+ */
3170
+ isDisposing: boolean;
3187
3171
  }
3172
+ import { Event } from "./event";
3188
3173
  /**
3189
- * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
3174
+ * A class that extends the built-in Set class and provides additional functionality.
3175
+ * It triggers events when items are added, deleted, or the set is cleared.
3176
+ *
3177
+ * @template T - The type of elements in the set.
3190
3178
  */
3191
- export interface Createable {
3192
- /** Creates a new instance of an element (e.g. a new Dimension). */
3193
- create: (data: any) => void;
3179
+ export declare class DataSet<T> extends Set<T> {
3194
3180
  /**
3195
- * Finish the creation process of the component, successfully creating an
3196
- * instance of whatever the component creates.
3181
+ * An event that is triggered when a new item is added to the set.
3197
3182
  */
3198
- endCreation?: (data: any) => void;
3183
+ readonly onItemAdded: Event<T>;
3199
3184
  /**
3200
- * Cancels the creation process of the component, going back to the state
3201
- * before starting to create.
3185
+ * An event that is triggered when an item is deleted from the set.
3202
3186
  */
3203
- cancelCreation?: (data: any) => void;
3204
- /** Deletes an existing instance of an element (e.g. a Dimension). */
3205
- delete: (data: any) => void;
3206
- }
3207
- /**
3208
- * Whether this component supports to be configured.
3209
- */
3210
- export interface Configurable<T extends Record<string, any>> {
3211
- /** Wether this components has been already configured. */
3212
- isSetup: boolean;
3213
- /** Use the provided configuration to setup the tool. */
3214
- setup: (config?: Partial<T>) => void | Promise<void>;
3215
- /** Fired after successfully calling {@link Configurable.setup()} */
3216
- readonly onSetup: Event<any>;
3217
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
3218
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
3187
+ readonly onItemDeleted: Event<unknown>;
3188
+ /**
3189
+ * An event that is triggered when the set is cleared.
3219
3190
  */
3220
- config: Required<T>;
3221
- }
3222
- /**
3223
- * Whether a camera uses the Camera Controls library.
3224
- */
3225
- export interface CameraControllable {
3191
+ readonly onCleared: Event<unknown>;
3226
3192
  /**
3227
- * An instance of CameraControls that provides camera control functionalities.
3228
- * This instance is used to manipulate the camera.
3193
+ * Constructs a new instance of the DataSet class.
3194
+ *
3195
+ * @param iterable - An optional iterable object to initialize the set with.
3229
3196
  */
3230
- controls: CameraControls;
3197
+ constructor(iterable?: Iterable<T> | null);
3198
+ /**
3199
+ * Clears the set and triggers the onCleared event.
3200
+ */
3201
+ clear(): void;
3202
+ /**
3203
+ * Adds one or multiple values to the set and triggers the onItemAdded event per each.
3204
+ *
3205
+ * @param value - The value to add to the set.
3206
+ * @returns - The set instance.
3207
+ */
3208
+ add(...value: T[]): this;
3209
+ /**
3210
+ * A function that acts as a guard for adding items to the set.
3211
+ * It determines whether a given value should be allowed to be added to the set.
3212
+ *
3213
+ * @param value - The value to be checked against the guard.
3214
+ * @returns A boolean indicating whether the value should be allowed to be added to the set.
3215
+ * By default, this function always returns true, allowing all values to be added.
3216
+ * You can override this behavior by providing a custom implementation.
3217
+ */
3218
+ guard: (value: T) => boolean;
3219
+ /**
3220
+ * Deletes a value from the set and triggers the onItemDeleted event.
3221
+ *
3222
+ * @param value - The value to delete from the set.
3223
+ * @returns - True if the value was successfully deleted, false otherwise.
3224
+ */
3225
+ delete(value: T): boolean;
3226
+ /**
3227
+ * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
3228
+ */
3229
+ dispose(): void;
3231
3230
  }
3232
- import { Base } from "./base";
3233
- import { World } from "./world";
3234
3231
  import { Event } from "./event";
3235
- import { Components } from "../../Components";
3236
3232
  /**
3237
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
3233
+ * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
3234
+ *
3235
+ * @template K - The type of keys in the map.
3236
+ * @template V - The type of values in the map.
3238
3237
  */
3239
- export declare abstract class BaseWorldItem extends Base {
3240
- readonly worlds: Map<string, World>;
3238
+ export declare class DataMap<K, V> extends Map<K, V> {
3241
3239
  /**
3242
- * Event that is triggered when a world is added or removed from the 'worlds' map.
3243
- * The event payload contains the world instance and the action ("added" or "removed").
3240
+ * An event triggered when a new item is set in the map.
3244
3241
  */
3245
- readonly onWorldChanged: Event<{
3246
- world: World;
3247
- action: "added" | "removed";
3242
+ readonly onItemSet: Event<{
3243
+ key: K;
3244
+ value: V;
3248
3245
  }>;
3249
3246
  /**
3250
- * The current world this item is associated with. It can be null if no world is currently active.
3247
+ * An event triggered when an existing item in the map is updated.
3251
3248
  */
3252
- currentWorld: World | null;
3253
- protected constructor(components: Components);
3249
+ readonly onItemUpdated: Event<{
3250
+ key: K;
3251
+ value: V;
3252
+ }>;
3253
+ /**
3254
+ * An event triggered when an item is deleted from the map.
3255
+ */
3256
+ readonly onItemDeleted: Event<K>;
3257
+ /**
3258
+ * An event triggered when the map is cleared.
3259
+ */
3260
+ readonly onCleared: Event<unknown>;
3261
+ /**
3262
+ * Constructs a new DataMap instance.
3263
+ *
3264
+ * @param iterable - An iterable object containing key-value pairs to populate the map.
3265
+ */
3266
+ constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
3267
+ /**
3268
+ * Clears the map and triggers the onCleared event.
3269
+ */
3270
+ clear(): void;
3271
+ /**
3272
+ * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
3273
+ *
3274
+ * @param key - The key of the item to set.
3275
+ * @param value - The value of the item to set.
3276
+ * @returns The DataMap instance.
3277
+ */
3278
+ set(key: K, value: V): this;
3279
+ /**
3280
+ * A function that acts as a guard for adding items to the set.
3281
+ * It determines whether a given value should be allowed to be added to the set.
3282
+ *
3283
+ * @param key - The key of the entry to be checked against the guard.
3284
+ * @param value - The value of the entry to be checked against the guard.
3285
+ * @returns A boolean indicating whether the value should be allowed to be added to the set.
3286
+ * By default, this function always returns true, allowing all values to be added.
3287
+ * You can override this behavior by providing a custom implementation.
3288
+ */
3289
+ guard: (key: K, value: V) => boolean;
3290
+ /**
3291
+ * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
3292
+ *
3293
+ * @param key - The key of the item to delete.
3294
+ * @returns True if the key was found and deleted; otherwise, false.
3295
+ */
3296
+ delete(key: K): boolean;
3297
+ /**
3298
+ * Clears the map and resets the events.
3299
+ */
3300
+ dispose(): void;
3301
+ }
3302
+ import * as THREE from "three";
3303
+ import { Disposable, Event } from "../../Types";
3304
+ /**
3305
+ * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
3306
+ */
3307
+ export declare class Mouse implements Disposable {
3308
+ dom: HTMLCanvasElement;
3309
+ private _event?;
3310
+ private _position;
3311
+ /** {@link Disposable.onDisposed} */
3312
+ readonly onDisposed: Event<unknown>;
3313
+ constructor(dom: HTMLCanvasElement);
3314
+ /**
3315
+ * The real position of the mouse of the Three.js canvas.
3316
+ */
3317
+ get position(): THREE.Vector2;
3318
+ /** {@link Disposable.dispose} */
3319
+ dispose(): void;
3320
+ private getPositionY;
3321
+ private getPositionX;
3322
+ private updateMouseInfo;
3323
+ private setupEvents;
3254
3324
  }
3255
3325
  import * as THREE from "three";
3256
- import CameraControls from "camera-controls";
3257
- import { BaseWorldItem } from "./base-world-item";
3258
- import { CameraControllable } from "./interfaces";
3326
+ import { Components } from "../../Components";
3327
+ import { Event, World, Disposable } from "../../Types";
3328
+ import { Mouse } from "./mouse";
3259
3329
  /**
3260
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
3330
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
3261
3331
  */
3262
- export declare abstract class BaseCamera extends BaseWorldItem {
3332
+ export declare class SimpleRaycaster implements Disposable {
3333
+ /** {@link Component.enabled} */
3334
+ enabled: boolean;
3335
+ /** The components instance to which this Raycaster belongs. */
3336
+ components: Components;
3337
+ /** {@link Disposable.onDisposed} */
3338
+ readonly onDisposed: Event<unknown>;
3339
+ /** The position of the mouse in the screen. */
3340
+ readonly mouse: Mouse;
3263
3341
  /**
3264
- * Whether the camera is enabled or not.
3342
+ * A reference to the Three.js Raycaster instance.
3343
+ * This is used for raycasting operations.
3265
3344
  */
3266
- abstract enabled: boolean;
3345
+ readonly three: THREE.Raycaster;
3267
3346
  /**
3268
- * The Three.js camera instance.
3347
+ * A reference to the world instance to which this Raycaster belongs.
3348
+ * This is used to access the camera and meshes.
3269
3349
  */
3270
- abstract three: THREE.Camera;
3350
+ world: World;
3351
+ constructor(components: Components, world: World);
3352
+ /** {@link Disposable.dispose} */
3353
+ dispose(): void;
3271
3354
  /**
3272
- * Optional CameraControls instance for controlling the camera.
3273
- * This property is only available if the camera is controllable.
3355
+ * Throws a ray from the camera to the mouse or touch event point and returns
3356
+ * the first item found. This also takes into account the clipping planes
3357
+ * used by the renderer.
3358
+ *
3359
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3360
+ * to query. If not provided, it will query all the meshes stored in
3361
+ * {@link Components.meshes}.
3274
3362
  */
3275
- abstract controls?: CameraControls;
3363
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3276
3364
  /**
3277
- * Checks whether the instance is {@link CameraControllable}.
3365
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3366
+ * This method also takes into account the clipping planes used by the renderer.
3278
3367
  *
3279
- * @returns True if the instance is controllable, false otherwise.
3368
+ * @param origin - The origin of the ray.
3369
+ * @param direction - The direction of the ray.
3370
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3371
+ * @returns The first intersection found or 'null' if no intersection was found.
3280
3372
  */
3281
- hasCameraControls: () => this is CameraControllable;
3373
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
3374
+ private intersect;
3375
+ private filterClippingPlanes;
3376
+ }
3377
+ import { SimplePlane } from "../../Clipper";
3378
+ import { DataSet } from "../../Types";
3379
+ export interface ViewpointCamera {
3380
+ direction: {
3381
+ x: number;
3382
+ y: number;
3383
+ z: number;
3384
+ };
3385
+ position: {
3386
+ x: number;
3387
+ y: number;
3388
+ z: number;
3389
+ };
3390
+ aspectRatio: number;
3391
+ }
3392
+ export interface ViewpointPerspectiveCamera extends ViewpointCamera {
3393
+ fov: number;
3394
+ }
3395
+ export interface ViewpointOrthographicCamera extends ViewpointCamera {
3396
+ viewToWorldScale: number;
3397
+ }
3398
+ export interface BCFViewpoint {
3399
+ title?: string;
3400
+ guid: string;
3401
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3402
+ selectionComponents: Iterable<string>;
3403
+ exceptionComponents: Iterable<string>;
3404
+ clippingPlanes: DataSet<SimplePlane>;
3405
+ spacesVisible: boolean;
3406
+ spaceBoundariesVisible: boolean;
3407
+ openingsVisible: boolean;
3408
+ defaultVisibility: boolean;
3282
3409
  }
3283
3410
  import * as THREE from "three";
3284
- import { Vector2 } from "three";
3285
- import { Event } from "./event";
3286
- import { BaseWorldItem } from "./base-world-item";
3287
- import { Disposable, Resizeable, Updateable } from "./interfaces";
3288
- /**
3289
- * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
3290
- */
3291
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
3411
+ import * as FRAGS from "@thatopen/fragments";
3412
+ import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
3413
+ import { CameraProjection } from "../../OrthoPerspectiveCamera";
3414
+ import { Components } from "../../Components";
3415
+ import { DataMap, DataSet, World } from "../../Types";
3416
+ import { SimplePlane } from "../../Clipper";
3417
+ export declare class Viewpoint implements BCFViewpoint {
3418
+ title?: string;
3419
+ guid: string;
3292
3420
  /**
3293
- * The three.js WebGLRenderer instance associated with this renderer.
3294
- *
3295
- * @abstract
3296
- * @type {THREE.WebGLRenderer}
3421
+ * ClippingPlanes can be used to define a subsection of a building model that is related to the topic.
3422
+ * Each clipping plane is defined by Location and Direction.
3423
+ * The Direction vector points in the invisible direction meaning the half-space that is clipped.
3297
3424
  */
3298
- abstract three: THREE.WebGLRenderer;
3299
- /** {@link Updateable.onBeforeUpdate} */
3300
- onAfterUpdate: Event<unknown>;
3301
- /** {@link Updateable.onAfterUpdate} */
3302
- onBeforeUpdate: Event<unknown>;
3303
- /** {@link Disposable.onDisposed} */
3304
- readonly onDisposed: Event<undefined>;
3305
- /** {@link Resizeable.onResize} */
3306
- readonly onResize: Event<THREE.Vector2>;
3425
+ clippingPlanes: DataSet<SimplePlane>;
3426
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3307
3427
  /**
3308
- * Event that fires when there has been a change to the list of clipping
3309
- * planes used by the active renderer.
3428
+ * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false
3310
3429
  */
3311
- readonly onClippingPlanesUpdated: Event<unknown>;
3312
- /** {@link Updateable.update} */
3313
- abstract update(delta?: number): void | Promise<void>;
3314
- /** {@link Disposable.dispose} */
3315
- abstract dispose(): void;
3316
- /** {@link Resizeable.getSize} */
3317
- abstract getSize(): Vector2;
3318
- /** {@link Resizeable.resize} */
3319
- abstract resize(size: Vector2 | undefined): void;
3430
+ readonly exceptionComponents: DataSet<string>;
3320
3431
  /**
3321
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
3432
+ * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint.
3322
3433
  */
3323
- clippingPlanes: THREE.Plane[];
3434
+ readonly selectionComponents: DataSet<string>;
3324
3435
  /**
3325
- * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
3326
- *
3327
- * @remarks
3328
- * This method is typically called when there is a change to the list of clipping planes
3329
- * used by the active renderer.
3436
+ * A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
3437
+ * For this to work, call viewpoint.colorize()
3330
3438
  */
3331
- updateClippingPlanes(): void;
3439
+ readonly componentColors: DataMap<string, string[]>;
3332
3440
  /**
3333
- * Sets or removes a clipping plane from the renderer.
3334
- *
3335
- * @param active - A boolean indicating whether the clipping plane should be active or not.
3336
- * @param plane - The clipping plane to be added or removed.
3337
- * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
3338
- *
3339
- * @remarks
3340
- * This method adds or removes a clipping plane from the 'clippingPlanes' array.
3341
- * If 'active' is 'true' and the plane is not already in the array, it is added.
3342
- * If 'active' is 'false' and the plane is in the array, it is removed.
3343
- * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
3344
- * excluding any planes marked as local.
3441
+ * Boolean flags to allow fine control over the visibility of spaces.
3442
+ * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
3443
+ * @default false
3345
3444
  */
3346
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
3347
- }
3348
- import * as THREE from "three";
3349
- import { Disposable } from "./interfaces";
3350
- import { Event } from "./event";
3351
- import { Components } from "../../Components";
3352
- import { BaseWorldItem } from "./base-world-item";
3353
- /**
3354
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
3355
- */
3356
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
3357
- /** {@link Disposable.onDisposed} */
3358
- readonly onDisposed: Event<unknown>;
3445
+ spacesVisible: boolean;
3359
3446
  /**
3360
- * Abstract property representing the three.js object associated with this scene.
3361
- * It should be implemented by subclasses.
3447
+ * Boolean flags to allow fine control over the visibility of space boundaries.
3448
+ * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden.
3449
+ * @default false
3362
3450
  */
3363
- abstract three: THREE.Object3D;
3364
- /** The set of directional lights managed by this scene component. */
3365
- directionalLights: Map<string, THREE.DirectionalLight>;
3366
- /** The set of ambient lights managed by this scene component. */
3367
- ambientLights: Map<string, THREE.AmbientLight>;
3368
- protected constructor(components: Components);
3369
- /** {@link Disposable.dispose} */
3370
- dispose(): void;
3371
- }
3372
- import * as THREE from "three";
3373
- import { BaseScene } from "./base-scene";
3374
- import { BaseCamera } from "./base-camera";
3375
- import { BaseRenderer } from "./base-renderer";
3376
- import { Updateable, Disposable } from "./interfaces";
3377
- /**
3378
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
3379
- */
3380
- export interface World extends Disposable, Updateable {
3451
+ spaceBoundariesVisible: boolean;
3381
3452
  /**
3382
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
3453
+ * Boolean flags to allow fine control over the visibility of openings.
3454
+ * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden.
3455
+ * @default false
3383
3456
  */
3384
- meshes: Set<THREE.Mesh>;
3457
+ openingsVisible: boolean;
3385
3458
  /**
3386
- * The base scene of the world.
3459
+ * When true, all components should be visible unless listed in the exceptions
3460
+ * When false all components should be invisible unless listed in the exceptions
3387
3461
  */
3388
- scene: BaseScene;
3462
+ defaultVisibility: boolean;
3463
+ private get _selectionModelIdMap();
3464
+ private get _exceptionModelIdMap();
3389
3465
  /**
3390
- * The base camera of the world.
3466
+ * A list of components that should be selected (highlighted) when displaying a viewpoint.
3467
+ * @returns The fragmentIdMap for components marked as selections.
3391
3468
  */
3392
- camera: BaseCamera;
3469
+ get selection(): FRAGS.FragmentIdMap;
3393
3470
  /**
3394
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
3471
+ * A list of components to hide when defaultVisibility = true or to show when defaultVisibility = false
3472
+ * @returns The fragmentIdMap for components marked as exceptions.
3395
3473
  */
3396
- renderer: BaseRenderer | null;
3474
+ get exception(): FRAGS.FragmentIdMap;
3397
3475
  /**
3398
- * A unique identifier for the world.
3476
+ * Retrieves the projection type of the viewpoint's camera.
3477
+ *
3478
+ * @returns A string representing the projection type of the viewpoint's camera.
3479
+ * It can be either 'Perspective' or 'Orthographic'.
3399
3480
  */
3400
- uuid: string;
3481
+ get projection(): CameraProjection;
3401
3482
  /**
3402
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
3483
+ * Retrieves the position vector of the viewpoint's camera.
3484
+ *
3485
+ * @remarks
3486
+ * The position vector represents the camera's position in the world coordinate system.
3487
+ * The function applies the base coordinate system transformation to the position vector.
3488
+ *
3489
+ * @returns A THREE.Vector3 representing the position of the viewpoint's camera.
3403
3490
  */
3404
- isDisposing: boolean;
3405
- }
3406
- import { Event } from "./event";
3407
- /**
3408
- * A class that extends the built-in Set class and provides additional functionality.
3409
- * It triggers events when items are added, deleted, or the set is cleared.
3410
- *
3411
- * @template T - The type of elements in the set.
3412
- */
3413
- export declare class DataSet<T> extends Set<T> {
3491
+ get position(): THREE.Vector3;
3414
3492
  /**
3415
- * An event that is triggered when a new item is added to the set.
3493
+ * Retrieves the direction vector of the viewpoint's camera.
3494
+ *
3495
+ * @remarks
3496
+ * The direction vector represents the direction in which the camera is pointing.
3497
+ * It is calculated by extracting the x, y, and z components from the camera's direction property.
3498
+ *
3499
+ * @returns A THREE.Vector3 representing the direction of the viewpoint's camera.
3416
3500
  */
3417
- readonly onItemAdded: Event<T>;
3501
+ get direction(): THREE.Vector3;
3502
+ private _components;
3418
3503
  /**
3419
- * An event that is triggered when an item is deleted from the set.
3504
+ * Represents the world in which the viewpoints are created and managed.
3420
3505
  */
3421
- readonly onItemDeleted: Event<unknown>;
3506
+ readonly world: World;
3507
+ private get _managerVersion();
3422
3508
  /**
3423
- * An event that is triggered when the set is cleared.
3509
+ * Retrieves the list of BCF topics associated with the current viewpoint.
3510
+ *
3511
+ * @remarks
3512
+ * This function retrieves the BCFTopics manager from the components,
3513
+ * then filters the list of topics to find those associated with the current viewpoint.
3514
+ *
3515
+ * @returns An array of BCF topics associated with the current viewpoint.
3424
3516
  */
3425
- readonly onCleared: Event<unknown>;
3517
+ get topics(): import("../../../openbim/BCFTopics").Topic[];
3518
+ constructor(components: Components, world: World, _config?: {
3519
+ data?: Partial<BCFViewpoint>;
3520
+ setCamera?: boolean;
3521
+ });
3426
3522
  /**
3427
- * Constructs a new instance of the DataSet class.
3523
+ * Adds components to the viewpoint based on the provided fragment ID map.
3428
3524
  *
3429
- * @param iterable - An optional iterable object to initialize the set with.
3525
+ * @param fragmentIdMap - A map containing fragment IDs as keys and arrays of express IDs as values.
3526
+ *
3527
+ * @returns A Promise that resolves when the components have been added to the viewpoint.
3430
3528
  */
3431
- constructor(iterable?: Iterable<T> | null);
3529
+ addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): Promise<void>;
3432
3530
  /**
3433
- * Clears the set and triggers the onCleared event.
3531
+ * Sets the properties of the viewpoint with the provided data.
3532
+ *
3533
+ * @remarks The guid will be ommited as it shouldn't change after it has been initially set.
3534
+ *
3535
+ * @param data - An object containing the properties to be set.
3536
+ * The properties not included in the object will remain unchanged.
3537
+ *
3538
+ * @returns The viewpoint instance with the updated properties.
3434
3539
  */
3435
- clear(): void;
3540
+ set(data: Partial<BCFViewpoint>): this;
3436
3541
  /**
3437
- * Adds one or multiple values to the set and triggers the onItemAdded event per each.
3542
+ * Sets the viewpoint of the camera in the world.
3438
3543
  *
3439
- * @param value - The value to add to the set.
3440
- * @returns - The set instance.
3544
+ * @remarks
3545
+ * This function calculates the target position based on the viewpoint information.
3546
+ * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls.
3547
+ *
3548
+ * @param transition - Indicates whether the camera movement should have a transition effect.
3549
+ * Default value is 'true'.
3550
+ *
3551
+ * @throws An error if the world's camera does not have camera controls.
3552
+ *
3553
+ * @returns A Promise that resolves when the camera has been set.
3441
3554
  */
3442
- add(...value: T[]): this;
3555
+ go(transition?: boolean): Promise<void>;
3443
3556
  /**
3444
- * A function that acts as a guard for adding items to the set.
3445
- * It determines whether a given value should be allowed to be added to the set.
3557
+ * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
3446
3558
  *
3447
- * @param value - The value to be checked against the guard.
3448
- * @returns A boolean indicating whether the value should be allowed to be added to the set.
3449
- * By default, this function always returns true, allowing all values to be added.
3450
- * You can override this behavior by providing a custom implementation.
3559
+ * @remarks
3560
+ * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
3561
+ * It then calculates the camera's perspective or orthographic settings based on the camera type.
3562
+ * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
3563
+ *
3564
+ * @throws An error if the world's camera does not have camera controls.
3565
+ * @throws An error if the world's renderer is not available.
3451
3566
  */
3452
- guard: (value: T) => boolean;
3567
+ updateCamera(): void;
3453
3568
  /**
3454
- * Deletes a value from the set and triggers the onItemDeleted event.
3569
+ * Applies color to the components in the viewpoint based on their GUIDs.
3455
3570
  *
3456
- * @param value - The value to delete from the set.
3457
- * @returns - True if the value was successfully deleted, false otherwise.
3571
+ * This function iterates through the 'componentColors' map, retrieves the fragment IDs
3572
+ * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
3573
+ *
3574
+ * @remarks
3575
+ * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
3576
+ * The color is provided as a hexadecimal string, prefixed with a '#'.
3458
3577
  */
3459
- delete(value: T): boolean;
3578
+ colorize(): void;
3460
3579
  /**
3461
- * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
3580
+ * Resets the colors of all components in the viewpoint to their original color.
3581
+ * This method iterates through the 'componentColors' map, retrieves the fragment IDs
3582
+ * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
3462
3583
  */
3463
- dispose(): void;
3584
+ resetColors(): void;
3585
+ private createComponentTags;
3586
+ /**
3587
+ * Serializes the viewpoint into a buildingSMART compliant XML string for export.
3588
+ *
3589
+ * @param version - The version of the BCF Manager to use for serialization.
3590
+ * If not provided, the current version of the manager will be used.
3591
+ *
3592
+ * @returns A Promise that resolves to an XML string representing the viewpoint.
3593
+ * The XML string follows the BCF VisualizationInfo schema.
3594
+ *
3595
+ * @throws An error if the world's camera does not have camera controls.
3596
+ * @throws An error if the world's renderer is not available.
3597
+ */
3598
+ serialize(version?: import("../../../openbim/BCFTopics").BCFVersion): Promise<string>;
3464
3599
  }
3465
- import { Event } from "./event";
3600
+ import * as THREE from "three";
3601
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3466
3602
  /**
3467
- * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
3603
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3468
3604
  *
3469
- * @template K - The type of keys in the map.
3470
- * @template V - The type of values in the map.
3605
+ * @template T - The type of the scene. Default is BaseScene.
3606
+ * @template U - The type of the camera. Default is BaseCamera.
3607
+ * @template S - The type of the renderer. Default is BaseRenderer.
3471
3608
  */
3472
- export declare class DataMap<K, V> extends Map<K, V> {
3609
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3473
3610
  /**
3474
- * An event triggered when a new item is set in the map.
3611
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3475
3612
  */
3476
- readonly onItemSet: Event<{
3477
- key: K;
3478
- value: V;
3479
- }>;
3613
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3614
+ /** {@link Updateable.onAfterUpdate} */
3615
+ readonly onAfterUpdate: Event<unknown>;
3616
+ /** {@link Updateable.onBeforeUpdate} */
3617
+ readonly onBeforeUpdate: Event<unknown>;
3618
+ /** {@link Disposable.onDisposed} */
3619
+ readonly onDisposed: Event<unknown>;
3480
3620
  /**
3481
- * An event triggered when an existing item in the map is updated.
3621
+ * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3482
3622
  */
3483
- readonly onItemUpdated: Event<{
3484
- key: K;
3485
- value: V;
3486
- }>;
3623
+ isDisposing: boolean;
3487
3624
  /**
3488
- * An event triggered when an item is deleted from the map.
3625
+ * Indicates whether the world is currently enabled.
3626
+ * When disabled, the world will not be updated.
3489
3627
  */
3490
- readonly onItemDeleted: Event<K>;
3628
+ enabled: boolean;
3491
3629
  /**
3492
- * An event triggered when the map is cleared.
3630
+ * A unique identifier for the world.
3493
3631
  */
3494
- readonly onCleared: Event<unknown>;
3632
+ uuid: string;
3495
3633
  /**
3496
- * Constructs a new DataMap instance.
3497
- *
3498
- * @param iterable - An iterable object containing key-value pairs to populate the map.
3634
+ * An optional name for the world.
3499
3635
  */
3500
- constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
3636
+ name?: string;
3637
+ private _scene?;
3638
+ private _camera?;
3639
+ private _renderer;
3501
3640
  /**
3502
- * Clears the map and triggers the onCleared event.
3641
+ * Getter for the scene. If no scene is initialized, it throws an error.
3642
+ * @returns The current scene.
3503
3643
  */
3504
- clear(): void;
3644
+ get scene(): T;
3505
3645
  /**
3506
- * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
3507
- *
3508
- * @param key - The key of the item to set.
3509
- * @param value - The value of the item to set.
3510
- * @returns The DataMap instance.
3646
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3647
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3648
+ * @param scene - The new scene to be set.
3511
3649
  */
3512
- set(key: K, value: V): this;
3650
+ set scene(scene: T);
3513
3651
  /**
3514
- * A function that acts as a guard for adding items to the set.
3515
- * It determines whether a given value should be allowed to be added to the set.
3516
- *
3517
- * @param key - The key of the entry to be checked against the guard.
3518
- * @param value - The value of the entry to be checked against the guard.
3519
- * @returns A boolean indicating whether the value should be allowed to be added to the set.
3520
- * By default, this function always returns true, allowing all values to be added.
3521
- * You can override this behavior by providing a custom implementation.
3652
+ * Getter for the camera. If no camera is initialized, it throws an error.
3653
+ * @returns The current camera.
3522
3654
  */
3523
- guard: (key: K, value: V) => boolean;
3655
+ get camera(): U;
3524
3656
  /**
3525
- * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
3526
- *
3527
- * @param key - The key of the item to delete.
3528
- * @returns True if the key was found and deleted; otherwise, false.
3657
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3658
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3659
+ * @param camera - The new camera to be set.
3529
3660
  */
3530
- delete(key: K): boolean;
3661
+ set camera(camera: U);
3531
3662
  /**
3532
- * Clears the map and resets the events.
3663
+ * Getter for the renderer.
3664
+ * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3533
3665
  */
3534
- dispose(): void;
3666
+ get renderer(): S | null;
3667
+ /**
3668
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3669
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3670
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3671
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3672
+ */
3673
+ set renderer(renderer: S | null);
3674
+ /** {@link Updateable.update} */
3675
+ update(delta?: number): void;
3676
+ /** {@link Disposable.dispose} */
3677
+ dispose(disposeResources?: boolean): void;
3535
3678
  }
3536
3679
  import * as THREE from "three";
3680
+ import { BaseScene, Configurable, Event } from "../../Types";
3537
3681
  import { Components } from "../../Components";
3538
- import { AsyncEvent, Event, World } from "../../Types";
3539
3682
  /**
3540
- * Settings to configure the CullerRenderer.
3683
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
3541
3684
  */
3542
- export interface CullerRendererSettings {
3543
- /**
3544
- * Interval in milliseconds at which the visibility check should be performed.
3545
- * Default value is 1000.
3546
- */
3547
- updateInterval?: number;
3548
- /**
3549
- * Width of the render target used for visibility checks.
3550
- * Default value is 512.
3551
- */
3552
- width?: number;
3685
+ export interface SimpleSceneConfig {
3686
+ directionalLight: {
3687
+ color: THREE.Color;
3688
+ intensity: number;
3689
+ position: THREE.Vector3;
3690
+ };
3691
+ ambientLight: {
3692
+ color: THREE.Color;
3693
+ intensity: number;
3694
+ };
3695
+ }
3696
+ /**
3697
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
3698
+ */
3699
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3700
+ /** {@link Configurable.isSetup} */
3701
+ isSetup: boolean;
3553
3702
  /**
3554
- * Height of the render target used for visibility checks.
3555
- * Default value is 512.
3703
+ * The underlying Three.js scene object.
3704
+ * It is used to define the 3D space containing objects, lights, and cameras.
3556
3705
  */
3557
- height?: number;
3706
+ three: THREE.Scene;
3707
+ /** {@link Configurable.onSetup} */
3708
+ readonly onSetup: Event<SimpleScene>;
3558
3709
  /**
3559
- * Whether the visibility check should be performed automatically.
3560
- * Default value is true.
3710
+ * Configuration interface for the {@link SimpleScene}.
3711
+ * Defines properties for directional and ambient lights.
3561
3712
  */
3562
- autoUpdate?: boolean;
3713
+ config: Required<SimpleSceneConfig>;
3714
+ constructor(components: Components);
3715
+ /** {@link Configurable.setup} */
3716
+ setup(config?: Partial<SimpleSceneConfig>): void;
3563
3717
  }
3718
+ import * as THREE from "three";
3719
+ import { BaseRenderer, Event } from "../../Types";
3720
+ import { Components } from "../../Components";
3564
3721
  /**
3565
- * A base renderer to determine visibility on screen.
3722
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
3566
3723
  */
3567
- export declare class CullerRenderer {
3568
- /** {@link Disposable.onDisposed} */
3569
- readonly onDisposed: Event<string>;
3724
+ export declare class SimpleRenderer extends BaseRenderer {
3570
3725
  /**
3571
- * Fires after making the visibility check to the meshes. It lists the
3572
- * meshes that are currently visible, and the ones that were visible
3573
- * just before but not anymore.
3726
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
3727
+ * Default is 'true'.
3574
3728
  */
3575
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3729
+ enabled: boolean;
3576
3730
  /**
3577
- * Whether this renderer is active or not. If not, it won't render anything.
3731
+ * The HTML container of the THREE.js canvas where the scene is rendered.
3578
3732
  */
3579
- enabled: boolean;
3733
+ container: HTMLElement;
3580
3734
  /**
3581
- * Needs to check whether there are objects that need to be hidden or shown.
3582
- * You can bind this to the camera movement, to a certain interval, etc.
3735
+ * The THREE.js WebGLRenderer instance.
3583
3736
  */
3584
- needsUpdate: boolean;
3737
+ three: THREE.WebGLRenderer;
3738
+ protected _canvas: HTMLCanvasElement;
3739
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
3740
+ protected _resizeObserver: ResizeObserver | null;
3741
+ protected onContainerUpdated: Event<unknown>;
3742
+ private _resizing;
3585
3743
  /**
3586
- * Render the internal scene used to determine the object visibility. Used
3587
- * for debugging purposes.
3744
+ * Constructor for the SimpleRenderer class.
3745
+ *
3746
+ * @param components - The components instance.
3747
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
3748
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
3588
3749
  */
3589
- renderDebugFrame: boolean;
3590
- /** The components instance to which this renderer belongs. */
3591
- components: Components;
3592
- /** The world instance to which this renderer belongs. */
3593
- readonly world: World;
3594
- /** The THREE.js renderer used to make the visibility test. */
3595
- readonly renderer: THREE.WebGLRenderer;
3596
- protected autoUpdate: boolean;
3597
- protected updateInterval: number;
3598
- protected readonly worker: Worker;
3599
- protected readonly scene: THREE.Scene;
3600
- private _width;
3601
- private _height;
3602
- private _availableColor;
3603
- private readonly renderTarget;
3604
- private readonly bufferSize;
3605
- private readonly _buffer;
3606
- protected _isWorkerBusy: boolean;
3607
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3750
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3751
+ /** {@link Updateable.update} */
3752
+ update(): void;
3608
3753
  /** {@link Disposable.dispose} */
3609
3754
  dispose(): void;
3755
+ /** {@link Resizeable.getSize}. */
3756
+ getSize(): THREE.Vector2;
3757
+ /** {@link Resizeable.resize} */
3758
+ resize: (size?: THREE.Vector2) => void;
3610
3759
  /**
3611
- * The function that the culler uses to reprocess the scene. Generally it's
3612
- * better to call needsUpdate, but you can also call this to force it.
3613
- * @param force if true, it will refresh the scene even if needsUpdate is
3614
- * not true.
3760
+ * Sets up and manages the event listeners for the renderer.
3761
+ *
3762
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3763
+ *
3764
+ * @throws Will throw an error if the renderer does not have an HTML container.
3615
3765
  */
3616
- updateVisibility: (force?: boolean) => Promise<void>;
3617
- protected getAvailableColor(): {
3618
- r: number;
3619
- g: number;
3620
- b: number;
3621
- code: string;
3622
- };
3623
- protected increaseColor(): void;
3624
- protected decreaseColor(): void;
3625
- private applySettings;
3766
+ setupEvents(active: boolean): void;
3767
+ private resizeEvent;
3768
+ private setupRenderer;
3769
+ private onContextLost;
3770
+ private onContextBack;
3626
3771
  }
3627
3772
  import * as THREE from "three";
3628
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3773
+ import CameraControls from "camera-controls";
3774
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3629
3775
  import { Components } from "../../Components";
3630
- import { Event, World, Disposable } from "../../Types";
3631
3776
  /**
3632
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3777
+ * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
3633
3778
  */
3634
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3635
- /**
3636
- * Event triggered when the visibility of meshes is updated.
3637
- * Contains two sets: seen and unseen.
3638
- */
3639
- readonly onViewUpdated: Event<{
3640
- seen: Set<THREE.Mesh>;
3641
- unseen: Set<THREE.Mesh>;
3642
- }>;
3779
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3780
+ /** {@link Updateable.onBeforeUpdate} */
3781
+ readonly onBeforeUpdate: Event<SimpleCamera>;
3782
+ /** {@link Updateable.onAfterUpdate} */
3783
+ readonly onAfterUpdate: Event<SimpleCamera>;
3643
3784
  /**
3644
- * Pixels in screen a geometry must occupy to be considered "seen".
3645
- * Default value is 100.
3785
+ * Event that is triggered when the aspect of the camera has been updated.
3786
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3646
3787
  */
3647
- threshold: number;
3788
+ readonly onAspectUpdated: Event<unknown>;
3789
+ /** {@link Disposable.onDisposed} */
3790
+ readonly onDisposed: Event<string>;
3648
3791
  /**
3649
- * Map of color code to THREE.InstancedMesh.
3650
- * Used to keep track of color-coded meshes.
3792
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
3793
+ * This camera is used for rendering the scene.
3651
3794
  */
3652
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3795
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3796
+ private _allControls;
3653
3797
  /**
3654
- * Flag to indicate if the renderer is currently processing.
3655
- * Used to prevent concurrent processing.
3798
+ * The object that controls the camera. An instance of
3799
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3800
+ * Transforming the camera directly will have no effect: you need to use this
3801
+ * object to move, rotate, look at objects, etc.
3656
3802
  */
3657
- isProcessing: boolean;
3658
- private _colorCodeMeshMap;
3659
- private _meshIDColorCodeMap;
3660
- private _currentVisibleMeshes;
3661
- private _recentlyHiddenMeshes;
3662
- private _intervalID;
3663
- private readonly _transparentMat;
3664
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3665
- /** {@link Disposable.dispose} */
3666
- dispose(): void;
3803
+ get controls(): CameraControls;
3667
3804
  /**
3668
- * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
3669
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3670
- * @returns {void}
3805
+ * Getter for the enabled state of the camera controls.
3806
+ * If the current world is null, it returns false.
3807
+ * Otherwise, it returns the enabled state of the camera controls.
3808
+ *
3809
+ * @returns {boolean} The enabled state of the camera controls.
3671
3810
  */
3672
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3811
+ get enabled(): boolean;
3673
3812
  /**
3674
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3675
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3676
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3677
- * @returns {void}
3813
+ * Setter for the enabled state of the camera controls.
3814
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3815
+ *
3816
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3678
3817
  */
3679
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3818
+ set enabled(enabled: boolean);
3819
+ constructor(components: Components);
3820
+ /** {@link Disposable.dispose} */
3821
+ dispose(): void;
3822
+ /** {@link Updateable.update} */
3823
+ update(_delta: number): void;
3680
3824
  /**
3681
- * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
3682
- *
3683
- * @param meshes - The meshes to update.
3684
- *
3685
- * @returns {void}
3825
+ * Updates the aspect of the camera to match the size of the
3826
+ * {@link Components.renderer}.
3686
3827
  */
3687
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
3688
- private handleWorkerMessage;
3689
- private getAvailableMaterial;
3828
+ updateAspect: () => void;
3829
+ private setupCamera;
3830
+ private newCameraControls;
3831
+ private setupEvents;
3832
+ private static getSubsetOfThree;
3690
3833
  }
3691
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3692
3834
  import { NavigationMode } from "./types";
3693
3835
  import { OrthoPerspectiveCamera } from "../index";
3694
3836
  /**
@@ -3705,73 +3847,6 @@ export declare class FirstPersonMode implements NavigationMode {
3705
3847
  set(active: boolean): void;
3706
3848
  private setupFirstPersonCamera;
3707
3849
  }
3708
- import * as THREE from "three";
3709
- import { Event, World } from "../../Types";
3710
- import { Components } from "../../Components";
3711
- /**
3712
- * A base renderer to determine visibility on screen.
3713
- */
3714
- export declare class DistanceRenderer {
3715
- /** {@link Disposable.onDisposed} */
3716
- readonly onDisposed: Event<string>;
3717
- /**
3718
- * Fires after making the visibility check to the meshes. It lists the
3719
- * meshes that are currently visible, and the ones that were visible
3720
- * just before but not anymore.
3721
- */
3722
- readonly onDistanceComputed: Event<number>;
3723
- /**
3724
- * Objects that won't be taken into account in the distance check.
3725
- */
3726
- excludedObjects: Set<THREE.Object3D<THREE.Object3DEventMap>>;
3727
- /**
3728
- * Whether this renderer is active or not. If not, it won't render anything.
3729
- */
3730
- enabled: boolean;
3731
- /**
3732
- * Render the internal scene used to determine the object visibility. Used
3733
- * for debugging purposes.
3734
- */
3735
- renderDebugFrame: boolean;
3736
- /** The components instance to which this renderer belongs. */
3737
- components: Components;
3738
- /**
3739
- * The scene where the distance is computed.
3740
- */
3741
- scene: THREE.Scene;
3742
- /**
3743
- * The camera used to compute the distance.
3744
- */
3745
- camera: THREE.OrthographicCamera;
3746
- /**
3747
- * The material used to compute the distance.
3748
- */
3749
- depthMaterial: THREE.ShaderMaterial;
3750
- /** The world instance to which this renderer belongs. */
3751
- readonly world: World;
3752
- /** The THREE.js renderer used to make the visibility test. */
3753
- readonly renderer: THREE.WebGLRenderer;
3754
- protected readonly worker: Worker;
3755
- private _width;
3756
- private _height;
3757
- private readonly _postQuad;
3758
- private readonly tempRT;
3759
- private readonly resultRT;
3760
- private readonly bufferSize;
3761
- private readonly _buffer;
3762
- protected _isWorkerBusy: boolean;
3763
- constructor(components: Components, world: World);
3764
- /** {@link Disposable.dispose} */
3765
- dispose(): void;
3766
- /**
3767
- * The function that the culler uses to reprocess the scene. Generally it's
3768
- * better to call needsUpdate, but you can also call this to force it.
3769
- * @param force if true, it will refresh the scene even if needsUpdate is
3770
- * not true.
3771
- */
3772
- compute: () => Promise<void>;
3773
- private handleWorkerMessage;
3774
- }
3775
3850
  import { NavigationMode } from "./types";
3776
3851
  import { OrthoPerspectiveCamera } from "../index";
3777
3852
  /**
@@ -3868,16 +3943,91 @@ export interface NavigationMode {
3868
3943
  /** The unique ID of this navigation mode. */
3869
3944
  id: NavModeID;
3870
3945
  /**
3871
- * Enable or disable this navigation mode.
3872
- * When a new navigation mode is enabled, the previous navigation mode
3873
- * must be disabled.
3874
- *
3875
- * @param active - whether to enable or disable this mode.
3876
- * @param options - any additional data required to enable or disable it.
3877
- * */
3878
- set: (active: boolean, options?: any) => void;
3879
- /** Whether this navigation mode is active or not. */
3880
- enabled: boolean;
3946
+ * Enable or disable this navigation mode.
3947
+ * When a new navigation mode is enabled, the previous navigation mode
3948
+ * must be disabled.
3949
+ *
3950
+ * @param active - whether to enable or disable this mode.
3951
+ * @param options - any additional data required to enable or disable it.
3952
+ * */
3953
+ set: (active: boolean, options?: any) => void;
3954
+ /** Whether this navigation mode is active or not. */
3955
+ enabled: boolean;
3956
+ }
3957
+ import * as THREE from "three";
3958
+ import { Hideable, Event, World, Disposable } from "../../Types";
3959
+ import { Components } from "../../Components";
3960
+ /**
3961
+ * Configuration interface for the {@link SimpleGrid} class.
3962
+ */
3963
+ export interface GridConfig {
3964
+ /**
3965
+ * The color of the grid lines.
3966
+ */
3967
+ color: THREE.Color;
3968
+ /**
3969
+ * The size of the primary grid lines.
3970
+ */
3971
+ size1: number;
3972
+ /**
3973
+ * The size of the secondary grid lines.
3974
+ */
3975
+ size2: number;
3976
+ /**
3977
+ * The distance at which the grid lines start to fade away.
3978
+ */
3979
+ distance: number;
3980
+ }
3981
+ /**
3982
+ * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
3983
+ */
3984
+ export declare class SimpleGrid implements Hideable, Disposable {
3985
+ /** {@link Disposable.onDisposed} */
3986
+ readonly onDisposed: Event<unknown>;
3987
+ /** The world instance to which this Raycaster belongs. */
3988
+ world: World;
3989
+ /** The components instance to which this grid belongs. */
3990
+ components: Components;
3991
+ /** {@link Hideable.visible} */
3992
+ get visible(): boolean;
3993
+ /** {@link Hideable.visible} */
3994
+ set visible(visible: boolean);
3995
+ /** The material of the grid. */
3996
+ get material(): THREE.ShaderMaterial;
3997
+ /**
3998
+ * Whether the grid should fade away with distance. Recommended to be true for
3999
+ * perspective cameras and false for orthographic cameras.
4000
+ */
4001
+ get fade(): boolean;
4002
+ /**
4003
+ * Whether the grid should fade away with distance. Recommended to be true for
4004
+ * perspective cameras and false for orthographic cameras.
4005
+ */
4006
+ set fade(active: boolean);
4007
+ /** The Three.js mesh that contains the infinite grid. */
4008
+ readonly three: THREE.Mesh;
4009
+ private _fade;
4010
+ constructor(components: Components, world: World, config: GridConfig);
4011
+ /** {@link Disposable.dispose} */
4012
+ dispose(): void;
4013
+ private setupEvents;
4014
+ private updateZoom;
4015
+ }
4016
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
4017
+ /**
4018
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
4019
+ */
4020
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
4021
+ /**
4022
+ * Minimum number of geometries to be streamed.
4023
+ * Defaults to 10 geometries.
4024
+ */
4025
+ minGeometrySize: number;
4026
+ /**
4027
+ * Minimum amount of assets to be streamed.
4028
+ * Defaults to 1000 assets.
4029
+ */
4030
+ minAssetsSize: number;
3881
4031
  }
3882
4032
  import * as THREE from "three";
3883
4033
  import * as WEBIFC from "web-ifc";
@@ -3894,10 +4044,34 @@ export declare class CivilReader {
3894
4044
  } | undefined;
3895
4045
  private getCurves;
3896
4046
  }
3897
- import * as WEBIFC from "web-ifc";
3898
- export declare class IfcMetadataReader {
3899
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3900
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4047
+ /**
4048
+ * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
4049
+ */
4050
+ export interface StreamedGeometries {
4051
+ [id: number]: {
4052
+ /** The bounding box of the geometry as a Float32Array. */
4053
+ boundingBox: Float32Array;
4054
+ /** A boolean indicating whether the geometry has holes. */
4055
+ hasHoles: boolean;
4056
+ /** An optional file path for the geometry data. */
4057
+ geometryFile?: string;
4058
+ };
4059
+ }
4060
+ /**
4061
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
4062
+ */
4063
+ export interface StreamedAsset {
4064
+ /** The unique identifier of the asset. */
4065
+ id: number;
4066
+ /** An array of geometries associated with the asset. */
4067
+ geometries: {
4068
+ /** The unique identifier of the geometry. */
4069
+ geometryID: number;
4070
+ /** The transformation matrix of the geometry as a number array. */
4071
+ transformation: number[];
4072
+ /** The color of the geometry as a number array. */
4073
+ color: number[];
4074
+ }[];
3901
4075
  }
3902
4076
  import * as WEBIFC from "web-ifc";
3903
4077
  import * as THREE from "three";
@@ -3909,6 +4083,11 @@ export declare class Units {
3909
4083
  private getLengthUnits;
3910
4084
  private getScaleMatrix;
3911
4085
  }
4086
+ import * as WEBIFC from "web-ifc";
4087
+ export declare class IfcMetadataReader {
4088
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4089
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4090
+ }
3912
4091
  import * as THREE from "three";
3913
4092
  import { Hideable, Disposable, Event, World } from "../../Types";
3914
4093
  import { Components } from "../../Components";
@@ -4008,50 +4187,72 @@ export declare class SimplePlane implements Disposable, Hideable {
4008
4187
  private newHelper;
4009
4188
  private static newPlaneMesh;
4010
4189
  }
4190
+ import * as THREE from "three";
4191
+ import { Event, World } from "../../Types";
4192
+ import { Components } from "../../Components";
4011
4193
  /**
4012
- * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
4013
- */
4014
- export interface StreamedGeometries {
4015
- [id: number]: {
4016
- /** The bounding box of the geometry as a Float32Array. */
4017
- boundingBox: Float32Array;
4018
- /** A boolean indicating whether the geometry has holes. */
4019
- hasHoles: boolean;
4020
- /** An optional file path for the geometry data. */
4021
- geometryFile?: string;
4022
- };
4023
- }
4024
- /**
4025
- * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
4026
- */
4027
- export interface StreamedAsset {
4028
- /** The unique identifier of the asset. */
4029
- id: number;
4030
- /** An array of geometries associated with the asset. */
4031
- geometries: {
4032
- /** The unique identifier of the geometry. */
4033
- geometryID: number;
4034
- /** The transformation matrix of the geometry as a number array. */
4035
- transformation: number[];
4036
- /** The color of the geometry as a number array. */
4037
- color: number[];
4038
- }[];
4039
- }
4040
- import { IfcFragmentSettings } from "../../IfcLoader/src";
4041
- /**
4042
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
4194
+ * A base renderer to determine visibility on screen.
4043
4195
  */
4044
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
4196
+ export declare class DistanceRenderer {
4197
+ /** {@link Disposable.onDisposed} */
4198
+ readonly onDisposed: Event<string>;
4045
4199
  /**
4046
- * Minimum number of geometries to be streamed.
4047
- * Defaults to 10 geometries.
4200
+ * Fires after making the visibility check to the meshes. It lists the
4201
+ * meshes that are currently visible, and the ones that were visible
4202
+ * just before but not anymore.
4048
4203
  */
4049
- minGeometrySize: number;
4204
+ readonly onDistanceComputed: Event<number>;
4050
4205
  /**
4051
- * Minimum amount of assets to be streamed.
4052
- * Defaults to 1000 assets.
4206
+ * Objects that won't be taken into account in the distance check.
4053
4207
  */
4054
- minAssetsSize: number;
4208
+ excludedObjects: Set<THREE.Object3D<THREE.Object3DEventMap>>;
4209
+ /**
4210
+ * Whether this renderer is active or not. If not, it won't render anything.
4211
+ */
4212
+ enabled: boolean;
4213
+ /**
4214
+ * Render the internal scene used to determine the object visibility. Used
4215
+ * for debugging purposes.
4216
+ */
4217
+ renderDebugFrame: boolean;
4218
+ /** The components instance to which this renderer belongs. */
4219
+ components: Components;
4220
+ /**
4221
+ * The scene where the distance is computed.
4222
+ */
4223
+ scene: THREE.Scene;
4224
+ /**
4225
+ * The camera used to compute the distance.
4226
+ */
4227
+ camera: THREE.OrthographicCamera;
4228
+ /**
4229
+ * The material used to compute the distance.
4230
+ */
4231
+ depthMaterial: THREE.ShaderMaterial;
4232
+ /** The world instance to which this renderer belongs. */
4233
+ readonly world: World;
4234
+ /** The THREE.js renderer used to make the visibility test. */
4235
+ readonly renderer: THREE.WebGLRenderer;
4236
+ protected readonly worker: Worker;
4237
+ private _width;
4238
+ private _height;
4239
+ private readonly _postQuad;
4240
+ private readonly tempRT;
4241
+ private readonly resultRT;
4242
+ private readonly bufferSize;
4243
+ private readonly _buffer;
4244
+ protected _isWorkerBusy: boolean;
4245
+ constructor(components: Components, world: World);
4246
+ /** {@link Disposable.dispose} */
4247
+ dispose(): void;
4248
+ /**
4249
+ * The function that the culler uses to reprocess the scene. Generally it's
4250
+ * better to call needsUpdate, but you can also call this to force it.
4251
+ * @param force if true, it will refresh the scene even if needsUpdate is
4252
+ * not true.
4253
+ */
4254
+ compute: () => Promise<void>;
4255
+ private handleWorkerMessage;
4055
4256
  }
4056
4257
  import { Components } from "../../../core/Components";
4057
4258
  import { Viewpoint } from "../../../core/Viewpoints";
@@ -4068,12 +4269,6 @@ export declare class Topic implements BCFTopic {
4068
4269
  *
4069
4270
  * @remarks
4070
4271
  * The 'guid' is automatically generated upon topic creation and by no means it should change.
4071
- *
4072
- * @example
4073
- * '''typescript
4074
- * const topic = new Topic(components);
4075
- * console.log(topic.guid); // Output: "123e4567-e89b-12d3-a456-426614174000"
4076
- * '''
4077
4272
  */
4078
4273
  guid: string;
4079
4274
  title: string;
@@ -4201,112 +4396,80 @@ export interface BCFTopic {
4201
4396
  description?: string;
4202
4397
  stage?: string;
4203
4398
  }
4399
+ /**
4400
+ * Configuration settings for managing BCF topics.
4401
+ * This interface defines the properties and their meanings used to control the behavior of exporting and importing BCF topics.
4402
+ */
4204
4403
  export interface BCFTopicsConfig {
4404
+ /**
4405
+ * The BCF version used during export.
4406
+ */
4205
4407
  version: BCFVersion;
4408
+ /**
4409
+ * The email of the user creating topics using this component.
4410
+ */
4206
4411
  author: string;
4412
+ /**
4413
+ * The set of allowed topic types. This is exported inside the
4414
+ * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure).
4415
+ */
4207
4416
  types: Set<string>;
4417
+ /**
4418
+ * The set of allowed topic statuses. This is exported inside the
4419
+ * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure).
4420
+ */
4208
4421
  statuses: Set<string>;
4422
+ /**
4423
+ * The set of allowed topic priorities. This is exported inside the
4424
+ * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure).
4425
+ */
4209
4426
  priorities: Set<string>;
4427
+ /**
4428
+ * The set of allowed topic labels. This is exported inside the
4429
+ * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure).
4430
+ */
4210
4431
  labels: Set<string>;
4432
+ /**
4433
+ * The set of allowed topic stages. This is exported inside the
4434
+ * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure).
4435
+ */
4211
4436
  stages: Set<string>;
4437
+ /**
4438
+ * The set of allowed topic users. This is exported inside the
4439
+ * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure).
4440
+ */
4212
4441
  users: Set<string>;
4442
+ /**
4443
+ * Whether or not to include the AuthoringSoftwareId in the viewpoint components during export.
4444
+ */
4213
4445
  includeSelectionTag: boolean;
4446
+ /**
4447
+ * Updates the types, statuses, users, etc., after importing an external BCF.
4448
+ */
4214
4449
  updateExtensionsOnImport: boolean;
4450
+ /**
4451
+ * Only allow to use the extensions (types, statuses, etc.) defined in the config when setting the corresponding data in a topic.
4452
+ */
4215
4453
  strict: boolean;
4454
+ /**
4455
+ * If true, export the extensions (types, status, etc.) based on topics data. This doesn't update the extensions in the config.
4456
+ * If false, only export the extensions defined in each collection of possibilities set in the config.
4457
+ * In all cases, all the values from each collection of extensions defined in the config are going to be exported.
4458
+ */
4216
4459
  includeAllExtensionsOnExport: boolean;
4460
+ /**
4461
+ * Version to be used when importing if no bcf.version file is present in the incoming data.
4462
+ * When null, the importer will throw an error if the version is missing or is not supported.
4463
+ */
4217
4464
  fallbackVersionOnImport: BCFVersion | null;
4465
+ /**
4466
+ * If true, do not import a topic with missing information (guid, type, status, title, creationDate or creationAuthor).
4467
+ * If false, use default values for missing data.
4468
+ */
4218
4469
  ignoreIncompleteTopicsOnImport: boolean;
4219
4470
  }
4220
- import * as BUI from "@thatopen/ui";
4221
- import { TopicFormUI } from "./src/template";
4222
- /**
4223
- * Creates a Topic Form component with the given UI state.
4224
- *
4225
- * @param state - The initial state of the Topic Form component.
4226
- *
4227
- * @returns A tuple containing the created Topic Form component and a function to update it.
4228
- */
4229
- export declare const topicForm: (state: TopicFormUI) => [element: BUI.Table, update: (state?: Partial<TopicFormUI> | undefined) => TopicFormUI, currentState: () => TopicFormUI];
4230
- import * as BUI from "@thatopen/ui";
4231
- import { TopicPanelUI } from "./src/template";
4232
- /**
4233
- * Creates a Topic Panel component with the given UI state.
4234
- *
4235
- * @param state - The initial state of the Topic Panel component.
4236
- * @param autoUpdate - A flag indicating whether the component should automatically update based on events happening in the BCFTopic component.
4237
- * Default value is 'true'.
4238
- *
4239
- * @returns A tuple containing the created Topic Panel component and a function to update it.
4240
- */
4241
- export declare const topicPanel: (state: TopicPanelUI, autoUpdate?: boolean) => [element: BUI.Table, update: (state?: Partial<TopicPanelUI> | undefined) => TopicPanelUI, currentState: () => TopicPanelUI];
4242
- import * as BUI from "@thatopen/ui";
4243
- import { BCFTopicsUI } from "./src/template";
4244
- /**
4245
- * Creates a BCF Topics List component with the given UI state.
4246
- *
4247
- * @param state - The initial state of the BCF Topics List component.
4248
- * @param autoUpdate - A flag indicating whether the component should automatically update based on events happening in the BCFTopic component.
4249
- * Default value is 'true'.
4250
- *
4251
- * @returns A tuple containing the created BCF Topics List component and a function to update it.
4252
- */
4253
- export declare const bcfTopicsList: (state: BCFTopicsUI, autoUpdate?: boolean) => [element: BUI.Table, update: (state?: Partial<BCFTopicsUI> | undefined) => BCFTopicsUI, currentState: () => BCFTopicsUI];
4254
- import * as BUI from "@thatopen/ui";
4255
- import { ViewpointsUI } from "./src/template";
4256
- /**
4257
- * Creates a Viewpoints component with the given UI state.
4258
- *
4259
- * @param state - The initial state of the Viewpoints component.
4260
- * @param autoUpdate - A flag indicating whether the component should automatically update based on events happening in the BCFTopic component.
4261
- * Default value is 'true'.
4262
- *
4263
- * @returns A tuple containing the created Viewpoints component and a function to update it.
4264
- */
4265
- export declare const viewpointsList: (state: ViewpointsUI, autoUpdate?: boolean) => [element: BUI.Table, update: (state?: Partial<ViewpointsUI> | undefined) => ViewpointsUI, currentState: () => ViewpointsUI];
4266
- import * as BUI from "@thatopen/ui";
4267
- import { Topic } from "../../Topic";
4268
- import { Components } from "../../../../../core";
4269
- interface DataStyles {
4270
- users: {
4271
- [email: string]: {
4272
- name: string;
4273
- picture?: string;
4274
- };
4275
- };
4276
- }
4277
- export interface TopicFormUI {
4278
- components: Components;
4279
- topic?: Topic;
4280
- onSubmit?: (topic: Topic) => void | Promise<void>;
4281
- onCancel?: () => void | Promise<void>;
4282
- styles?: Partial<DataStyles>;
4283
- }
4284
- export declare const topicFormTemplate: (state: TopicFormUI) => BUI.TemplateResult<1>;
4285
- export {};
4286
- import { BufferGeometry } from "three";
4287
- import * as THREE from "three";
4288
- export declare class TransformHelper {
4289
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
4290
- }
4291
- import * as BUI from "@thatopen/ui";
4292
- import { Components, Viewpoint } from "../../../../../core";
4293
- import { Topic } from "../../Topic";
4294
- interface ViewpointUIActions {
4295
- selectComponents: boolean;
4296
- colorizeComponent: boolean;
4297
- resetColors: boolean;
4298
- updateCamera: boolean;
4299
- delete: boolean;
4300
- unlink: boolean;
4301
- }
4302
- export interface ViewpointsUI {
4303
- components: Components;
4304
- topic?: Topic;
4305
- actions?: Partial<ViewpointUIActions>;
4306
- onViewpointEnter?: (viewpoint: Viewpoint) => void | Promise<void>;
4307
- }
4308
- export declare const viewpointsListTemplate: (state: ViewpointsUI) => BUI.TemplateResult<1>;
4309
- export {};
4471
+ import { BCFTopics } from "../..";
4472
+ export declare const extensionsImporter: (manager: BCFTopics, extensionsXML: string) => void;
4310
4473
  import * as WEBIFC from "web-ifc";
4311
4474
  export type RelationsMap = Map<number, Map<number, number[]>>;
4312
4475
  export interface ModelsRelationMap {
@@ -4362,112 +4525,10 @@ export type IfcRelations = [
4362
4525
  typeof WEBIFC.IFCRELNESTS
4363
4526
  ];
4364
4527
  export type IfcRelation = IfcRelations[number];
4365
- import * as BUI from "@thatopen/ui";
4366
- import { Components } from "../../../../../core";
4367
- import { Topic } from "../../Topic";
4368
- interface DataStyles {
4369
- [name: string]: {
4370
- icon?: string;
4371
- style?: Record<string, string>;
4372
- };
4373
- }
4374
- interface UserStyles {
4375
- [email: string]: {
4376
- name: string;
4377
- picture?: string;
4378
- };
4379
- }
4380
- interface TopicDataStyles {
4381
- priorities?: DataStyles;
4382
- statuses?: DataStyles;
4383
- types?: DataStyles;
4384
- users?: UserStyles;
4385
- }
4386
- export interface BCFTopicsUI {
4387
- components: Components;
4388
- topics?: Iterable<Topic>;
4389
- dataStyles?: TopicDataStyles;
4390
- onTopicEnter?: (topic: Topic) => void | Promise<void>;
4391
- }
4392
- export declare const bcfTopicsListTemplate: (state: BCFTopicsUI) => BUI.TemplateResult<1>;
4393
- export {};
4394
- import * as BUI from "@thatopen/ui";
4395
- import { Components, World } from "../../../../../core";
4396
- import { Topic } from "../../Topic";
4397
- interface DataStyles {
4398
- priorities: {
4399
- [name: string]: {
4400
- icon?: string;
4401
- style?: Record<string, string>;
4402
- };
4403
- };
4404
- statuses: {
4405
- [name: string]: {
4406
- icon?: string;
4407
- style?: Record<string, string>;
4408
- };
4409
- };
4410
- types: {
4411
- [name: string]: {
4412
- icon?: string;
4413
- style?: Record<string, string>;
4414
- };
4415
- };
4416
- users: {
4417
- [email: string]: {
4418
- name: string;
4419
- picture?: string;
4420
- };
4421
- };
4422
- }
4423
- interface TopicPanelActions {
4424
- update: boolean;
4425
- addComments: boolean;
4426
- addViewpoints: boolean;
4427
- linkViewpoints: boolean;
4428
- linkTopics: boolean;
4429
- }
4430
- export interface TopicPanelUI {
4431
- components: Components;
4432
- topic?: Topic;
4433
- styles?: Partial<DataStyles>;
4434
- onUpdateInformation?: (topic: Topic) => void | Promise<void>;
4435
- actions?: Partial<TopicPanelActions>;
4436
- world?: World;
4437
- }
4438
- export declare const topicPanelTemplate: (state: TopicPanelUI) => BUI.TemplateResult<1>;
4439
- export {};
4440
- import * as BUI from "@thatopen/ui";
4441
- import { Topic } from "../../Topic";
4442
- import { Viewpoint } from "../../../../../core";
4443
- interface UserStyles {
4444
- [email: string]: {
4445
- name: string;
4446
- picture?: string;
4447
- };
4448
- }
4449
- interface TopicCommentsActions {
4450
- delete: boolean;
4451
- }
4452
- export interface TopicCommentsUI {
4453
- topic: Topic;
4454
- viewpoint?: Viewpoint;
4455
- styles?: UserStyles;
4456
- actions?: Partial<TopicCommentsActions>;
4528
+ import { BufferGeometry } from "three";
4529
+ import * as THREE from "three";
4530
+ export declare class TransformHelper {
4531
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
4457
4532
  }
4458
- export declare const topicCommentsTemplate: (state: TopicCommentsUI) => BUI.TemplateResult<1>;
4459
- export {};
4460
- import * as BUI from "@thatopen/ui";
4461
- import { TopicCommentsUI } from "./src/template";
4462
- /**
4463
- * Creates a Topic Comments List component with the given UI state.
4464
- *
4465
- * @param state - The initial state of the Topic Comments List component.
4466
- * @param autoUpdate - A flag indicating whether the component should automatically update based on events happening in the BCFTopic component.
4467
- * Default value is 'true'.
4468
- *
4469
- * @returns A tuple containing the created Topic Comments List component and a function to update it.
4470
- */
4471
- export declare const topicComments: (state: TopicCommentsUI, autoUpdate?: boolean) => [element: BUI.Table, update: (state?: Partial<TopicCommentsUI> | undefined) => TopicCommentsUI, currentState: () => TopicCommentsUI];
4472
4533
 
4473
4534
  }