@thatopen/components 2.0.0-alpha.9 → 2.0.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.
Files changed (47) hide show
  1. package/dist/core/Clipper/index.d.ts +8 -12
  2. package/dist/core/Clipper/src/simple-plane.d.ts +2 -2
  3. package/dist/core/Cullers/index.d.ts +32 -2
  4. package/dist/core/Grids/index.d.ts +1 -1
  5. package/dist/core/Grids/src/simple-grid.d.ts +1 -3
  6. package/dist/core/MiniMap/index.d.ts +3 -2
  7. package/dist/core/MiniMap/src/index.d.ts +1 -1
  8. package/dist/core/OrthoPerspectiveCamera/index.d.ts +7 -5
  9. package/dist/core/OrthoPerspectiveCamera/src/first-person-mode.d.ts +2 -1
  10. package/dist/core/OrthoPerspectiveCamera/src/orbit-mode.d.ts +3 -2
  11. package/dist/core/OrthoPerspectiveCamera/src/plan-mode.d.ts +2 -1
  12. package/dist/core/OrthoPerspectiveCamera/src/projections.d.ts +3 -3
  13. package/dist/core/Raycasters/src/simple-raycaster.d.ts +1 -1
  14. package/dist/core/Worlds/index.d.ts +35 -0
  15. package/dist/core/Worlds/src/simple-camera.d.ts +1 -1
  16. package/dist/core/Worlds/src/simple-renderer.d.ts +2 -1
  17. package/dist/core/index.d.ts +0 -1
  18. package/dist/fragments/{BoundingBoxes → BoundingBoxer}/index.d.ts +1 -1
  19. package/dist/fragments/{FragmentClassifier → Classifier}/index.d.ts +1 -1
  20. package/dist/fragments/{FragmentExploder → Exploder}/index.d.ts +3 -5
  21. package/dist/fragments/{FragmentManager → FragmentsManager}/index.d.ts +14 -6
  22. package/dist/fragments/IfcGeometryTiler/src/streaming-settings.d.ts +1 -1
  23. package/dist/fragments/{FragmentIfcLoader → IfcLoader}/index.d.ts +1 -2
  24. package/dist/fragments/index.d.ts +6 -6
  25. package/dist/ifc/IfcJsonExporter/index.d.ts +6 -1
  26. package/dist/ifc/IfcPropertiesManager/index.d.ts +1 -2
  27. package/dist/ifc/IfcRelationsIndexer/index.d.ts +5 -8
  28. package/dist/ifc/IfcRelationsIndexer/src/relToAttributesMap.d.ts +3 -2
  29. package/dist/ifc/index.d.ts +0 -1
  30. package/dist/index.cjs +5 -5
  31. package/dist/index.mjs +2215 -2426
  32. package/dist/measurement/Utils/index.d.ts +9 -5
  33. package/dist/namespace.d.ts +1238 -1276
  34. package/dist/utils/vertex-picker.d.ts +2 -5
  35. package/package.json +4 -4
  36. package/dist/core/Materials/index.d.ts +0 -49
  37. package/dist/ifc/IfcPropertiesFinder/index.d.ts +0 -37
  38. package/dist/ifc/IfcPropertiesFinder/src/types.d.ts +0 -23
  39. package/dist/ifc/IfcRelationsIndexer/src/getRelationMap.d.ts +0 -3
  40. /package/dist/fragments/{FragmentHider → Hider}/index.d.ts +0 -0
  41. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/civil-reader.d.ts +0 -0
  42. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/ifc-fragment-settings.d.ts +0 -0
  43. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/ifc-metadata-reader.d.ts +0 -0
  44. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/index.d.ts +0 -0
  45. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/spatial-structure.d.ts +0 -0
  46. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/transform-helper.d.ts +0 -0
  47. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/units.d.ts +0 -0
@@ -1,168 +1,4 @@
1
1
  declare namespace OBC {
2
- import * as WEBIFC from "web-ifc";
3
- import { FragmentsGroup } from "@thatopen/fragments";
4
- import { Disposable, Event, Component, Components } from "../../core";
5
- import { RelationsMap, ModelsRelationMap, InverseAttributes, InverseAttribute } from "./src/types";
6
- /**
7
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
8
- * It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations.
9
- */
10
- export declare class IfcRelationsIndexer extends Component implements Disposable {
11
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
12
- /** {@link Disposable.onDisposed} */
13
- readonly onDisposed: Event<string>;
14
- enabled: boolean;
15
- readonly onRelationsIndexed: Event<{
16
- modelID: string;
17
- relationsMap: RelationsMap;
18
- }>;
19
- private _relToAttributesMap;
20
- /**
21
- * Array of inverse attribute names.
22
- * This array is used to define the inverse attributes that the indexer will process and index.
23
- */
24
- readonly inverseAttributes: InverseAttributes;
25
- /**
26
- * Holds the relationship mappings for each model processed by the indexer.
27
- * The structure is a map where each key is a model's UUID, and the value is another map.
28
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
29
- * representing a specific relation type, and the value is an array of expressIDs of entities
30
- * that are related through that relation type. This structure allows for efficient querying
31
- * of entity relationships within a model.
32
- */
33
- readonly relationMaps: ModelsRelationMap;
34
- constructor(components: Components);
35
- private onFragmentsDisposed;
36
- private getAttributeRels;
37
- /**
38
- * Adds a relation map to the model's relations map.
39
- *
40
- * @param model - The 'FragmentsGroup' model to which the relation map will be added.
41
- * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
42
- *
43
- * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
44
- */
45
- setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
46
- /**
47
- * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
48
- * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
49
- * and maps them in a structured way to facilitate quick access to related entities.
50
- *
51
- * The process involves querying the model for each relation type associated with the inverse attributes
52
- * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
53
- * and contains a nested map where each key is an entity's expressID and its value is another map.
54
- * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
55
- * of entities that are related through that attribute.
56
- *
57
- * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
58
- * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
59
- * representation of the relations indexed by entity expressIDs and relation types.
60
- * @throws An error if the model does not have properties loaded.
61
- */
62
- process(model: FragmentsGroup): Promise<RelationsMap>;
63
- /**
64
- * Processes a given model from a WebIfc API to index its IFC entities relations based on predefined inverse attributes.
65
- *
66
- * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
67
- * @param modelID - The unique identifier of the model within the WebIfc API.
68
- * @returns A promise that resolves to the relations map for the processed model.
69
- * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
70
- */
71
- processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
72
- /**
73
- * Retrieves the relations of a specific entity within a model based on the given relation name.
74
- * This method searches the indexed relation maps for the specified model and entity,
75
- * returning the IDs of related entities if a match is found.
76
- *
77
- * @param model The 'FragmentsGroup' model containing the entity.
78
- * @param expressID The unique identifier of the entity within the model.
79
- * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
80
- * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
81
- * or the specified relation name is not indexed.
82
- */
83
- getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
84
- /**
85
- * Serializes the relations of a given relation map into a JSON string.
86
- * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
87
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
88
- * The resulting object is then serialized into a JSON string.
89
- *
90
- * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
91
- * @returns A JSON string representing the serialized relations of the given relation map.
92
- */
93
- serializeRelations(relationMap: RelationsMap): string;
94
- /**
95
- * Serializes the relations of a specific model into a JSON string.
96
- * This method iterates through the relations indexed for the given model,
97
- * organizing them into a structured object where each key is an expressID of an entity,
98
- * and its value is another object mapping relation indices to arrays of related entity expressIDs.
99
- * The resulting object is then serialized into a JSON string.
100
- *
101
- * @param model The 'FragmentsGroup' model whose relations are to be serialized.
102
- * @returns A JSON string representing the serialized relations of the specified model.
103
- * If the model has no indexed relations, 'null' is returned.
104
- */
105
- serializeModelRelations(model: FragmentsGroup): string | null;
106
- /**
107
- * Serializes all relations of every model processed by the indexer into a JSON string.
108
- * This method iterates through each model's relations indexed in 'relationMaps', organizing them
109
- * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
110
- * and its value is another object mapping entity expressIDs to their related entities, categorized
111
- * by relation types. The structure facilitates easy access to any entity's relations across all models.
112
- *
113
- * @returns A JSON string representing the serialized relations of all models processed by the indexer.
114
- * If no relations have been indexed, an empty object is returned as a JSON string.
115
- */
116
- serializeAllRelations(): string;
117
- /**
118
- * Converts a JSON string representing relations between entities into a structured map.
119
- * This method parses the JSON string to reconstruct the relations map that indexes
120
- * entity relations by their express IDs. The outer map keys are the express IDs of entities,
121
- * and the values are maps where each key is a relation type ID and its value is an array
122
- * of express IDs of entities related through that relation type.
123
- *
124
- * @param json The JSON string to be parsed into the relations map.
125
- * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
126
- * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
127
- * is an array of express IDs (as numbers) of entities related through that relation type.
128
- */
129
- getRelationsMapFromJSON(json: string): RelationsMap;
130
- /**
131
- * Disposes the component, cleaning up resources and detaching event listeners.
132
- * This ensures that the component is properly cleaned up and does not leave behind any
133
- * references that could prevent garbage collection.
134
- */
135
- dispose(): void;
136
- }
137
- import * as WEBIFC from "web-ifc";
138
- import * as FRAG from "@thatopen/fragments";
139
- /**
140
- * Object to export all the properties from an IFC to a JS object.
141
- */
142
- export declare class IfcJsonExporter {
143
- /**
144
- * Exports all the properties of an IFC into an array of JS objects.
145
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
146
- * @param modelID ID of the IFC model whose properties to extract.
147
- * @param indirect whether to get the indirect relationships as well.
148
- * @param recursiveSpatial whether to get the properties of spatial items recursively
149
- * to make the location data available (e.g. absolute position of building).
150
- */
151
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
152
- }
153
- import { Component, Disposable, World, Event } from "../Types";
154
- import { SimpleRaycaster } from "./src";
155
- import { Components } from "../Components";
156
- export declare class Raycasters extends Component implements Disposable {
157
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
158
- enabled: boolean;
159
- list: Map<string, SimpleRaycaster>;
160
- onDisposed: Event<unknown>;
161
- constructor(components: Components);
162
- get(world: World): SimpleRaycaster;
163
- delete(world: World): void;
164
- dispose(): void;
165
- }
166
2
  import * as THREE from "three";
167
3
  import { Components } from "../Components";
168
4
  import { Component } from "../Types";
@@ -258,154 +94,169 @@ export declare class Components implements Disposable {
258
94
  private update;
259
95
  private static setupBVH;
260
96
  }
97
+ import { Component, Disposable, World, Event } from "../Types";
98
+ import { SimpleRaycaster } from "./src";
99
+ import { Components } from "../Components";
100
+ export declare class Raycasters extends Component implements Disposable {
101
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
102
+ enabled: boolean;
103
+ list: Map<string, SimpleRaycaster>;
104
+ onDisposed: Event<unknown>;
105
+ constructor(components: Components);
106
+ get(world: World): SimpleRaycaster;
107
+ delete(world: World): void;
108
+ dispose(): void;
109
+ }
261
110
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
262
111
  import { Components } from "../Components";
263
112
  import { SimpleWorld } from "./src";
264
113
  export declare class Worlds extends Component implements Updateable, Disposable {
114
+ /**
115
+ * A unique identifier for the component.
116
+ * This UUID is used to register the component within the Components system.
117
+ */
265
118
  static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
119
+ /**
120
+ * Event triggered after the update process of all worlds.
121
+ * Subscribers can listen to this event to perform actions post-update.
122
+ */
266
123
  readonly onAfterUpdate: Event<unknown>;
124
+ /**
125
+ * Event triggered before the update process of all worlds.
126
+ * Subscribers can listen to this event to perform actions pre-update.
127
+ */
267
128
  readonly onBeforeUpdate: Event<unknown>;
129
+ /**
130
+ * Event triggered when the Worlds component is disposed.
131
+ * Subscribers can listen to this event to perform cleanup actions.
132
+ */
268
133
  readonly onDisposed: Event<unknown>;
134
+ /**
135
+ * A collection of worlds managed by this component.
136
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
137
+ */
269
138
  list: Map<string, World>;
139
+ /**
140
+ * A flag indicating whether the Worlds component is enabled.
141
+ * If false, the update process will be skipped.
142
+ */
270
143
  enabled: boolean;
271
144
  constructor(components: Components);
145
+ /**
146
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
147
+ *
148
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
149
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
150
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
151
+ *
152
+ * @returns {SimpleWorld<T, U, S>} - The newly created SimpleWorld instance.
153
+ *
154
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
155
+ */
272
156
  create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
273
157
  delete(world: World): void;
274
158
  dispose(): void;
275
159
  update(delta?: number): void | Promise<void>;
276
160
  }
277
- import * as FRAGS from "@thatopen/fragments";
278
- import { FragmentsGroup } from "@thatopen/fragments";
279
- import { Disposable, Event, Component, Components } from "../../core";
280
- import { QueryGroup } from "./src/types";
281
- export interface QueryResult {
282
- [modelID: string]: {
283
- modelEntities: Set<number>;
284
- otherEntities: Set<number>;
285
- };
286
- }
287
- export interface IndexedModels {
288
- [modelID: string]: {
289
- [expressID: number]: Set<number>;
290
- };
291
- }
292
- export declare class IfcPropertiesFinder extends Component implements Disposable {
293
- readonly onFound: Event<FRAGS.FragmentIdMap>;
294
- /** {@link Disposable.onDisposed} */
295
- readonly onDisposed: Event<unknown>;
296
- enabled: boolean;
297
- indexedModels: IndexedModels;
298
- private readonly _conditionFunctions;
299
- private _noHandleAttributes;
300
- constructor(components: Components);
301
- private onFragmentsDisposed;
302
- dispose(): void;
303
- private indexEntityRelations;
304
- find(groups: QueryGroup[], queryModels?: FragmentsGroup[]): Promise<FRAGS.FragmentIdMap>;
305
- private toFragmentMap;
306
- private simpleQuery;
307
- private getMatchingEntities;
308
- private combineArrays;
309
- private getCommonElements;
310
- private arrayIntersection;
311
- private arrayUnion;
312
- private getConditionFunctions;
313
- }
161
+ import * as THREE from "three";
162
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
163
+ import { SimplePlane } from "./src";
314
164
  import { Components } from "../Components";
315
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
316
- import { Component, Event, Disposable, World } from "../Types";
317
165
  /**
318
- * A tool to handle big scenes efficiently by automatically hiding the objects
319
- * that are not visible to the camera.
166
+ * A lightweight component to easily create and handle
167
+ * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
168
+ *
169
+ * @param components - the instance of {@link Components} used.
170
+ * E.g. {@link SimplePlane}.
320
171
  */
321
- export declare class Cullers extends Component implements Disposable {
322
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
323
- private _enabled;
324
- list: Map<string, MeshCullerRenderer>;
172
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
173
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
174
+ /** {@link Createable.onAfterCreate} */
175
+ readonly onAfterCreate: Event<SimplePlane>;
176
+ /** {@link Createable.onAfterDelete} */
177
+ readonly onAfterDelete: Event<SimplePlane>;
178
+ /** Event that fires when the user starts dragging a clipping plane. */
179
+ readonly onBeforeDrag: Event<void>;
180
+ /** Event that fires when the user stops dragging a clipping plane. */
181
+ readonly onAfterDrag: Event<void>;
182
+ readonly onBeforeCreate: Event<unknown>;
183
+ readonly onBeforeCancel: Event<unknown>;
184
+ readonly onAfterCancel: Event<unknown>;
185
+ readonly onBeforeDelete: Event<unknown>;
325
186
  /** {@link Disposable.onDisposed} */
326
- readonly onDisposed: Event<unknown>;
187
+ readonly onDisposed: Event<string>;
188
+ /**
189
+ * Whether to force the clipping plane to be orthogonal in the Y direction
190
+ * (up). This is desirable when clipping a building horizontally and a
191
+ * clipping plane is created in its roof, which might have a slight
192
+ * slope for draining purposes.
193
+ */
194
+ orthogonalY: boolean;
195
+ /**
196
+ * The tolerance that determines whether an almost-horizontal clipping plane
197
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
198
+ * has to be 'true' for this to apply.
199
+ */
200
+ toleranceOrthogonalY: number;
201
+ Type: new (...args: any) => SimplePlane;
202
+ list: SimplePlane[];
203
+ /** The material used in all the clipping planes. */
204
+ private _material;
205
+ private _size;
206
+ private _enabled;
207
+ private _visible;
327
208
  /** {@link Component.enabled} */
328
209
  get enabled(): boolean;
329
- set enabled(value: boolean);
330
- constructor(components: Components);
331
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
332
- delete(world: World): void;
333
- /** {@link Disposable.dispose} */
334
- dispose(): void;
335
- }
336
- import * as WEBIFC from "web-ifc";
337
- import { FragmentsGroup } from "@thatopen/fragments";
338
- import { Component, Disposable, Event, Components } from "../../core";
339
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
340
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
341
- type NumericPropTypes = "IfcInteger" | "IfcReal";
342
- interface ChangeMap {
343
- [modelID: string]: Set<number>;
344
- }
345
- interface AttributeListener {
346
- [modelID: string]: {
347
- [expressID: number]: {
348
- [attributeName: string]: Event<String | Boolean | Number>;
349
- };
350
- };
351
- }
352
- export declare class IfcPropertiesManager extends Component implements Disposable {
353
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
354
- /** {@link Disposable.onDisposed} */
355
- readonly onDisposed: Event<string>;
356
- readonly onRequestFile: Event<unknown>;
357
- ifcToExport: ArrayBuffer | null;
358
- readonly onElementToPset: Event<{
359
- model: FragmentsGroup;
360
- psetID: number;
361
- elementID: number;
362
- }>;
363
- readonly onPropToPset: Event<{
364
- model: FragmentsGroup;
365
- psetID: number;
366
- propID: number;
367
- }>;
368
- readonly onPsetRemoved: Event<{
369
- model: FragmentsGroup;
370
- psetID: number;
371
- }>;
372
- readonly onDataChanged: Event<{
373
- model: FragmentsGroup;
374
- expressID: number;
375
- }>;
376
- wasm: {
377
- path: string;
378
- absolute: boolean;
379
- };
380
- enabled: boolean;
381
- attributeListeners: AttributeListener;
382
- selectedModel?: FragmentsGroup;
383
- private _changeMap;
210
+ /** {@link Component.enabled} */
211
+ set enabled(state: boolean);
212
+ /** {@link Hideable.visible } */
213
+ get visible(): boolean;
214
+ /** {@link Hideable.visible } */
215
+ set visible(state: boolean);
216
+ /** The material of the clipping plane representation. */
217
+ get material(): THREE.MeshBasicMaterial;
218
+ /** The material of the clipping plane representation. */
219
+ set material(material: THREE.MeshBasicMaterial);
220
+ /** The size of the geometric representation of the clippings planes. */
221
+ get size(): number;
222
+ /** The size of the geometric representation of the clippings planes. */
223
+ set size(size: number);
384
224
  constructor(components: Components);
385
- get(): ChangeMap;
225
+ /** {@link Disposable.dispose} */
386
226
  dispose(): void;
387
- private increaseMaxID;
388
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
389
- private newGUID;
390
- private getOwnerHistory;
391
- private registerChange;
392
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
393
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
394
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
395
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
396
- }>;
397
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
398
- private newSingleProperty;
399
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
400
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
401
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
402
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
403
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
404
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
405
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
406
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
227
+ /** {@link Createable.create} */
228
+ create(world: World): void;
229
+ /**
230
+ * Creates a plane in a certain place and with a certain orientation,
231
+ * without the need of the mouse.
232
+ *
233
+ * @param world - the world where this plane should be created.
234
+ * @param normal - the orientation of the clipping plane.
235
+ * @param point - the position of the clipping plane.
236
+ * navigation.
237
+ */
238
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
239
+ /**
240
+ * {@link Createable.delete}
241
+ *
242
+ * @param world - the world where the plane to delete is.
243
+ * @param plane - the plane to delete. If undefined, the first plane
244
+ * found under the cursor will be deleted.
245
+ */
246
+ delete(world: World, plane?: SimplePlane): void;
247
+ /** Deletes all the existing clipping planes. */
248
+ deleteAll(): void;
249
+ private deletePlane;
250
+ private pickPlane;
251
+ private getAllPlaneMeshes;
252
+ private createPlaneFromIntersection;
253
+ private getWorldNormal;
254
+ private normalizePlaneDirectionY;
255
+ private newPlane;
256
+ private updateMaterialsAndPlanes;
257
+ private _onStartDragging;
258
+ private _onEndDragging;
407
259
  }
408
- export {};
409
260
  import { Component, Disposable, World, Event } from "../Types";
410
261
  import { GridConfig, SimpleGrid } from "./src";
411
262
  export declare class Grids extends Component implements Disposable {
@@ -415,126 +266,13 @@ export declare class Grids extends Component implements Disposable {
415
266
  config: Required<GridConfig>;
416
267
  /** {@link Component.enabled} */
417
268
  enabled: boolean;
418
- create(world: World): void;
269
+ create(world: World): SimpleGrid;
419
270
  delete(world: World): void;
420
271
  dispose(): void;
421
272
  }
422
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
423
- import * as THREE from "three";
424
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
425
- center: THREE.Vector3;
426
- halfSizes: THREE.Vector3;
427
- rotation: THREE.Matrix3;
428
- transformation: THREE.Matrix4;
429
- };
430
- export declare class UUID {
431
- private static _pattern;
432
- private static _lut;
433
- static create(): string;
434
- static validate(uuid: string): void;
435
- }
436
- import * as THREE from "three";
437
- export declare class MaterialsUtils {
438
- static isTransparent(material: THREE.Material): boolean;
439
- }
440
- import * as THREE from "three";
441
- import { Component, Components, Event, World, Disposable } from "../core";
442
- export interface VertexPickerConfig {
443
- showOnlyVertex: boolean;
444
- snapDistance: number;
445
- previewElement: HTMLElement;
446
- }
447
- export declare class VertexPicker extends Component implements Disposable {
448
- onVertexFound: Event<THREE.Vector3>;
449
- onVertexLost: Event<THREE.Vector3>;
450
- components: Components;
451
- private _pickedPoint;
452
- private _config;
453
- private _enabled;
454
- private _workingPlane;
455
- /** {@link Disposable.onDisposed} */
456
- readonly onDisposed: Event<unknown>;
457
- set enabled(value: boolean);
458
- get enabled(): boolean;
459
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
460
- [Symbol.dispose](): void;
461
- set workingPlane(plane: THREE.Plane | null);
462
- get workingPlane(): THREE.Plane | null;
463
- set config(value: Partial<VertexPickerConfig>);
464
- get config(): Partial<VertexPickerConfig>;
465
- dispose(): void;
466
- get(world: World): THREE.Vector3 | null;
467
- private getClosestVertex;
468
- private getVertices;
469
- private getVertex;
470
- }
471
- import { Component, Components, Disposable, Updateable, World, Event } from "../../core";
472
- import { MiniMap } from "./src";
473
- export declare class MiniMaps extends Component implements Updateable, Disposable {
474
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
475
- readonly onAfterUpdate: Event<unknown>;
476
- readonly onBeforeUpdate: Event<unknown>;
477
- readonly onDisposed: Event<unknown>;
478
- enabled: boolean;
479
- list: Map<string, MiniMap>;
480
- constructor(components: Components);
481
- create(world: World): MiniMap;
482
- delete(id: string): void;
483
- dispose(): void | Promise<void>;
484
- update(): void;
485
- }
486
273
  import * as THREE from "three";
487
- import { Component, Disposable, Event } from "../Types";
488
274
  import { Components } from "../Components";
489
- /**
490
- * A tool to easily handle the materials of massive amounts of
491
- * objects and scene background easily.
492
- */
493
- export declare class Materials extends Component implements Disposable {
494
- static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
495
- /** {@link Component.enabled} */
496
- enabled: boolean;
497
- /** {@link Disposable.onDisposed} */
498
- readonly onDisposed: Event<string>;
499
- list: {
500
- [id: string]: {
501
- material: THREE.Material;
502
- meshes: Set<THREE.Mesh | THREE.InstancedMesh>;
503
- };
504
- };
505
- private _originals;
506
- constructor(components: Components);
507
- /** {@link Disposable.dispose} */
508
- dispose(): void;
509
- /**
510
- * Turns the specified material styles on or off.
511
- *
512
- * @param active whether to turn it on or off.
513
- * @param ids the ids of the style to turn on or off.
514
- */
515
- set(active: boolean, ids?: string[]): void;
516
- /**
517
- * Creates a new material style.
518
- * @param id the identifier of the style to create.
519
- * @param material the material of the style.
520
- */
521
- addMaterial(id: string, material: THREE.Material): void;
522
- /**
523
- * Assign meshes to a certain style.
524
- * @param id the identifier of the style.
525
- * @param meshes the meshes to assign to the style.
526
- */
527
- addMeshes(id: string, meshes: THREE.Mesh[]): void;
528
- /**
529
- * Remove meshes from a certain style.
530
- * @param id the identifier of the style.
531
- * @param meshes the meshes to assign to the style.
532
- */
533
- removeMeshes(id: string, meshes: THREE.Mesh[]): void;
534
- }
535
- import * as THREE from "three";
536
- import { Components } from "../../core/Components";
537
- import { SimpleCamera } from "../../core";
275
+ import { SimpleCamera } from "..";
538
276
  import { NavigationMode, NavModeID, ProjectionManager } from "./src";
539
277
  /**
540
278
  * A flexible camera that uses
@@ -546,13 +284,15 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
546
284
  /**
547
285
  * The current {@link NavigationMode}.
548
286
  */
549
- mode: NavigationMode;
287
+ _mode: NavigationMode | null;
550
288
  readonly projection: ProjectionManager;
551
289
  readonly threeOrtho: THREE.OrthographicCamera;
290
+ readonly threePersp: THREE.PerspectiveCamera;
552
291
  protected readonly _userInputButtons: any;
553
292
  protected readonly _frustumSize = 50;
554
293
  protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
555
- get current(): THREE.PerspectiveCamera | THREE.OrthographicCamera;
294
+ private previousSize;
295
+ get mode(): NavigationMode;
556
296
  constructor(components: Components);
557
297
  /** {@link Disposable.dispose} */
558
298
  dispose(): void;
@@ -579,166 +319,356 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
579
319
  private disableUserInput;
580
320
  private enableUserInput;
581
321
  private newOrthoCamera;
582
- private setOrthoCameraAspect;
322
+ private setOrthoPerspCameraAspect;
583
323
  }
584
- import * as THREE from "three";
585
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
586
- import { SimplePlane } from "./src";
587
324
  import { Components } from "../Components";
325
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
326
+ import { Component, Event, Disposable, World } from "../Types";
588
327
  /**
589
- * A lightweight component to easily create and handle
590
- * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
591
- *
592
- * @param components - the instance of {@link Components} used.
593
- * @param planeType - the type of plane to be used by the clipper.
594
- * E.g. {@link SimplePlane}.
328
+ * A tool to handle big scenes efficiently by automatically hiding the objects
329
+ * that are not visible to the camera.
595
330
  */
596
- export declare class Clipper<T extends SimplePlane> extends Component implements Createable, Disposable, Hideable {
597
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
598
- /** {@link Createable.onAfterCreate} */
599
- readonly onAfterCreate: Event<T>;
600
- /** {@link Createable.onAfterDelete} */
601
- readonly onAfterDelete: Event<T>;
602
- /** Event that fires when the user starts dragging a clipping plane. */
603
- readonly onBeforeDrag: Event<void>;
604
- /** Event that fires when the user stops dragging a clipping plane. */
605
- readonly onAfterDrag: Event<void>;
606
- readonly onBeforeCreate: Event<unknown>;
607
- readonly onBeforeCancel: Event<unknown>;
608
- readonly onAfterCancel: Event<unknown>;
609
- readonly onBeforeDelete: Event<unknown>;
610
- /** {@link Disposable.onDisposed} */
611
- readonly onDisposed: Event<string>;
331
+ export declare class Cullers extends Component implements Disposable {
612
332
  /**
613
- * Whether to force the clipping plane to be orthogonal in the Y direction
614
- * (up). This is desirable when clipping a building horizontally and a
615
- * clipping plane is created in its roof, which might have a slight
616
- * slope for draining purposes.
333
+ * A unique identifier for the Cullers component.
617
334
  */
618
- orthogonalY: boolean;
335
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
619
336
  /**
620
- * The tolerance that determines whether an almost-horizontal clipping plane
621
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
622
- * has to be 'true' for this to apply.
337
+ * Indicates whether the Cullers component is enabled.
623
338
  */
624
- toleranceOrthogonalY: number;
625
- list: T[];
626
- protected PlaneType: new (...args: any) => SimplePlane | T;
627
- /** The material used in all the clipping planes. */
628
- protected _material: THREE.MeshBasicMaterial;
629
- private _size;
630
339
  private _enabled;
631
- private _visible;
632
- /** {@link Component.enabled} */
633
- get enabled(): boolean;
634
- /** {@link Component.enabled} */
635
- set enabled(state: boolean);
636
- /** {@link Hideable.visible } */
637
- get visible(): boolean;
638
- /** {@link Hideable.visible } */
639
- set visible(state: boolean);
640
- /** The material of the clipping plane representation. */
641
- get material(): THREE.MeshBasicMaterial;
642
- /** The material of the clipping plane representation. */
643
- set material(material: THREE.MeshBasicMaterial);
644
- /** The size of the geometric representation of the clippings planes. */
645
- get size(): number;
646
- /** The size of the geometric representation of the clippings planes. */
647
- set size(size: number);
648
- constructor(components: Components);
649
- endCreation(): void;
650
- cancelCreation(): void;
651
- /** {@link Disposable.dispose} */
652
- dispose(): void;
653
- /** {@link Createable.create} */
654
- create(world: World): void;
655
340
  /**
656
- * Creates a plane in a certain place and with a certain orientation,
657
- * without the need of the mouse.
341
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
342
+ */
343
+ list: Map<string, MeshCullerRenderer>;
344
+ /**
345
+ * An event that is triggered when the Cullers component is disposed.
346
+ */
347
+ readonly onDisposed: Event<unknown>;
348
+ /**
349
+ * Gets the enabled state of the Cullers component.
658
350
  *
659
- * @param world - the world where this plane should be created.
660
- * @param normal - the orientation of the clipping plane.
661
- * @param point - the position of the clipping plane.
662
- * navigation.
351
+ * @returns The current enabled state.
663
352
  */
664
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): T;
353
+ get enabled(): boolean;
665
354
  /**
666
- * {@link Createable.delete}
355
+ * Sets the enabled state of the Cullers component.
356
+ * Also sets the enabled state of all MeshCullerRenderer instances.
667
357
  *
668
- * @param world - the world where the plane to delete is.
669
- * @param plane - the plane to delete. If undefined, the first plane
670
- * found under the cursor will be deleted.
358
+ * @param value - The new enabled state.
671
359
  */
672
- delete(world: World, plane?: T): void;
673
- /** Deletes all the existing clipping planes. */
674
- deleteAll(): void;
675
- private deletePlane;
676
- private pickPlane;
677
- private getAllPlaneMeshes;
678
- private createPlaneFromIntersection;
679
- private getWorldNormal;
680
- private normalizePlaneDirectionY;
681
- private newPlane;
682
- protected newPlaneInstance(world: World, point: THREE.Vector3, normal: THREE.Vector3): T;
683
- private updateMaterialsAndPlanes;
684
- private _onStartDragging;
685
- private _onEndDragging;
360
+ set enabled(value: boolean);
361
+ constructor(components: Components);
362
+ /**
363
+ * Creates a new MeshCullerRenderer for the given world.
364
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
365
+ *
366
+ * @param world - The world for which to create the MeshCullerRenderer.
367
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
368
+ *
369
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
370
+ */
371
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
372
+ delete(world: World): void;
373
+ /** {@link Disposable.dispose} */
374
+ dispose(): void;
686
375
  }
687
- import * as THREE from "three";
688
- import * as FRAGS from "@thatopen/fragments";
689
- import { FragmentsGroup } from "@thatopen/fragments";
690
- import { Component, Components, Disposable, Event } from "../../core";
376
+ import { MiniMap } from "./src";
377
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
378
+ import { Components } from "../Components";
379
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
380
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
381
+ readonly onAfterUpdate: Event<unknown>;
382
+ readonly onBeforeUpdate: Event<unknown>;
383
+ readonly onDisposed: Event<unknown>;
384
+ enabled: boolean;
385
+ list: Map<string, MiniMap>;
386
+ constructor(components: Components);
387
+ create(world: World): MiniMap;
388
+ delete(id: string): void;
389
+ dispose(): void;
390
+ update(): void;
391
+ }
392
+ import * as WEBIFC from "web-ifc";
393
+ import * as FRAG from "@thatopen/fragments";
394
+ import { Component, Components } from "../../core";
691
395
  /**
692
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
693
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
396
+ * Object to export all the properties from an IFC to a JS object.
694
397
  */
695
- export declare class BoundingBoxes extends Component implements Disposable {
696
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
398
+ export declare class IfcJsonExporter extends Component {
399
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
697
400
  /** {@link Component.enabled} */
698
401
  enabled: boolean;
402
+ constructor(components: Components);
403
+ /**
404
+ * Exports all the properties of an IFC into an array of JS objects.
405
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
406
+ * @param modelID ID of the IFC model whose properties to extract.
407
+ * @param indirect whether to get the indirect relationships as well.
408
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
409
+ * to make the location data available (e.g. absolute position of building).
410
+ */
411
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
412
+ }
413
+ import * as THREE from "three";
414
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
415
+ center: THREE.Vector3;
416
+ halfSizes: THREE.Vector3;
417
+ rotation: THREE.Matrix3;
418
+ transformation: THREE.Matrix4;
419
+ };
420
+ export declare class UUID {
421
+ private static _pattern;
422
+ private static _lut;
423
+ static create(): string;
424
+ static validate(uuid: string): void;
425
+ }
426
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
427
+ import * as THREE from "three";
428
+ export declare class MaterialsUtils {
429
+ static isTransparent(material: THREE.Material): boolean;
430
+ }
431
+ import * as THREE from "three";
432
+ import { Component, Components, Event, World } from "../core";
433
+ export interface VertexPickerConfig {
434
+ showOnlyVertex: boolean;
435
+ snapDistance: number;
436
+ previewElement: HTMLElement;
437
+ }
438
+ export declare class VertexPicker extends Component {
439
+ onVertexFound: Event<THREE.Vector3>;
440
+ onVertexLost: Event<THREE.Vector3>;
441
+ components: Components;
442
+ private _pickedPoint;
443
+ private _config;
444
+ private _enabled;
445
+ private _workingPlane;
446
+ set enabled(value: boolean);
447
+ get enabled(): boolean;
448
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
449
+ set workingPlane(plane: THREE.Plane | null);
450
+ get workingPlane(): THREE.Plane | null;
451
+ set config(value: Partial<VertexPickerConfig>);
452
+ get config(): Partial<VertexPickerConfig>;
453
+ dispose(): void;
454
+ get(world: World): THREE.Vector3 | null;
455
+ private getClosestVertex;
456
+ private getVertices;
457
+ private getVertex;
458
+ }
459
+ import * as WEBIFC from "web-ifc";
460
+ import { FragmentsGroup } from "@thatopen/fragments";
461
+ import { Disposable, Event, Component, Components } from "../../core";
462
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
463
+ /**
464
+ * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
465
+ * It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations.
466
+ */
467
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
468
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
699
469
  /** {@link Disposable.onDisposed} */
700
- readonly onDisposed: Event<unknown>;
701
- private _absoluteMin;
702
- private _absoluteMax;
703
- private _meshes;
470
+ readonly onDisposed: Event<string>;
471
+ enabled: boolean;
472
+ readonly onRelationsIndexed: Event<{
473
+ modelID: string;
474
+ relationsMap: RelationsMap;
475
+ }>;
476
+ private _relToAttributesMap;
477
+ private _inverseAttributes;
478
+ private _ifcRels;
479
+ /**
480
+ * Holds the relationship mappings for each model processed by the indexer.
481
+ * The structure is a map where each key is a model's UUID, and the value is another map.
482
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
483
+ * representing a specific relation type, and the value is an array of expressIDs of entities
484
+ * that are related through that relation type. This structure allows for efficient querying
485
+ * of entity relationships within a model.
486
+ */
487
+ readonly relationMaps: ModelsRelationMap;
704
488
  constructor(components: Components);
705
- static getDimensions(bbox: THREE.Box3): {
706
- width: number;
707
- height: number;
708
- depth: number;
709
- center: THREE.Vector3;
710
- };
711
- static newBound(positive: boolean): THREE.Vector3;
712
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
713
- /** {@link Disposable.dispose} */
489
+ private onFragmentsDisposed;
490
+ /**
491
+ * Adds a relation map to the model's relations map.
492
+ *
493
+ * @param model - The 'FragmentsGroup' model to which the relation map will be added.
494
+ * @param relationMap - The 'RelationsMap' to be added to the model's relations map.
495
+ *
496
+ * @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
497
+ */
498
+ setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
499
+ /**
500
+ * Processes a given model to index its IFC entities relations based on predefined inverse attributes.
501
+ * This method iterates through each specified inverse attribute, retrieves the corresponding relations,
502
+ * and maps them in a structured way to facilitate quick access to related entities.
503
+ *
504
+ * The process involves querying the model for each relation type associated with the inverse attributes
505
+ * and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
506
+ * and contains a nested map where each key is an entity's expressID and its value is another map.
507
+ * This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
508
+ * of entities that are related through that attribute.
509
+ *
510
+ * @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
511
+ * @returns A promise that resolves to the relations map for the processed model. This map is a detailed
512
+ * representation of the relations indexed by entity expressIDs and relation types.
513
+ * @throws An error if the model does not have properties loaded.
514
+ */
515
+ process(model: FragmentsGroup): Promise<RelationsMap>;
516
+ /**
517
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
518
+ *
519
+ * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
520
+ * @param modelID - The unique identifier of the model within the WebIfc API.
521
+ * @returns A promise that resolves to the relations map for the processed model.
522
+ * This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
523
+ */
524
+ processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
525
+ /**
526
+ * Retrieves the relations of a specific entity within a model based on the given relation name.
527
+ * This method searches the indexed relation maps for the specified model and entity,
528
+ * returning the IDs of related entities if a match is found.
529
+ *
530
+ * @param model The 'FragmentsGroup' model containing the entity.
531
+ * @param expressID The unique identifier of the entity within the model.
532
+ * @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
533
+ * @returns An array of express IDs representing the related entities, or 'null' if no relations are found
534
+ * or the specified relation name is not indexed.
535
+ */
536
+ getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
537
+ /**
538
+ * Serializes the relations of a given relation map into a JSON string.
539
+ * This method iterates through the relations in the given map, organizing them into a structured object where each key is an expressID of an entity,
540
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
541
+ * The resulting object is then serialized into a JSON string.
542
+ *
543
+ * @param relationMap - The map of relations to be serialized. The map keys are expressIDs of entities, and the values are maps where each key is a relation type ID and its value is an array of expressIDs of entities related through that relation type.
544
+ * @returns A JSON string representing the serialized relations of the given relation map.
545
+ */
546
+ serializeRelations(relationMap: RelationsMap): string;
547
+ /**
548
+ * Serializes the relations of a specific model into a JSON string.
549
+ * This method iterates through the relations indexed for the given model,
550
+ * organizing them into a structured object where each key is an expressID of an entity,
551
+ * and its value is another object mapping relation indices to arrays of related entity expressIDs.
552
+ * The resulting object is then serialized into a JSON string.
553
+ *
554
+ * @param model The 'FragmentsGroup' model whose relations are to be serialized.
555
+ * @returns A JSON string representing the serialized relations of the specified model.
556
+ * If the model has no indexed relations, 'null' is returned.
557
+ */
558
+ serializeModelRelations(model: FragmentsGroup): string | null;
559
+ /**
560
+ * Serializes all relations of every model processed by the indexer into a JSON string.
561
+ * This method iterates through each model's relations indexed in 'relationMaps', organizing them
562
+ * into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
563
+ * and its value is another object mapping entity expressIDs to their related entities, categorized
564
+ * by relation types. The structure facilitates easy access to any entity's relations across all models.
565
+ *
566
+ * @returns A JSON string representing the serialized relations of all models processed by the indexer.
567
+ * If no relations have been indexed, an empty object is returned as a JSON string.
568
+ */
569
+ serializeAllRelations(): string;
570
+ /**
571
+ * Converts a JSON string representing relations between entities into a structured map.
572
+ * This method parses the JSON string to reconstruct the relations map that indexes
573
+ * entity relations by their express IDs. The outer map keys are the express IDs of entities,
574
+ * and the values are maps where each key is a relation type ID and its value is an array
575
+ * of express IDs of entities related through that relation type.
576
+ *
577
+ * @param json The JSON string to be parsed into the relations map.
578
+ * @returns A 'Map' where the key is the express ID of an entity as a number, and the value
579
+ * is another 'Map'. This inner map's key is the relation type ID as a number, and its value
580
+ * is an array of express IDs (as numbers) of entities related through that relation type.
581
+ */
582
+ getRelationsMapFromJSON(json: string): RelationsMap;
583
+ /**
584
+ * Disposes the component, cleaning up resources and detaching event listeners.
585
+ * This ensures that the component is properly cleaned up and does not leave behind any
586
+ * references that could prevent garbage collection.
587
+ */
714
588
  dispose(): void;
715
- get(): THREE.Box3;
716
- getSphere(): THREE.Sphere;
717
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
718
- reset(): void;
719
- add(group: FragmentsGroup): void;
720
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
721
- private static getFragmentBounds;
722
589
  }
723
- import * as THREE from "three";
724
- export interface MeasureEdge {
725
- distance: number;
726
- points: THREE.Vector3[];
590
+ export type { InverseAttribute } from "./src/types";
591
+ import * as WEBIFC from "web-ifc";
592
+ import { FragmentsGroup } from "@thatopen/fragments";
593
+ import { Component, Disposable, Event, Components } from "../../core";
594
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
595
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
596
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
597
+ interface ChangeMap {
598
+ [modelID: string]: Set<number>;
727
599
  }
728
- export declare class MeasurementUtils {
729
- static getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
730
- edges: MeasureEdge[];
731
- indices: Set<number>;
732
- } | null;
733
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
734
- private static getFaceData;
735
- static getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
736
- p1: THREE.Vector3;
737
- p2: THREE.Vector3;
738
- p3: THREE.Vector3;
739
- faceNormal: THREE.Vector3;
600
+ interface AttributeListener {
601
+ [modelID: string]: {
602
+ [expressID: number]: {
603
+ [attributeName: string]: Event<String | Boolean | Number>;
604
+ };
740
605
  };
741
- private static round;
606
+ }
607
+ export declare class IfcPropertiesManager extends Component implements Disposable {
608
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
609
+ /** {@link Disposable.onDisposed} */
610
+ readonly onDisposed: Event<string>;
611
+ readonly onRequestFile: Event<unknown>;
612
+ ifcToExport: ArrayBuffer | null;
613
+ readonly onElementToPset: Event<{
614
+ model: FragmentsGroup;
615
+ psetID: number;
616
+ elementID: number;
617
+ }>;
618
+ readonly onPropToPset: Event<{
619
+ model: FragmentsGroup;
620
+ psetID: number;
621
+ propID: number;
622
+ }>;
623
+ readonly onPsetRemoved: Event<{
624
+ model: FragmentsGroup;
625
+ psetID: number;
626
+ }>;
627
+ readonly onDataChanged: Event<{
628
+ model: FragmentsGroup;
629
+ expressID: number;
630
+ }>;
631
+ wasm: {
632
+ path: string;
633
+ absolute: boolean;
634
+ };
635
+ enabled: boolean;
636
+ attributeListeners: AttributeListener;
637
+ selectedModel?: FragmentsGroup;
638
+ changeMap: ChangeMap;
639
+ constructor(components: Components);
640
+ dispose(): void;
641
+ private increaseMaxID;
642
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
643
+ private newGUID;
644
+ private getOwnerHistory;
645
+ private registerChange;
646
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
647
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
648
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
649
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
650
+ }>;
651
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
652
+ private newSingleProperty;
653
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
654
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
655
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
656
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
657
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
658
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
659
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
660
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
661
+ }
662
+ export {};
663
+ import * as FRAGS from "@thatopen/fragments";
664
+ import { Components, Component } from "../../core";
665
+ export declare class FragmentHider extends Component {
666
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
667
+ enabled: boolean;
668
+ constructor(components: Components);
669
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
670
+ isolate(items: FRAGS.FragmentIdMap): void;
671
+ private updateCulledVisibility;
742
672
  }
743
673
  import * as THREE from "three";
744
674
  import * as FRAGS from "@thatopen/fragments";
@@ -748,7 +678,7 @@ export interface Classification {
748
678
  [className: string]: FRAGS.FragmentIdMap;
749
679
  };
750
680
  }
751
- export declare class FragmentClassifier extends Component implements Disposable {
681
+ export declare class Classifier extends Component implements Disposable {
752
682
  static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
753
683
  /** {@link Component.enabled} */
754
684
  enabled: boolean;
@@ -771,46 +701,83 @@ export declare class FragmentClassifier extends Component implements Disposable
771
701
  resetColor(items: FRAGS.FragmentIdMap): void;
772
702
  private saveItem;
773
703
  }
774
- import { Component, Disposable, Event, Components } from "../../core";
775
- export declare class FragmentExploder extends Component implements Disposable {
776
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
777
- enabled: boolean;
778
- height: number;
779
- groupName: string;
704
+ import * as WEBIFC from "web-ifc";
705
+ import * as FRAGS from "@thatopen/fragments";
706
+ import { IfcFragmentSettings } from "./src";
707
+ import { Component, Components, Event, Disposable } from "../../core";
708
+ export declare class IfcLoader extends Component implements Disposable {
709
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
710
+ readonly onIfcStartedLoading: Event<void>;
711
+ readonly onSetup: Event<void>;
780
712
  /** {@link Disposable.onDisposed} */
781
713
  readonly onDisposed: Event<string>;
782
- list: Set<string>;
714
+ settings: IfcFragmentSettings;
715
+ enabled: boolean;
716
+ webIfc: WEBIFC.IfcAPI;
717
+ private _material;
718
+ private _spatialTree;
719
+ private _metaData;
720
+ private _fragmentInstances;
721
+ private _civil;
722
+ private _visitedFragments;
723
+ private _materialT;
783
724
  constructor(components: Components);
784
725
  dispose(): void;
785
- explode(): void;
786
- reset(): void;
787
- update(): void;
726
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
727
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
728
+ readIfcFile(data: Uint8Array): Promise<number>;
729
+ private getAllGeometries;
730
+ cleanUp(): void;
731
+ private getMesh;
732
+ private getGeometry;
733
+ private autoSetWasm;
788
734
  }
735
+ import * as THREE from "three";
789
736
  import * as FRAGS from "@thatopen/fragments";
790
- import { Components, Component } from "../../core";
791
- export declare class FragmentHider extends Component {
792
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
737
+ import { FragmentsGroup } from "@thatopen/fragments";
738
+ import { Component, Components, Disposable, Event } from "../../core";
739
+ /**
740
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
741
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
742
+ */
743
+ export declare class BoundingBoxer extends Component implements Disposable {
744
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
745
+ /** {@link Component.enabled} */
793
746
  enabled: boolean;
747
+ /** {@link Disposable.onDisposed} */
748
+ readonly onDisposed: Event<unknown>;
749
+ private _absoluteMin;
750
+ private _absoluteMax;
751
+ private _meshes;
794
752
  constructor(components: Components);
795
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
796
- isolate(items: FRAGS.FragmentIdMap): void;
797
- private updateCulledVisibility;
798
- }
799
- import * as WEBIFC from "web-ifc";
800
- export interface IfcItemsCategories {
801
- [itemID: number]: number;
802
- }
803
- export declare class IfcCategories {
804
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
753
+ static getDimensions(bbox: THREE.Box3): {
754
+ width: number;
755
+ height: number;
756
+ depth: number;
757
+ center: THREE.Vector3;
758
+ };
759
+ static newBound(positive: boolean): THREE.Vector3;
760
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
761
+ /** {@link Disposable.dispose} */
762
+ dispose(): void;
763
+ get(): THREE.Box3;
764
+ getSphere(): THREE.Sphere;
765
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
766
+ reset(): void;
767
+ add(group: FragmentsGroup): void;
768
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
769
+ private static getFragmentBounds;
805
770
  }
806
771
  import { Fragment, FragmentsGroup } from "@thatopen/fragments";
807
772
  import * as THREE from "three";
773
+ import * as FRAGS from "@thatopen/fragments";
808
774
  import { Component, Components, Event, Disposable } from "../../core";
775
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
809
776
  /**
810
777
  * Object that can efficiently load binary files that contain
811
778
  * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
812
779
  */
813
- export declare class FragmentManager extends Component implements Disposable {
780
+ export declare class FragmentsManager extends Component implements Disposable {
814
781
  static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
815
782
  /** {@link Disposable.onDisposed} */
816
783
  readonly onDisposed: Event<unknown>;
@@ -819,123 +786,52 @@ export declare class FragmentManager extends Component implements Disposable {
819
786
  groupID: string;
820
787
  fragmentIDs: string[];
821
788
  }>;
822
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
823
- readonly list: Map<string, Fragment>;
824
- readonly groups: Map<string, FragmentsGroup>;
825
- /** {@link Component.enabled} */
826
- enabled: boolean;
827
- baseCoordinationModel: string;
828
- private _loader;
829
- /** The list of meshes of the created fragments. */
830
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
831
- constructor(components: Components);
832
- /** {@link Disposable.dispose} */
833
- dispose(): void;
834
- disposeGroup(group: FragmentsGroup): void;
835
- /**
836
- * Loads one or many fragments into the scene.
837
- * @param data - the bytes containing the data for the fragments to load.
838
- * @param coordinate - whether this fragmentsgroup should be federated with the others.
839
- * @returns the list of IDs of the loaded fragments.
840
- */
841
- load(data: Uint8Array, coordinate?: boolean): FragmentsGroup;
842
- /**
843
- * Export the specified fragments.
844
- * @param group - the fragments group to be exported.
845
- * @returns the exported data as binary buffer.
846
- */
847
- export(group: FragmentsGroup): Uint8Array;
848
- coordinate(models?: FragmentsGroup[]): void;
849
- }
850
- import * as FRAGS from "@thatopen/fragments";
851
- export declare class IfcPropertiesUtils {
852
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
853
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
854
- [attribute: string]: any;
855
- } | null>;
856
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
857
- [relatingID: number]: number[];
858
- }>;
859
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
860
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
861
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
862
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
863
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
864
- key: string | null;
865
- name: string | null;
866
- }>;
867
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
868
- key: string | null;
869
- value: number | null;
870
- }>;
871
- static isRel(expressID: number): boolean;
872
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
873
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
874
- }
875
- import * as WEBIFC from "web-ifc";
876
- import * as FRAGS from "@thatopen/fragments";
877
- import { IfcFragmentSettings } from "./src";
878
- import { Component, Components, Event, Disposable } from "../../core";
879
- export declare class FragmentIfcLoader extends Component implements Disposable {
880
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
881
- readonly onIfcStartedLoading: Event<void>;
882
- readonly onSetup: Event<void>;
883
- /** {@link Disposable.onDisposed} */
884
- readonly onDisposed: Event<string>;
885
- settings: IfcFragmentSettings;
789
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
790
+ readonly list: Map<string, Fragment>;
791
+ readonly groups: Map<string, FragmentsGroup>;
792
+ /** {@link Component.enabled} */
886
793
  enabled: boolean;
887
- webIfc: WEBIFC.IfcAPI;
888
- private _material;
889
- private _spatialTree;
890
- private _metaData;
891
- private _fragmentInstances;
892
- private _civil;
893
- private _propertyExporter;
894
- private _visitedFragments;
895
- private _materialT;
794
+ baseCoordinationModel: string;
795
+ private _loader;
796
+ /** The list of meshes of the created fragments. */
797
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
896
798
  constructor(components: Components);
799
+ /** {@link Disposable.dispose} */
897
800
  dispose(): void;
898
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
899
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
900
- readIfcFile(data: Uint8Array): Promise<number>;
901
- private getAllGeometries;
902
- cleanUp(): void;
903
- private getMesh;
904
- private getGeometry;
905
- private autoSetWasm;
801
+ disposeGroup(group: FragmentsGroup): void;
802
+ /**
803
+ * Loads a binar file that contain fragment geometry.
804
+ * @param data - The binary data to load.
805
+ * @param config - Optional configuration for loading.
806
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
807
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
808
+ * @returns The loaded FragmentsGroup.
809
+ */
810
+ load(data: Uint8Array, config?: Partial<{
811
+ coordinate: boolean;
812
+ properties: FRAGS.IfcProperties;
813
+ relationsMap: RelationsMap;
814
+ }>): FragmentsGroup;
815
+ /**
816
+ * Export the specified fragments.
817
+ * @param group - the fragments group to be exported.
818
+ * @returns the exported data as binary buffer.
819
+ */
820
+ export(group: FragmentsGroup): Uint8Array;
821
+ coordinate(models?: FragmentsGroup[]): void;
906
822
  }
907
- export declare const IfcCategoryMap: {
908
- [key: number]: string;
909
- };
910
- export declare const IfcElements: {
911
- [key: number]: string;
912
- };
913
- export declare const GeometryTypes: Set<number>;
914
- import * as WEBIFC from "web-ifc";
915
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
916
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
917
- export declare class IfcPropertiesTiler extends Component implements Disposable {
918
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
919
- onPropertiesStreamed: AsyncEvent<{
920
- type: number;
921
- data: {
922
- [id: number]: any;
923
- };
924
- }>;
925
- onProgress: AsyncEvent<number>;
926
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
927
- /** {@link Disposable.onDisposed} */
928
- readonly onDisposed: Event<string>;
823
+ import { Component, Disposable, Event, Components } from "../../core";
824
+ export declare class Exploder extends Component implements Disposable {
825
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
929
826
  enabled: boolean;
930
- settings: PropertiesStreamingSettings;
931
- webIfc: WEBIFC.IfcAPI;
932
- dispose(): Promise<void>;
933
- streamFromBuffer(data: Uint8Array): Promise<void>;
934
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
935
- private readIfcFile;
936
- private streamIfcFile;
937
- private streamAllProperties;
938
- private cleanUp;
827
+ height: number;
828
+ groupName: string;
829
+ /** {@link Disposable.onDisposed} */
830
+ readonly onDisposed: Event<unknown>;
831
+ list: Set<string>;
832
+ constructor(components: Components);
833
+ dispose(): void;
834
+ set(active: boolean): void;
939
835
  }
940
836
  import * as WEBIFC from "web-ifc";
941
837
  import { Components, Disposable, Event, Component } from "../../core";
@@ -977,8 +873,34 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
977
873
  private streamAssets;
978
874
  private streamGeometries;
979
875
  }
876
+ import * as WEBIFC from "web-ifc";
877
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
878
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
879
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
880
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
881
+ onPropertiesStreamed: AsyncEvent<{
882
+ type: number;
883
+ data: {
884
+ [id: number]: any;
885
+ };
886
+ }>;
887
+ onProgress: AsyncEvent<number>;
888
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
889
+ /** {@link Disposable.onDisposed} */
890
+ readonly onDisposed: Event<string>;
891
+ enabled: boolean;
892
+ settings: PropertiesStreamingSettings;
893
+ webIfc: WEBIFC.IfcAPI;
894
+ dispose(): Promise<void>;
895
+ streamFromBuffer(data: Uint8Array): Promise<void>;
896
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
897
+ private readIfcFile;
898
+ private streamIfcFile;
899
+ private streamAllProperties;
900
+ private cleanUp;
901
+ }
980
902
  import * as THREE from "three";
981
- import { Event, Resizeable, Updateable, Disposable, World } from "../../../core";
903
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
982
904
  export declare class MiniMap implements Resizeable, Updateable, Disposable {
983
905
  /** {@link Disposable.onDisposed} */
984
906
  readonly onDisposed: Event<unknown>;
@@ -1012,201 +934,358 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
1012
934
  private updatePlanes;
1013
935
  }
1014
936
  import * as THREE from "three";
1015
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1016
- import { Components } from "../../Components";
1017
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1018
- /**
1019
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1020
- */
1021
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1022
- readonly onAfterUpdate: Event<unknown>;
1023
- readonly onBeforeUpdate: Event<unknown>;
937
+ import { Component, Components } from "../../core";
938
+ export interface MeasureEdge {
939
+ distance: number;
940
+ points: THREE.Vector3[];
941
+ }
942
+ export declare class MeasurementUtils extends Component {
1024
943
  enabled: boolean;
1025
- uuid: string;
1026
- readonly onDisposed: Event<unknown>;
1027
- private _scene?;
1028
- private _camera?;
1029
- private _renderer;
1030
- get scene(): T;
1031
- set scene(scene: T);
1032
- get camera(): U;
1033
- set camera(camera: U);
1034
- get renderer(): S | null;
1035
- set renderer(renderer: S | null);
944
+ static uuid: string;
1036
945
  constructor(components: Components);
1037
- update(delta?: number): void;
1038
- dispose(disposeResources?: boolean): void;
946
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
947
+ edges: MeasureEdge[];
948
+ indices: Set<number>;
949
+ } | null;
950
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
951
+ private getFaceData;
952
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
953
+ p1: THREE.Vector3;
954
+ p2: THREE.Vector3;
955
+ p3: THREE.Vector3;
956
+ faceNormal: THREE.Vector3;
957
+ };
958
+ private round;
959
+ }
960
+ import * as FRAGS from "@thatopen/fragments";
961
+ export declare class IfcPropertiesUtils {
962
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
963
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
964
+ [attribute: string]: any;
965
+ } | null>;
966
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
967
+ [relatingID: number]: number[];
968
+ }>;
969
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
970
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
971
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
972
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
973
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
974
+ key: string | null;
975
+ name: string | null;
976
+ }>;
977
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
978
+ key: string | null;
979
+ value: number | null;
980
+ }>;
981
+ static isRel(expressID: number): boolean;
982
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
983
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
984
+ }
985
+ export declare const IfcElements: {
986
+ [key: number]: string;
987
+ };
988
+ export declare const GeometryTypes: Set<number>;
989
+ import * as WEBIFC from "web-ifc";
990
+ export interface IfcItemsCategories {
991
+ [itemID: number]: number;
992
+ }
993
+ export declare class IfcCategories {
994
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
995
+ }
996
+ export declare const IfcCategoryMap: {
997
+ [key: number]: string;
998
+ };
999
+ import { InverseAttribute } from "./types";
1000
+ export declare const relToAttributesMap: Map<number, {
1001
+ forRelating: InverseAttribute;
1002
+ forRelated: InverseAttribute;
1003
+ }>;
1004
+ import { NavigationMode } from "./types";
1005
+ import { OrthoPerspectiveCamera } from "../index";
1006
+ /**
1007
+ * A {@link NavigationMode} that allows first person navigation,
1008
+ * simulating FPS video games.
1009
+ */
1010
+ export declare class FirstPersonMode implements NavigationMode {
1011
+ private camera;
1012
+ /** {@link NavigationMode.enabled} */
1013
+ enabled: boolean;
1014
+ /** {@link NavigationMode.id} */
1015
+ readonly id = "FirstPerson";
1016
+ constructor(camera: OrthoPerspectiveCamera);
1017
+ /** {@link NavigationMode.set} */
1018
+ set(active: boolean): void;
1019
+ private setupFirstPersonCamera;
1039
1020
  }
1040
1021
  import * as THREE from "three";
1041
- import { BaseRenderer, Event } from "../../Types";
1042
- import { Components } from "../../Components";
1022
+ import { CameraProjection } from "./types";
1023
+ import { Event } from "../../Types";
1024
+ import { OrthoPerspectiveCamera } from "../index";
1025
+ /**
1026
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1027
+ */
1028
+ export declare class ProjectionManager {
1029
+ /**
1030
+ * Event that fires when the {@link CameraProjection} changes.
1031
+ */
1032
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1033
+ current: CameraProjection;
1034
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1035
+ private _component;
1036
+ private _previousDistance;
1037
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1038
+ matchOrthoDistanceEnabled: boolean;
1039
+ constructor(camera: OrthoPerspectiveCamera);
1040
+ /**
1041
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1042
+ *
1043
+ * @param projection - the new projection to set. If it is the current projection,
1044
+ * it will have no effect.
1045
+ */
1046
+ set(projection: CameraProjection): Promise<void>;
1047
+ /**
1048
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1049
+ * and vice versa.
1050
+ */
1051
+ toggle(): Promise<void>;
1052
+ private setOrthoCamera;
1053
+ private getPerspectiveDims;
1054
+ private setupOrthoCamera;
1055
+ private getDistance;
1056
+ private setPerspectiveCamera;
1057
+ }
1058
+ /**
1059
+ * The projection system of the camera.
1060
+ */
1061
+ export type CameraProjection = "Perspective" | "Orthographic";
1062
+ /**
1063
+ * The extensible list of supported navigation modes.
1064
+ */
1065
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1066
+ /**
1067
+ * An object that determines the behavior of the camera controls
1068
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1069
+ */
1070
+ export interface NavigationMode {
1071
+ /** The unique ID of this navigation mode. */
1072
+ id: NavModeID;
1073
+ /**
1074
+ * Enable or disable this navigation mode.
1075
+ * When a new navigation mode is enabled, the previous navigation mode
1076
+ * must be disabled.
1077
+ *
1078
+ * @param active - whether to enable or disable this mode.
1079
+ * @param options - any additional data required to enable or disable it.
1080
+ * */
1081
+ set: (active: boolean, options?: any) => void;
1082
+ /** Whether this navigation mode is active or not. */
1083
+ enabled: boolean;
1084
+ }
1085
+ import { NavigationMode } from "./types";
1086
+ import { OrthoPerspectiveCamera } from "../index";
1043
1087
  /**
1044
- * A basic renderer capable of rendering
1045
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1088
+ * A {@link NavigationMode} that allows 3D navigation and panning
1089
+ * like in many 3D and CAD softwares.
1046
1090
  */
1047
- export declare class SimpleRenderer extends BaseRenderer {
1091
+ export declare class OrbitMode implements NavigationMode {
1092
+ camera: OrthoPerspectiveCamera;
1093
+ /** {@link NavigationMode.enabled} */
1048
1094
  enabled: boolean;
1049
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1050
- container: HTMLElement;
1051
- three: THREE.WebGLRenderer;
1052
- protected _canvas: HTMLCanvasElement;
1053
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1054
- protected _resizeObserver: ResizeObserver | null;
1055
- protected onContainerUpdated: Event<HTMLElement>;
1056
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1057
- /** {@link Updateable.update} */
1058
- update(): void;
1059
- /** {@link Disposable.dispose} */
1060
- dispose(): void;
1061
- /** {@link Resizeable.getSize}. */
1062
- getSize(): THREE.Vector2;
1063
- /** {@link Resizeable.resize} */
1064
- resize: (size?: THREE.Vector2) => void;
1065
- setupEvents(active: boolean): void;
1066
- private resizeEvent;
1067
- private setupRenderer;
1068
- private onContextLost;
1069
- private onContextBack;
1070
- }
1071
- export declare const getRelationMap: (properties: Record<string, Record<string, any>>, relationType: number, onElementsFound?: ((relatingID: number, relatedIDs: number[]) => void) | undefined) => {
1072
- [relatingID: number]: number[];
1073
- };
1074
- import * as THREE from "three";
1075
- import { BaseScene, Configurable, Event } from "../../Types";
1076
- import { Components } from "../../Components";
1077
- export interface SimpleSceneConfig {
1078
- directionalLight: {
1079
- color: THREE.Color;
1080
- intensity: number;
1081
- position: THREE.Vector3;
1082
- };
1083
- ambientLight: {
1084
- color: THREE.Color;
1085
- intensity: number;
1086
- };
1095
+ /** {@link NavigationMode.id} */
1096
+ readonly id = "Orbit";
1097
+ constructor(camera: OrthoPerspectiveCamera);
1098
+ /** {@link NavigationMode.set} */
1099
+ set(active: boolean): void;
1100
+ private activateOrbitControls;
1087
1101
  }
1102
+ import { NavigationMode } from "./types";
1103
+ import { OrthoPerspectiveCamera } from "../index";
1088
1104
  /**
1089
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1090
- * objects hierarchically, and easily dispose them when you are finished with it.
1091
- * @noInheritDoc
1105
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1106
+ * like many BIM tools.
1092
1107
  */
1093
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1094
- /** {@link Configurable.isSetup} */
1095
- isSetup: boolean;
1096
- three: THREE.Scene;
1097
- /** {@link Configurable.onSetup} */
1098
- readonly onSetup: Event<SimpleScene>;
1099
- config: Required<SimpleSceneConfig>;
1100
- constructor(components: Components);
1101
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1102
- setup(config?: Partial<SimpleSceneConfig>): void;
1103
- }
1104
- import * as WEBIFC from "web-ifc";
1105
- import { IfcItemsCategories } from "../../../ifc";
1106
- export declare class SpatialStructure {
1107
- itemsByFloor: IfcItemsCategories;
1108
- private _units;
1109
- setUp(webIfc: WEBIFC.IfcAPI): void;
1110
- cleanUp(): void;
1108
+ export declare class PlanMode implements NavigationMode {
1109
+ private camera;
1110
+ /** {@link NavigationMode.enabled} */
1111
+ enabled: boolean;
1112
+ /** {@link NavigationMode.id} */
1113
+ readonly id = "Plan";
1114
+ private mouseAction1?;
1115
+ private mouseAction2?;
1116
+ private mouseInitialized;
1117
+ private readonly defaultAzimuthSpeed;
1118
+ private readonly defaultPolarSpeed;
1119
+ constructor(camera: OrthoPerspectiveCamera);
1120
+ /** {@link NavigationMode.set} */
1121
+ set(active: boolean): void;
1111
1122
  }
1112
1123
  import * as THREE from "three";
1113
- import CameraControls from "camera-controls";
1114
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1115
1124
  import { Components } from "../../Components";
1125
+ import { AsyncEvent, Event, World } from "../../Types";
1126
+ export interface CullerRendererSettings {
1127
+ updateInterval?: number;
1128
+ width?: number;
1129
+ height?: number;
1130
+ autoUpdate?: boolean;
1131
+ }
1116
1132
  /**
1117
- * A basic camera that uses
1118
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1119
- * easily control the camera in 2D and 3D. Check out it's API to find out
1120
- * what features it offers.
1133
+ * A base renderer to determine visibility on screen
1121
1134
  */
1122
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1123
- /** {@link Updateable.onBeforeUpdate} */
1124
- readonly onBeforeUpdate: Event<SimpleCamera>;
1125
- /** {@link Updateable.onAfterUpdate} */
1126
- readonly onAfterUpdate: Event<SimpleCamera>;
1127
- readonly onAspectUpdated: Event<unknown>;
1135
+ export declare class CullerRenderer {
1128
1136
  /** {@link Disposable.onDisposed} */
1129
1137
  readonly onDisposed: Event<string>;
1130
- readonly three: THREE.PerspectiveCamera;
1131
- private _allControls;
1132
1138
  /**
1133
- * The object that controls the camera. An instance of
1134
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1135
- * Transforming the camera directly will have no effect: you need to use this
1136
- * object to move, rotate, look at objects, etc.
1139
+ * Fires after making the visibility check to the meshes. It lists the
1140
+ * meshes that are currently visible, and the ones that were visible
1141
+ * just before but not anymore.
1137
1142
  */
1138
- get controls(): CameraControls;
1139
- /** {@link Component.enabled} */
1140
- get enabled(): boolean;
1143
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1141
1144
  /** {@link Component.enabled} */
1142
- set enabled(enabled: boolean);
1143
- constructor(components: Components);
1145
+ enabled: boolean;
1146
+ /**
1147
+ * Needs to check whether there are objects that need to be hidden or shown.
1148
+ * You can bind this to the camera movement, to a certain interval, etc.
1149
+ */
1150
+ needsUpdate: boolean;
1151
+ /**
1152
+ * Render the internal scene used to determine the object visibility. Used
1153
+ * for debugging purposes.
1154
+ */
1155
+ renderDebugFrame: boolean;
1156
+ components: Components;
1157
+ readonly world: World;
1158
+ readonly renderer: THREE.WebGLRenderer;
1159
+ protected autoUpdate: boolean;
1160
+ protected updateInterval: number;
1161
+ protected readonly worker: Worker;
1162
+ protected readonly scene: THREE.Scene;
1163
+ private _width;
1164
+ private _height;
1165
+ private _availableColor;
1166
+ private readonly renderTarget;
1167
+ private readonly bufferSize;
1168
+ private readonly _buffer;
1169
+ protected _isWorkerBusy: boolean;
1170
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1144
1171
  /** {@link Disposable.dispose} */
1145
1172
  dispose(): void;
1146
- /** {@link Updateable.update} */
1147
- update(_delta: number): void;
1148
1173
  /**
1149
- * Updates the aspect of the camera to match the size of the
1150
- * {@link Components.renderer}.
1174
+ * The function that the culler uses to reprocess the scene. Generally it's
1175
+ * better to call needsUpdate, but you can also call this to force it.
1176
+ * @param force if true, it will refresh the scene even if needsUpdate is
1177
+ * not true.
1151
1178
  */
1152
- updateAspect: () => void;
1153
- private setupCamera;
1154
- private newCameraControls;
1155
- private setupEvents;
1156
- private static getSubsetOfThree;
1179
+ updateVisibility: (force?: boolean) => Promise<void>;
1180
+ protected getAvailableColor(): {
1181
+ r: number;
1182
+ g: number;
1183
+ b: number;
1184
+ code: string;
1185
+ };
1186
+ protected increaseColor(): void;
1187
+ protected decreaseColor(): void;
1188
+ private applySettings;
1157
1189
  }
1158
- /// <reference types="node" />
1159
1190
  import * as THREE from "three";
1160
- import { Hideable, Event, World } from "../../Types";
1161
1191
  import { Components } from "../../Components";
1162
- export interface GridConfig {
1163
- color: THREE.Color;
1164
- size1: number;
1165
- size2: number;
1166
- distance: number;
1167
- }
1192
+ import { Event, World, Disposable } from "../../Types";
1193
+ import { Mouse } from "./mouse";
1168
1194
  /**
1169
- * An infinite grid. Created by
1170
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1171
- * and translated to typescript by
1172
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1195
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1196
+ * that allows to easily get items from the scene using the mouse and touch
1197
+ * events.
1173
1198
  */
1174
- export declare class SimpleGrid implements Hideable, Disposable {
1199
+ export declare class SimpleRaycaster implements Disposable {
1200
+ /** {@link Component.enabled} */
1201
+ enabled: boolean;
1202
+ components: Components;
1175
1203
  /** {@link Disposable.onDisposed} */
1176
1204
  readonly onDisposed: Event<unknown>;
1205
+ /** The position of the mouse in the screen. */
1206
+ readonly mouse: Mouse;
1207
+ readonly three: THREE.Raycaster;
1177
1208
  world: World;
1178
- components: Components;
1179
- /** {@link Hideable.visible} */
1180
- get visible(): boolean;
1181
- /** {@link Hideable.visible} */
1182
- set visible(visible: boolean);
1183
- /** The material of the grid. */
1184
- get material(): THREE.ShaderMaterial;
1209
+ constructor(components: Components, world: World);
1210
+ /** {@link Disposable.dispose} */
1211
+ dispose(): void;
1185
1212
  /**
1186
- * Whether the grid should fade away with distance. Recommended to be true for
1187
- * perspective cameras and false for orthographic cameras.
1213
+ * Throws a ray from the camera to the mouse or touch event point and returns
1214
+ * the first item found. This also takes into account the clipping planes
1215
+ * used by the renderer.
1216
+ *
1217
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1218
+ * to query. If not provided, it will query all the meshes stored in
1219
+ * {@link Components.meshes}.
1188
1220
  */
1189
- get fade(): boolean;
1221
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1222
+ 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;
1223
+ private intersect;
1224
+ private filterClippingPlanes;
1225
+ }
1226
+ import * as THREE from "three";
1227
+ import { Disposable, Event } from "../../Types";
1228
+ /**
1229
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1230
+ * to work with tools like the
1231
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1232
+ * been transformed through CSS or doesn't occupy the whole screen.
1233
+ */
1234
+ export declare class Mouse implements Disposable {
1235
+ dom: HTMLCanvasElement;
1236
+ private _event?;
1237
+ private _position;
1238
+ /** {@link Disposable.onDisposed} */
1239
+ readonly onDisposed: Event<unknown>;
1240
+ constructor(dom: HTMLCanvasElement);
1190
1241
  /**
1191
- * Whether the grid should fade away with distance. Recommended to be true for
1192
- * perspective cameras and false for orthographic cameras.
1242
+ * The real position of the mouse of the Three.js canvas.
1193
1243
  */
1194
- set fade(active: boolean);
1195
- private readonly _grid;
1196
- private _fade;
1197
- constructor(components: Components, world: World, config: GridConfig);
1198
- [Symbol.dispose](): void;
1199
- /** {@link Component.get} */
1200
- get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1244
+ get position(): THREE.Vector2;
1201
1245
  /** {@link Disposable.dispose} */
1202
1246
  dispose(): void;
1203
- private setupEvents;
1204
- private updateZoom;
1247
+ private getPositionY;
1248
+ private getPositionX;
1249
+ private updateMouseInfo;
1250
+ private setupEvents;
1251
+ }
1252
+ import * as THREE from "three";
1253
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1254
+ import { Components } from "../../Components";
1255
+ import { Event, World } from "../../Types";
1256
+ /**
1257
+ * A renderer to determine a mesh visibility on screen
1258
+ */
1259
+ export declare class MeshCullerRenderer extends CullerRenderer {
1260
+ threshold: number;
1261
+ readonly onViewUpdated: Event<{
1262
+ seen: Set<THREE.Mesh>;
1263
+ unseen: Set<THREE.Mesh>;
1264
+ }>;
1265
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1266
+ isProcessing: boolean;
1267
+ private _colorCodeMeshMap;
1268
+ private _meshIDColorCodeMap;
1269
+ private _currentVisibleMeshes;
1270
+ private _recentlyHiddenMeshes;
1271
+ private _intervalID;
1272
+ private readonly _transparentMat;
1273
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1274
+ dispose(): void;
1275
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1276
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1277
+ private handleWorkerMessage;
1278
+ private getAvailableMaterial;
1205
1279
  }
1206
- export declare const relToAttributesMap: Map<number, {
1207
- forRelating?: "IsDecomposedBy" | "Decomposes" | "AssociatedTo" | "HasAssociations" | "ClassificationForObjects" | "IsGroupedBy" | "HasAssignments" | "IsDefinedBy" | "DefinesOcurrence" | "IsTypedBy" | "Types" | "Defines" | "ContainedInStructure" | "ContainsElements" | undefined;
1208
- forRelated?: "IsDecomposedBy" | "Decomposes" | "AssociatedTo" | "HasAssociations" | "ClassificationForObjects" | "IsGroupedBy" | "HasAssignments" | "IsDefinedBy" | "DefinesOcurrence" | "IsTypedBy" | "Types" | "Defines" | "ContainedInStructure" | "ContainsElements" | undefined;
1209
- }>;
1280
+ import * as WEBIFC from "web-ifc";
1281
+ import { IfcItemsCategories } from "../../../ifc";
1282
+ export declare class SpatialStructure {
1283
+ itemsByFloor: IfcItemsCategories;
1284
+ private _units;
1285
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1286
+ cleanUp(): void;
1287
+ }
1288
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1210
1289
  /**
1211
1290
  * Simple event handler by
1212
1291
  * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
@@ -1241,40 +1320,6 @@ export declare class Event<T> {
1241
1320
  reset(): void;
1242
1321
  private handlers;
1243
1322
  }
1244
- /**
1245
- * Simple event handler by
1246
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1247
- * Keep in mind that:
1248
- * - If you want to remove it later, you might want to declare the callback as
1249
- * an object.
1250
- * - If you want to maintain the reference to 'this', you will need to declare
1251
- * the callback as an arrow function.
1252
- */
1253
- export declare class AsyncEvent<T> {
1254
- /**
1255
- * Add a callback to this event instance.
1256
- * @param handler - the callback to be added to this event.
1257
- */
1258
- add(handler: T extends void ? {
1259
- (): Promise<void>;
1260
- } : {
1261
- (data: T): Promise<void>;
1262
- }): void;
1263
- /**
1264
- * Removes a callback from this event instance.
1265
- * @param handler - the callback to be removed from this event.
1266
- */
1267
- remove(handler: T extends void ? {
1268
- (): Promise<void>;
1269
- } : {
1270
- (data: T): Promise<void>;
1271
- }): void;
1272
- /** Triggers all the callbacks assigned to this event. */
1273
- trigger: (data?: T) => Promise<void>;
1274
- /** Gets rid of all the suscribed events. */
1275
- reset(): void;
1276
- private handlers;
1277
- }
1278
1323
  import * as THREE from "three";
1279
1324
  import CameraControls from "camera-controls";
1280
1325
  import { Event } from "./event";
@@ -1399,6 +1444,23 @@ export interface CameraControllable {
1399
1444
  controls: CameraControls;
1400
1445
  }
1401
1446
  import { Base } from "./base";
1447
+ import { World } from "./world";
1448
+ import { Event } from "./event";
1449
+ import { Components } from "../../Components";
1450
+ /**
1451
+ * One of the elements that make a world. It can be either a scene, a camera
1452
+ * or a renderer.
1453
+ */
1454
+ export declare abstract class BaseWorldItem extends Base {
1455
+ readonly worlds: Map<string, World>;
1456
+ readonly onWorldChanged: Event<{
1457
+ world: World;
1458
+ action: "added" | "removed";
1459
+ }>;
1460
+ currentWorld: World | null;
1461
+ protected constructor(components: Components);
1462
+ }
1463
+ import { Base } from "./base";
1402
1464
  /**
1403
1465
  * Components are the building blocks of this library. Components are singleton
1404
1466
  * elements that contain specific functionality. For instance, the SimpleClipper
@@ -1416,22 +1478,175 @@ export declare abstract class Component extends Base {
1416
1478
  */
1417
1479
  abstract enabled: boolean;
1418
1480
  }
1419
- import { Base } from "./base";
1420
- import { World } from "./world";
1481
+ import * as THREE from "three";
1482
+ import CameraControls from "camera-controls";
1483
+ import { BaseWorldItem } from "./base-world-item";
1484
+ import { CameraControllable } from "./interfaces";
1485
+ export declare abstract class BaseCamera extends BaseWorldItem {
1486
+ abstract enabled: boolean;
1487
+ abstract three: THREE.Camera;
1488
+ abstract controls?: CameraControls;
1489
+ /** Whether is instance is {@link CameraControllable}. */
1490
+ hasCameraControls: () => this is CameraControllable;
1491
+ }
1492
+ import * as THREE from "three";
1493
+ import { Disposable } from "./interfaces";
1494
+ import { Event } from "./event";
1495
+ import { Components } from "../../Components";
1496
+ import { BaseWorldItem } from "./base-world-item";
1497
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1498
+ /** {@link Disposable.onDisposed} */
1499
+ readonly onDisposed: Event<unknown>;
1500
+ abstract three: THREE.Object3D;
1501
+ protected constructor(components: Components);
1502
+ /** {@link Disposable.dispose} */
1503
+ dispose(): void;
1504
+ }
1505
+ import * as THREE from "three";
1506
+ import { Vector2 } from "three";
1421
1507
  import { Event } from "./event";
1508
+ import { BaseWorldItem } from "./base-world-item";
1509
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
1510
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1511
+ abstract three: THREE.WebGLRenderer;
1512
+ /** {@link Updateable.onBeforeUpdate} */
1513
+ onAfterUpdate: Event<unknown>;
1514
+ /** {@link Updateable.onAfterUpdate} */
1515
+ onBeforeUpdate: Event<unknown>;
1516
+ /** {@link Disposable.onDisposed} */
1517
+ readonly onDisposed: Event<undefined>;
1518
+ readonly onResize: Event<THREE.Vector2>;
1519
+ /**
1520
+ * Event that fires when there has been a change to the list of clipping
1521
+ * planes used by the active renderer.
1522
+ */
1523
+ readonly onClippingPlanesUpdated: Event<unknown>;
1524
+ abstract update(delta?: number): void | Promise<void>;
1525
+ abstract dispose(): void;
1526
+ abstract getSize(): Vector2;
1527
+ abstract resize(size: Vector2 | undefined): void;
1528
+ /**
1529
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1530
+ * instance of the renderer.
1531
+ */
1532
+ clippingPlanes: THREE.Plane[];
1533
+ /**
1534
+ * Forces the update of the clipping planes and all components that depend
1535
+ * on them that are subscribed to 'onClippingPlanesUpdated'.
1536
+ */
1537
+ updateClippingPlanes(): void;
1538
+ /**
1539
+ * Adds or removes a
1540
+ * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1541
+ * to the renderer.
1542
+ */
1543
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1544
+ }
1545
+ import * as THREE from "three";
1546
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1422
1547
  import { Components } from "../../Components";
1548
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1549
+ /**
1550
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1551
+ */
1552
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1553
+ readonly onAfterUpdate: Event<unknown>;
1554
+ readonly onBeforeUpdate: Event<unknown>;
1555
+ enabled: boolean;
1556
+ uuid: string;
1557
+ readonly onDisposed: Event<unknown>;
1558
+ private _scene?;
1559
+ private _camera?;
1560
+ private _renderer;
1561
+ get scene(): T;
1562
+ set scene(scene: T);
1563
+ get camera(): U;
1564
+ set camera(camera: U);
1565
+ get renderer(): S | null;
1566
+ set renderer(renderer: S | null);
1567
+ constructor(components: Components);
1568
+ update(delta?: number): void;
1569
+ dispose(disposeResources?: boolean): void;
1570
+ }
1423
1571
  /**
1424
- * One of the elements that make a world. It can be either a scene, a camera
1425
- * or a renderer.
1572
+ * Simple event handler by
1573
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1574
+ * Keep in mind that:
1575
+ * - If you want to remove it later, you might want to declare the callback as
1576
+ * an object.
1577
+ * - If you want to maintain the reference to 'this', you will need to declare
1578
+ * the callback as an arrow function.
1426
1579
  */
1427
- export declare abstract class BaseWorldItem extends Base {
1428
- readonly worlds: Map<string, World>;
1429
- readonly onWorldChanged: Event<{
1430
- world: World;
1431
- action: "added" | "removed";
1432
- }>;
1433
- currentWorld: World | null;
1434
- protected constructor(components: Components);
1580
+ export declare class AsyncEvent<T> {
1581
+ /**
1582
+ * Add a callback to this event instance.
1583
+ * @param handler - the callback to be added to this event.
1584
+ */
1585
+ add(handler: T extends void ? {
1586
+ (): Promise<void>;
1587
+ } : {
1588
+ (data: T): Promise<void>;
1589
+ }): void;
1590
+ /**
1591
+ * Removes a callback from this event instance.
1592
+ * @param handler - the callback to be removed from this event.
1593
+ */
1594
+ remove(handler: T extends void ? {
1595
+ (): Promise<void>;
1596
+ } : {
1597
+ (data: T): Promise<void>;
1598
+ }): void;
1599
+ /** Triggers all the callbacks assigned to this event. */
1600
+ trigger: (data?: T) => Promise<void>;
1601
+ /** Gets rid of all the suscribed events. */
1602
+ reset(): void;
1603
+ private handlers;
1604
+ }
1605
+ /// <reference types="node" />
1606
+ import * as THREE from "three";
1607
+ import { Hideable, Event, World } from "../../Types";
1608
+ import { Components } from "../../Components";
1609
+ export interface GridConfig {
1610
+ color: THREE.Color;
1611
+ size1: number;
1612
+ size2: number;
1613
+ distance: number;
1614
+ }
1615
+ /**
1616
+ * An infinite grid. Created by
1617
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1618
+ * and translated to typescript by
1619
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1620
+ */
1621
+ export declare class SimpleGrid implements Hideable, Disposable {
1622
+ /** {@link Disposable.onDisposed} */
1623
+ readonly onDisposed: Event<unknown>;
1624
+ world: World;
1625
+ components: Components;
1626
+ /** {@link Hideable.visible} */
1627
+ get visible(): boolean;
1628
+ /** {@link Hideable.visible} */
1629
+ set visible(visible: boolean);
1630
+ /** The material of the grid. */
1631
+ get material(): THREE.ShaderMaterial;
1632
+ /**
1633
+ * Whether the grid should fade away with distance. Recommended to be true for
1634
+ * perspective cameras and false for orthographic cameras.
1635
+ */
1636
+ get fade(): boolean;
1637
+ /**
1638
+ * Whether the grid should fade away with distance. Recommended to be true for
1639
+ * perspective cameras and false for orthographic cameras.
1640
+ */
1641
+ set fade(active: boolean);
1642
+ readonly three: THREE.Mesh;
1643
+ private _fade;
1644
+ constructor(components: Components, world: World, config: GridConfig);
1645
+ [Symbol.dispose](): void;
1646
+ /** {@link Disposable.dispose} */
1647
+ dispose(): void;
1648
+ private setupEvents;
1649
+ private updateZoom;
1435
1650
  }
1436
1651
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1437
1652
  import { Components } from "../../Components";
@@ -1453,94 +1668,34 @@ export declare abstract class Base {
1453
1668
  isConfigurable: () => this is Configurable<any>;
1454
1669
  }
1455
1670
  import * as THREE from "three";
1456
- import CameraControls from "camera-controls";
1457
- import { BaseWorldItem } from "./base-world-item";
1458
- import { CameraControllable } from "./interfaces";
1459
- export declare abstract class BaseCamera extends BaseWorldItem {
1460
- abstract enabled: boolean;
1461
- abstract three: THREE.Camera;
1462
- abstract controls?: CameraControls;
1463
- /** Whether is instance is {@link CameraControllable}. */
1464
- hasCameraControls: () => this is CameraControllable;
1465
- }
1466
- import * as THREE from "three";
1467
- import { Vector2 } from "three";
1468
- import { Event } from "./event";
1469
- import { BaseWorldItem } from "./base-world-item";
1470
- import { Disposable, Resizeable, Updateable } from "./interfaces";
1471
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1472
- abstract three: THREE.WebGLRenderer;
1473
- /** {@link Updateable.onBeforeUpdate} */
1474
- onAfterUpdate: Event<unknown>;
1475
- /** {@link Updateable.onAfterUpdate} */
1476
- onBeforeUpdate: Event<unknown>;
1477
- /** {@link Disposable.onDisposed} */
1478
- readonly onDisposed: Event<undefined>;
1479
- readonly onResize: Event<THREE.Vector2>;
1480
- /**
1481
- * Event that fires when there has been a change to the list of clipping
1482
- * planes used by the active renderer.
1483
- */
1484
- readonly onClippingPlanesUpdated: Event<unknown>;
1485
- abstract update(delta?: number): void | Promise<void>;
1486
- abstract dispose(): void;
1487
- abstract getSize(): Vector2;
1488
- abstract resize(size: Vector2 | undefined): void;
1489
- /**
1490
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1491
- * instance of the renderer.
1492
- */
1493
- clippingPlanes: THREE.Plane[];
1494
- /**
1495
- * Forces the update of the clipping planes and all components that depend
1496
- * on them that are subscribed to 'onClippingPlanesUpdated'.
1497
- */
1498
- updateClippingPlanes(): void;
1499
- /**
1500
- * Adds or removes a
1501
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1502
- * to the renderer.
1503
- */
1504
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1505
- }
1506
- import * as THREE from "three";
1507
- import { Disposable } from "./interfaces";
1508
- import { Event } from "./event";
1671
+ import { BaseScene, Configurable, Event } from "../../Types";
1509
1672
  import { Components } from "../../Components";
1510
- import { BaseWorldItem } from "./base-world-item";
1511
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1512
- /** {@link Disposable.onDisposed} */
1513
- readonly onDisposed: Event<unknown>;
1514
- abstract three: THREE.Object3D;
1515
- protected constructor(components: Components);
1516
- /** {@link Disposable.dispose} */
1517
- dispose(): void;
1673
+ export interface SimpleSceneConfig {
1674
+ directionalLight: {
1675
+ color: THREE.Color;
1676
+ intensity: number;
1677
+ position: THREE.Vector3;
1678
+ };
1679
+ ambientLight: {
1680
+ color: THREE.Color;
1681
+ intensity: number;
1682
+ };
1518
1683
  }
1519
- import * as THREE from "three";
1520
- import { Disposable, Event } from "../../Types";
1521
1684
  /**
1522
- * A helper to easily get the real position of the mouse in the Three.js canvas
1523
- * to work with tools like the
1524
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1525
- * been transformed through CSS or doesn't occupy the whole screen.
1685
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1686
+ * objects hierarchically, and easily dispose them when you are finished with it.
1687
+ * @noInheritDoc
1526
1688
  */
1527
- export declare class Mouse implements Disposable {
1528
- dom: HTMLCanvasElement;
1529
- private _event?;
1530
- private _position;
1531
- /** {@link Disposable.onDisposed} */
1532
- readonly onDisposed: Event<unknown>;
1533
- constructor(dom: HTMLCanvasElement);
1534
- /**
1535
- * The real position of the mouse of the Three.js canvas.
1536
- */
1537
- get position(): THREE.Vector2;
1538
- /** {@link Disposable.dispose} */
1539
- dispose(): void;
1540
- private getPositionY;
1541
- private getPositionX;
1542
- private updateMouseInfo;
1543
- private setupEvents;
1689
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1690
+ /** {@link Configurable.isSetup} */
1691
+ isSetup: boolean;
1692
+ three: THREE.Scene;
1693
+ /** {@link Configurable.onSetup} */
1694
+ readonly onSetup: Event<SimpleScene>;
1695
+ config: Required<SimpleSceneConfig>;
1696
+ constructor(components: Components);
1697
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1698
+ setup(config?: Partial<SimpleSceneConfig>): void;
1544
1699
  }
1545
1700
  import * as THREE from "three";
1546
1701
  import { BaseScene } from "./base-scene";
@@ -1554,254 +1709,84 @@ export interface World extends Disposable, Updateable {
1554
1709
  renderer: BaseRenderer | null;
1555
1710
  uuid: string;
1556
1711
  }
1557
- import { NavigationMode } from "./types";
1558
- /**
1559
- * A {@link NavigationMode} that allows first person navigation,
1560
- * simulating FPS video games.
1561
- */
1562
- export declare class FirstPersonMode implements NavigationMode {
1563
- private camera;
1564
- /** {@link NavigationMode.enabled} */
1565
- enabled: boolean;
1566
- /** {@link NavigationMode.id} */
1567
- readonly id = "FirstPerson";
1568
- constructor(camera: any);
1569
- /** {@link NavigationMode.set} */
1570
- set(active: boolean): void;
1571
- private setupFirstPersonCamera;
1572
- }
1573
1712
  import * as THREE from "three";
1713
+ import { BaseRenderer, Event } from "../../Types";
1574
1714
  import { Components } from "../../Components";
1575
- import { Event, World, Disposable } from "../../Types";
1576
- import { Mouse } from "./mouse";
1577
- /**
1578
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1579
- * that allows to easily get items from the scene using the mouse and touch
1580
- * events.
1581
- */
1582
- export declare class SimpleRaycaster implements Disposable {
1583
- /** {@link Component.enabled} */
1584
- enabled: boolean;
1585
- components: Components;
1586
- /** {@link Disposable.onDisposed} */
1587
- readonly onDisposed: Event<unknown>;
1588
- /** The position of the mouse in the screen. */
1589
- readonly mouse: Mouse;
1590
- readonly three: THREE.Raycaster;
1591
- world: World;
1592
- constructor(components: Components, world: World);
1593
- /** {@link Disposable.dispose} */
1594
- dispose(): void;
1595
- /**
1596
- * Throws a ray from the camera to the mouse or touch event point and returns
1597
- * the first item found. This also takes into account the clipping planes
1598
- * used by the renderer.
1599
- *
1600
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1601
- * to query. If not provided, it will query all the meshes stored in
1602
- * {@link Components.meshes}.
1603
- */
1604
- castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
1605
- 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;
1606
- private intersect;
1607
- private filterClippingPlanes;
1608
- }
1609
- import { NavigationMode } from "./types";
1610
- /**
1611
- * A {@link NavigationMode} that allows 3D navigation and panning
1612
- * like in many 3D and CAD softwares.
1613
- */
1614
- export declare class OrbitMode implements NavigationMode {
1615
- camera: any;
1616
- /** {@link NavigationMode.enabled} */
1617
- enabled: boolean;
1618
- /** {@link NavigationMode.id} */
1619
- readonly id = "Orbit";
1620
- constructor(camera: any);
1621
- /** {@link NavigationMode.set} */
1622
- set(active: boolean): void;
1623
- private activateOrbitControls;
1624
- }
1625
- import { NavigationMode } from "./types";
1626
- /**
1627
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1628
- * like many BIM tools.
1629
- */
1630
- export declare class PlanMode implements NavigationMode {
1631
- private camera;
1632
- /** {@link NavigationMode.enabled} */
1633
- enabled: boolean;
1634
- /** {@link NavigationMode.id} */
1635
- readonly id = "Plan";
1636
- private mouseAction1?;
1637
- private mouseAction2?;
1638
- private mouseInitialized;
1639
- private readonly defaultAzimuthSpeed;
1640
- private readonly defaultPolarSpeed;
1641
- constructor(camera: any);
1642
- /** {@link NavigationMode.set} */
1643
- set(active: boolean): void;
1644
- }
1645
- import * as THREE from "three";
1646
- import { CameraProjection } from "./types";
1647
- import { Event } from "../../../core";
1648
- import { OrthoPerspectiveCamera } from "../index";
1649
- /**
1650
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1651
- */
1652
- export declare class ProjectionManager {
1653
- /**
1654
- * Event that fires when the {@link CameraProjection} changes.
1655
- */
1656
- readonly onChanged: Event<THREE.Camera>;
1657
- current: CameraProjection;
1658
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1659
- private _component;
1660
- private _previousDistance;
1661
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1662
- matchOrthoDistanceEnabled: boolean;
1663
- constructor(camera: OrthoPerspectiveCamera);
1664
- /**
1665
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1666
- *
1667
- * @param projection - the new projection to set. If it is the current projection,
1668
- * it will have no effect.
1669
- */
1670
- set(projection: CameraProjection): Promise<void>;
1671
- /**
1672
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1673
- * and vice versa.
1674
- */
1675
- toggle(): Promise<void>;
1676
- private setOrthoCamera;
1677
- private getDims;
1678
- private setupOrthoCamera;
1679
- private getDistance;
1680
- private setPerspectiveCamera;
1681
- }
1682
- /**
1683
- * The projection system of the camera.
1684
- */
1685
- export type CameraProjection = "Perspective" | "Orthographic";
1686
- /**
1687
- * The extensible list of supported navigation modes.
1688
- */
1689
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1690
- /**
1691
- * An object that determines the behavior of the camera controls
1692
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1693
- */
1694
- export interface NavigationMode {
1695
- /** The unique ID of this navigation mode. */
1696
- id: NavModeID;
1697
- /**
1698
- * Enable or disable this navigation mode.
1699
- * When a new navigation mode is enabled, the previous navigation mode
1700
- * must be disabled.
1701
- *
1702
- * @param active - whether to enable or disable this mode.
1703
- * @param options - any additional data required to enable or disable it.
1704
- * */
1705
- set: (active: boolean, options?: any) => void;
1706
- /** Whether this navigation mode is active or not. */
1715
+ /**
1716
+ * A basic renderer capable of rendering
1717
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1718
+ */
1719
+ export declare class SimpleRenderer extends BaseRenderer {
1707
1720
  enabled: boolean;
1721
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1722
+ container: HTMLElement;
1723
+ three: THREE.WebGLRenderer;
1724
+ protected _canvas: HTMLCanvasElement;
1725
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1726
+ protected _resizeObserver: ResizeObserver | null;
1727
+ protected onContainerUpdated: Event<unknown>;
1728
+ private _resizing;
1729
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1730
+ /** {@link Updateable.update} */
1731
+ update(): void;
1732
+ /** {@link Disposable.dispose} */
1733
+ dispose(): void;
1734
+ /** {@link Resizeable.getSize}. */
1735
+ getSize(): THREE.Vector2;
1736
+ /** {@link Resizeable.resize} */
1737
+ resize: (size?: THREE.Vector2) => void;
1738
+ setupEvents(active: boolean): void;
1739
+ private resizeEvent;
1740
+ private setupRenderer;
1741
+ private onContextLost;
1742
+ private onContextBack;
1708
1743
  }
1709
1744
  import * as THREE from "three";
1745
+ import CameraControls from "camera-controls";
1746
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1710
1747
  import { Components } from "../../Components";
1711
- import { AsyncEvent, Event, World } from "../../Types";
1712
- export interface CullerRendererSettings {
1713
- updateInterval?: number;
1714
- width?: number;
1715
- height?: number;
1716
- autoUpdate?: boolean;
1717
- }
1718
1748
  /**
1719
- * A base renderer to determine visibility on screen
1749
+ * A basic camera that uses
1750
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1751
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1752
+ * what features it offers.
1720
1753
  */
1721
- export declare class CullerRenderer {
1754
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1755
+ /** {@link Updateable.onBeforeUpdate} */
1756
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1757
+ /** {@link Updateable.onAfterUpdate} */
1758
+ readonly onAfterUpdate: Event<SimpleCamera>;
1759
+ readonly onAspectUpdated: Event<unknown>;
1722
1760
  /** {@link Disposable.onDisposed} */
1723
1761
  readonly onDisposed: Event<string>;
1762
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1763
+ private _allControls;
1724
1764
  /**
1725
- * Fires after making the visibility check to the meshes. It lists the
1726
- * meshes that are currently visible, and the ones that were visible
1727
- * just before but not anymore.
1765
+ * The object that controls the camera. An instance of
1766
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1767
+ * Transforming the camera directly will have no effect: you need to use this
1768
+ * object to move, rotate, look at objects, etc.
1728
1769
  */
1729
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1770
+ get controls(): CameraControls;
1730
1771
  /** {@link Component.enabled} */
1731
- enabled: boolean;
1732
- /**
1733
- * Needs to check whether there are objects that need to be hidden or shown.
1734
- * You can bind this to the camera movement, to a certain interval, etc.
1735
- */
1736
- needsUpdate: boolean;
1737
- /**
1738
- * Render the internal scene used to determine the object visibility. Used
1739
- * for debugging purposes.
1740
- */
1741
- renderDebugFrame: boolean;
1742
- components: Components;
1743
- readonly world: World;
1744
- readonly renderer: THREE.WebGLRenderer;
1745
- protected autoUpdate: boolean;
1746
- protected updateInterval: number;
1747
- protected readonly worker: Worker;
1748
- protected readonly scene: THREE.Scene;
1749
- private _width;
1750
- private _height;
1751
- private _availableColor;
1752
- private readonly renderTarget;
1753
- private readonly bufferSize;
1754
- private readonly _buffer;
1755
- protected _isWorkerBusy: boolean;
1756
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1772
+ get enabled(): boolean;
1773
+ /** {@link Component.enabled} */
1774
+ set enabled(enabled: boolean);
1775
+ constructor(components: Components);
1757
1776
  /** {@link Disposable.dispose} */
1758
1777
  dispose(): void;
1778
+ /** {@link Updateable.update} */
1779
+ update(_delta: number): void;
1759
1780
  /**
1760
- * The function that the culler uses to reprocess the scene. Generally it's
1761
- * better to call needsUpdate, but you can also call this to force it.
1762
- * @param force if true, it will refresh the scene even if needsUpdate is
1763
- * not true.
1781
+ * Updates the aspect of the camera to match the size of the
1782
+ * {@link Components.renderer}.
1764
1783
  */
1765
- updateVisibility: (force?: boolean) => Promise<void>;
1766
- protected getAvailableColor(): {
1767
- r: number;
1768
- g: number;
1769
- b: number;
1770
- code: string;
1771
- };
1772
- protected increaseColor(): void;
1773
- protected decreaseColor(): void;
1774
- private applySettings;
1775
- }
1776
- import * as THREE from "three";
1777
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1778
- import { Components } from "../../Components";
1779
- import { Event, World } from "../../Types";
1780
- /**
1781
- * A renderer to determine a mesh visibility on screen
1782
- */
1783
- export declare class MeshCullerRenderer extends CullerRenderer {
1784
- threshold: number;
1785
- readonly onViewUpdated: Event<{
1786
- seen: Set<THREE.Mesh>;
1787
- unseen: Set<THREE.Mesh>;
1788
- }>;
1789
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1790
- isProcessing: boolean;
1791
- private _colorCodeMeshMap;
1792
- private _meshIDColorCodeMap;
1793
- private _currentVisibleMeshes;
1794
- private _recentlyHiddenMeshes;
1795
- private _intervalID;
1796
- private readonly _transparentMat;
1797
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1798
- dispose(): void;
1799
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1800
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1801
- private handleWorkerMessage;
1802
- private getAvailableMaterial;
1784
+ updateAspect: () => void;
1785
+ private setupCamera;
1786
+ private newCameraControls;
1787
+ private setupEvents;
1788
+ private static getSubsetOfThree;
1803
1789
  }
1804
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1805
1790
  import * as THREE from "three";
1806
1791
  import { Hideable, Disposable, Event, World } from "../../Types";
1807
1792
  import { Components } from "../../Components";
@@ -1847,9 +1832,9 @@ export declare class SimplePlane implements Disposable, Hideable {
1847
1832
  set size(size: number);
1848
1833
  get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1849
1834
  constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1850
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): Promise<void>;
1835
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1851
1836
  /** {@link Updateable.update} */
1852
- update: () => Promise<void>;
1837
+ update: () => void;
1853
1838
  /** {@link Disposable.dispose} */
1854
1839
  dispose(): void;
1855
1840
  private reset;
@@ -1863,42 +1848,15 @@ export declare class SimplePlane implements Disposable, Hideable {
1863
1848
  private newHelper;
1864
1849
  private static newPlaneMesh;
1865
1850
  }
1866
- import * as WEBIFC from "web-ifc";
1867
- import * as THREE from "three";
1868
- export declare class Units {
1869
- factor: number;
1870
- complement: number;
1871
- apply(matrix: THREE.Matrix4): void;
1872
- setUp(webIfc: WEBIFC.IfcAPI): void;
1873
- private getLengthUnits;
1874
- private getScaleMatrix;
1851
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
1852
+ /** Configuration of the IFC-fragment streaming. */
1853
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1854
+ minGeometrySize: number;
1855
+ minAssetsSize: number;
1875
1856
  }
1876
- import * as WEBIFC from "web-ifc";
1877
- import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1878
- import { PropertiesStreamingSettings } from "./streaming-settings";
1879
- export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1880
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1881
- onPropertiesStreamed: AsyncEvent<{
1882
- type: number;
1883
- data: {
1884
- [id: number]: any;
1885
- };
1886
- }>;
1887
- onProgress: AsyncEvent<number>;
1888
- onIndicesStreamed: AsyncEvent<number[][]>;
1889
- /** {@link Disposable.onDisposed} */
1890
- readonly onDisposed: Event<string>;
1891
- enabled: boolean;
1892
- settings: PropertiesStreamingSettings;
1893
- webIfc: WEBIFC.IfcAPI;
1894
- dispose(): Promise<void>;
1895
- streamFromBuffer(data: Uint8Array): Promise<void>;
1896
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1897
- private readIfcFile;
1898
- private streamIfcFile;
1899
- private streamAllProperties;
1900
- private getIndices;
1901
- private cleanUp;
1857
+ /** Configuration of the IFC-fragment streaming. */
1858
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1859
+ propertiesSize: number;
1902
1860
  }
1903
1861
  export interface StreamedGeometries {
1904
1862
  [id: number]: {
@@ -1915,31 +1873,6 @@ export interface StreamedAsset {
1915
1873
  color: number[];
1916
1874
  }[];
1917
1875
  }
1918
- import * as THREE from "three";
1919
- import * as WEBIFC from "web-ifc";
1920
- import * as FRAGS from "@thatopen/fragments";
1921
- export declare class CivilReader {
1922
- defLineMat: THREE.LineBasicMaterial;
1923
- read(webIfc: WEBIFC.IfcAPI): {
1924
- alignments: Map<number, FRAGS.Alignment>;
1925
- coordinationMatrix: THREE.Matrix4;
1926
- } | undefined;
1927
- get(civilItems: any): {
1928
- alignments: Map<number, FRAGS.Alignment>;
1929
- coordinationMatrix: THREE.Matrix4;
1930
- } | undefined;
1931
- private getCurves;
1932
- }
1933
- import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1934
- /** Configuration of the IFC-fragment streaming. */
1935
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
1936
- minGeometrySize: number;
1937
- minAssetsSize: number;
1938
- }
1939
- /** Configuration of the IFC-fragment streaming. */
1940
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1941
- propertiesSize: number;
1942
- }
1943
1876
  import * as WEBIFC from "web-ifc";
1944
1877
  /** Configuration of the IFC-fragment conversion. */
1945
1878
  export declare class IfcFragmentSettings {
@@ -1968,9 +1901,46 @@ export declare class IfcFragmentSettings {
1968
1901
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1969
1902
  }
1970
1903
  import * as WEBIFC from "web-ifc";
1904
+ import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1905
+ import { PropertiesStreamingSettings } from "./streaming-settings";
1906
+ export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1907
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1908
+ onPropertiesStreamed: AsyncEvent<{
1909
+ type: number;
1910
+ data: {
1911
+ [id: number]: any;
1912
+ };
1913
+ }>;
1914
+ onProgress: AsyncEvent<number>;
1915
+ onIndicesStreamed: AsyncEvent<number[][]>;
1916
+ /** {@link Disposable.onDisposed} */
1917
+ readonly onDisposed: Event<string>;
1918
+ enabled: boolean;
1919
+ settings: PropertiesStreamingSettings;
1920
+ webIfc: WEBIFC.IfcAPI;
1921
+ dispose(): Promise<void>;
1922
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1923
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1924
+ private readIfcFile;
1925
+ private streamIfcFile;
1926
+ private streamAllProperties;
1927
+ private getIndices;
1928
+ private cleanUp;
1929
+ }
1930
+ import * as WEBIFC from "web-ifc";
1971
1931
  export declare class IfcMetadataReader {
1972
1932
  get(webIfc: WEBIFC.IfcAPI, type: number): string;
1973
1933
  }
1934
+ import * as WEBIFC from "web-ifc";
1935
+ import * as THREE from "three";
1936
+ export declare class Units {
1937
+ factor: number;
1938
+ complement: number;
1939
+ apply(matrix: THREE.Matrix4): void;
1940
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1941
+ private getLengthUnits;
1942
+ private getScaleMatrix;
1943
+ }
1974
1944
  export type RelationsMap = Map<number, Map<number, number[]>>;
1975
1945
  export interface ModelsRelationMap {
1976
1946
  [modelID: string]: RelationsMap;
@@ -2000,28 +1970,20 @@ import * as THREE from "three";
2000
1970
  export declare class TransformHelper {
2001
1971
  getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
2002
1972
  }
2003
- export type QueryConditions = "is" | "includes" | "startsWith" | "endsWith" | "matches";
2004
- export type ConditionFunctions = {
2005
- [queryCondition in QueryConditions]: (leftValue: string | boolean | number, rightValue: string | boolean | number) => boolean;
2006
- };
2007
- export type QueryOperators = "AND" | "OR";
2008
- export interface AttributeQuery {
2009
- operator?: QueryOperators;
2010
- attribute: string;
2011
- condition: QueryConditions;
2012
- value: string | number | boolean;
2013
- negateResult?: boolean;
2014
- caseSensitive?: boolean;
2015
- }
2016
- export interface QueryGroup {
2017
- operator?: QueryOperators;
2018
- description?: string;
2019
- queries: (AttributeQuery | QueryGroup)[];
2020
- }
2021
- export interface Query {
2022
- name: string;
2023
- description?: string;
2024
- groups: QueryGroup;
1973
+ import * as THREE from "three";
1974
+ import * as WEBIFC from "web-ifc";
1975
+ import * as FRAGS from "@thatopen/fragments";
1976
+ export declare class CivilReader {
1977
+ defLineMat: THREE.LineBasicMaterial;
1978
+ read(webIfc: WEBIFC.IfcAPI): {
1979
+ alignments: Map<number, FRAGS.Alignment>;
1980
+ coordinationMatrix: THREE.Matrix4;
1981
+ } | undefined;
1982
+ get(civilItems: any): {
1983
+ alignments: Map<number, FRAGS.Alignment>;
1984
+ coordinationMatrix: THREE.Matrix4;
1985
+ } | undefined;
1986
+ private getCurves;
2025
1987
  }
2026
1988
 
2027
1989
  }