import CameraControls from 'camera-controls'; import { DataMap as DataMap_2 } from '@thatopen/fragments'; import { DataSet as DataSet_2 } from '@thatopen/fragments'; import * as FRAGS from '@thatopen/fragments'; import * as THREE from 'three'; import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js'; import { Vector2 } from 'three'; import * as WEBIFC from 'web-ifc'; import { XMLBuilder } from 'fast-xml-parser'; import { XMLParser } from 'fast-xml-parser'; /** * Configuration options for adding a classification. */ export declare interface AddClassificationConfig { /** * Optional name of the classification to be added. */ classificationName?: string; /** * Optional array of regular expressions representing model IDs. */ modelIds?: RegExp[]; } declare class AmbientLightConfig { private _list; private _scene; constructor(list: SimpleSceneConfigType, scene: SimpleScene); get color(): THREE.Color; set color(value: THREE.Color); get intensity(): number; set intensity(value: number); } export declare interface AngleAnnotation { /** Unique identifier. */ uuid: string; /** Snapped point on the first line — defines the first ray direction from the vertex. */ pointA: THREE.Vector3; /** Computed intersection of the two measured lines. */ vertex: THREE.Vector3; /** Snapped point on the second line — defines the second ray direction from the vertex. */ pointB: THREE.Vector3; /** Radius of the arc at commit time, in drawing local units. */ arcRadius: number; /** * When `true`, the arc measures the reflex angle (360° − interior). * The arc is drawn going the long way around and the bisector flips 180°. */ flipped?: boolean; /** Name of the {@link AngleAnnotationStyle} to use when rendering. */ style: string; } /** Editable fields of {@link AngleAnnotation} — everything except the `uuid`. */ export declare type AngleAnnotationData = Omit; export declare type AngleAnnotationEvent = /** * A point was clicked. Carries `drawing` so the machine caches it on the first * click — subsequent events reuse that context. * `line` is required in `awaitingFirstLine` and `awaitingSecondLine`; * free-space clicks are accepted in `positioningArc`. */ { type: "CLICK"; point: THREE.Vector3; line?: THREE.Line3; drawing?: TechnicalDrawing; } /** Cursor moved — drawing context already cached from the initial CLICK. */ | { type: "MOUSE_MOVE"; point: THREE.Vector3; line?: THREE.Line3; } /** Cancel and return to the initial state. */ | { type: "ESCAPE"; }; /** * Global drawing system that manages angle dimension annotations across all * {@link TechnicalDrawing} instances. */ export declare class AngleAnnotations extends AnnotationSystem implements Transitionable, Disposable_2 { enabled: boolean; readonly _item: AngleAnnotation; machineState: AngleAnnotationState; readonly onMachineStateChanged: Event_2; private _secondLinePreviewObject; constructor(components: Components); pickHandle(_drawing: TechnicalDrawing, _ray: THREE.Ray, _threshold?: number): { uuid: string; handle: "pointA" | "vertex" | "pointB"; } | null; sendMachineEvent(event: AngleAnnotationEvent): void; protected _buildGroup(dim: AngleAnnotation, style: AngleAnnotationStyle): THREE.Group; protected _updatePreview(): void; protected _onDispose(): void; private _resetMachine; private _clearSecondLinePreview; private _updateSecondLinePreview; } export declare type AngleAnnotationState = /** Waiting for the user to click the first measured line. */ { kind: "awaitingFirstLine"; } /** First line picked. Waiting for the second line. */ | { kind: "awaitingSecondLine"; line1: THREE.Line3; pointA: THREE.Vector3; } /** * Both lines picked, vertex computed. User moves the cursor to set the * arc radius, then clicks to commit. */ | { kind: "positioningArc"; pointA: THREE.Vector3; vertex: THREE.Vector3; pointB: THREE.Vector3; cursor: THREE.Vector3 | null; flipped: boolean; } /** Annotation just committed. */ | { kind: "committed"; dimension: AngleAnnotation; }; export declare interface AngleAnnotationStyle extends BaseAnnotationStyle { /** Tick mark builder at each end of the arc. */ lineTick: LineTickBuilder; /** * Optional filled tick mark builder. When provided, a `THREE.Mesh` triangle * is rendered at each arc endpoint. Set `tick` to {@link NoTick} when you * only want the filled shape. */ meshTick?: MeshTickBuilder; /** Tick size in drawing local units. */ tickSize: number; /** Gap between the vertex and the start of each extension line. */ extensionGap: number; /** Distance from the arc to the text label, along the bisector ray. */ textOffset: number; } declare interface AngleAnnotationSystem { item: AngleAnnotation; data: AngleAnnotationData; style: AngleAnnotationStyle; handle: "pointA" | "vertex" | "pointB"; } /** * Pure state transition function for the angle dimension tool. * Returns the **same state reference** when no transition applies. */ export declare function angleDimensionMachine(state: AngleAnnotationState, event: AngleAnnotationEvent): AngleAnnotationState; /** * A single annotation entry stored in {@link DrawingAnnotations}. * Bundles the owning system, the annotation data, and its Three.js group * so that any lookup by UUID gives full access to all three. */ export declare interface AnnotationEntry { /** The system that created and owns this annotation. */ system: AnnotationSystem; /** The persisted annotation data (e.g. {@link LinearAnnotation}). */ data: unknown; /** The Three.js group added to {@link TechnicalDrawing.three}. */ three: THREE.Group; } /** * Abstract base for all annotation sub-systems operating on a * {@link TechnicalDrawing}. Provides the full CRUD lifecycle, material caches, * preview geometry, and automatic style-reactivity so subclasses only need to * implement geometry construction and handle-picking. * * @typeParam TSystem - A {@link DrawingSystemDescriptor} that declares the item, * data, style, and handle types for this specific system. */ declare abstract class AnnotationSystem { protected readonly _components: Components; /* Excluded from this release type: _item */ constructor(_components: Components); abstract enabled: boolean; readonly styles: FRAGS.DataMap; activeStyle: string; readonly onCommit: Event_2<{ drawing: TechnicalDrawing; item: TSystem["item"]; group: THREE.Group; }[]>; readonly onUpdate: Event_2<{ item: TSystem["item"]; group: THREE.Group; }>; readonly onDelete: Event_2; readonly onDisposed: Event_2; protected readonly _knownDrawings: Set; protected readonly _previewMaterial: THREE.LineBasicMaterial; protected _previewObject: THREE.LineSegments | null; protected _previewDrawing: TechnicalDrawing | null; protected readonly _materialCache: FRAGS.DataMap; protected readonly _meshMaterialCache: FRAGS.DataMap; /** * When `true` (default), {@link _disposeGroup} and {@link _redraw} will call * `.dispose()` on each child's `BufferGeometry`. Set to `false` in systems * where geometry is shared across multiple groups (e.g. {@link BlockAnnotations}). */ protected _ownsChildGeometry: boolean; /** * Build and return a `THREE.Group` containing all geometry for `item`. * The group's own `userData` is set by the base class after this call. * Set `userData` on *children* (e.g. `ls.userData.isDimension = true`) here. */ protected abstract _buildGroup(item: TSystem["item"], style: TSystem["style"]): THREE.Group; /** * Return the closest pickable handle on `drawing` for the given world-space * `ray`, or `null` if nothing is within `threshold` units. */ abstract pickHandle(drawing: TechnicalDrawing, ray: THREE.Ray, threshold?: number): { uuid: string; handle: TSystem["handle"]; } | null; /** Called synchronously after a group is first persisted or redrawn. */ protected _onAfterPersist(_item: TSystem["item"], _group: THREE.Group): void; /** Called at the start of {@link dispose} before materials and events are torn down. */ protected _onDispose(): void; /** Override to rebuild preview geometry after a state transition. */ protected _updatePreview(): void; get(drawings: TechnicalDrawing[]): FRAGS.DataMap; add(drawing: TechnicalDrawing, data: TSystem["data"]): TSystem["item"]; update(drawing: TechnicalDrawing, uuids: string[], changes: Partial): void; pick(ray: THREE.Ray, threshold?: number): string | null; delete(drawing: TechnicalDrawing, uuids: string[]): void; clear(drawings?: TechnicalDrawing[]): void; dispose(): void; protected _trackDrawing(drawing: TechnicalDrawing): void; protected _resolveStyle(styleName: string): TSystem["style"]; protected _getMaterial(styleName: string): THREE.LineBasicMaterial; protected _getMeshMaterial(styleName: string): THREE.MeshBasicMaterial; protected _disposeGroup(group: THREE.Group): void; protected _clearPreview(): void; protected _persist(drawing: TechnicalDrawing, item: TSystem["item"]): { drawing: TechnicalDrawing; item: TSystem["item"]; group: THREE.Group; }; protected _redraw(item: TSystem["item"], group: THREE.Group): void; } export { AnnotationSystem } export { AnnotationSystem as DrawingSystem } /** * Closed arrowhead tick — two wing lines plus a base line connecting them, * forming a triangle outline (tip → wing1, tip → wing2, wing1 → wing2). */ export declare const ArrowTick: LineTickBuilder; /** * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to `this`, you will need to declare the callback as an arrow function. */ export declare class AsyncEvent { /** * Whether this event is active or not. If not, it won't trigger. */ enabled: boolean; /** * Add a callback to this event instance. * @param handler - the callback to be added to this event. */ add(handler: T extends void ? { (): Promise; } : { (data: T): Promise; }): void; /** * Removes a callback from this event instance. * @param handler - the callback to be removed from this event. */ remove(handler: T extends void ? { (): Promise; } : { (data: T): Promise; }): void; /** Triggers all the callbacks assigned to this event. */ trigger: (data?: T) => Promise; /** Gets rid of all the suscribed events. */ reset(): void; private handlers; } /** * Minimal interface for a translate-only gizmo that can be configured and * attached to one of the helper's control handles. * * Satisfied by `THREE.TransformControls` without a direct import, keeping * this class free of DOM dependencies. */ export declare interface AxisGizmoLike { attach(object: THREE.Object3D): void; setSpace(space: "world" | "local"): void; getHelper(): THREE.Object3D; showX: boolean; showY: boolean; showZ: boolean; addEventListener(type: string, listener: () => void): void; } /** * Base class of the library. Useful for finding out the interfaces something implements. */ export declare abstract class Base { components: Components; constructor(components: Components); /** Whether is component is {@link Disposable}. */ isDisposeable: () => this is Disposable_2; /** Whether is component is {@link Resizeable}. */ isResizeable: () => this is Resizeable; /** Whether is component is {@link Updateable}. */ isUpdateable: () => this is Updateable; /** Whether is component is {@link Hideable}. */ isHideable: () => this is Hideable; /** Whether is component is {@link Configurable}. */ isConfigurable: () => this is Configurable; /** Whether is component is {@link Serializable}. */ isSerializable: () => this is Serializable>; } /** * Minimum style contract shared by every annotation system. * All per-system style interfaces must extend this. */ export declare interface BaseAnnotationStyle { /** Line and text color as a hex number (e.g. `0xff0000`). */ color: number; /** Distance from the annotation geometry to the text label in drawing local units. */ textOffset: number; /** Font size of the text label in drawing local units. */ fontSize: number; /** * Unit used to format measured values in text labels. * Defaults to {@link Units.m} (metres) when not set. */ unit?: DimensionUnit; } /** * Abstract class representing a camera in a 3D world. All cameras should use this class as a base. */ export declare abstract class BaseCamera extends BaseWorldItem { /** * Whether the camera is enabled or not. */ abstract enabled: boolean; /** * The Three.js camera instance. */ abstract three: THREE.Camera; /** * Optional CameraControls instance for controlling the camera. * This property is only available if the camera is controllable. */ abstract controls?: CameraControls; /** * Checks whether the instance is {@link CameraControllable}. * * @returns True if the instance is controllable, false otherwise. */ hasCameraControls: () => this is CameraControllable; } /** * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base. */ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable_2, Resizeable { /** * The three.js WebGLRenderer instance associated with this renderer. * * @abstract * @type {THREE.WebGLRenderer} */ abstract three: THREE.WebGLRenderer; /** {@link Updateable.onBeforeUpdate} */ onAfterUpdate: Event_2; /** {@link Updateable.onAfterUpdate} */ onBeforeUpdate: Event_2; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** {@link Resizeable.onResize} */ readonly onResize: Event_2; /** * Event that fires when there has been a change to the list of clipping * planes used by the active renderer. */ readonly onClippingPlanesUpdated: Event_2; /** {@link Updateable.update} */ abstract update(delta?: number): void | Promise; /** {@link Disposable.dispose} */ abstract dispose(): void; /** {@link Resizeable.getSize} */ abstract getSize(): Vector2; /** {@link Resizeable.resize} */ abstract resize(size: Vector2 | undefined): void; /** * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer. */ clippingPlanes: THREE.Plane[]; /** * Updates the clipping planes and triggers the `onClippingPlanesUpdated` event. * * @remarks * This method is typically called when there is a change to the list of clipping planes * used by the active renderer. */ updateClippingPlanes(): void; /** * Sets or removes a clipping plane from the renderer. * * @param active - A boolean indicating whether the clipping plane should be active or not. * @param plane - The clipping plane to be added or removed. * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to `false`. * * @remarks * This method adds or removes a clipping plane from the `clippingPlanes` array. * If `active` is `true` and the plane is not already in the array, it is added. * If `active` is `false` and the plane is in the array, it is removed. * The `three.clippingPlanes` property is then updated to reflect the current state of the `clippingPlanes` array, * excluding any planes marked as local. */ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void; } /** * Abstract class representing a base scene in the application. All scenes should use this class as a base. */ export declare abstract class BaseScene extends BaseWorldItem implements Disposable_2 { /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * Abstract property representing the three.js object associated with this scene. * It should be implemented by subclasses. */ abstract three: THREE.Object3D; /** The set of directional lights managed by this scene component. */ directionalLights: Map; /** The set of ambient lights managed by this scene component. */ ambientLights: Map; protected constructor(components: Components); /** {@link Disposable.dispose} */ dispose(): void; deleteAllLights(): void; } /** * One of the elements that make a world. It can be either a scene, a camera or a renderer. */ export declare abstract class BaseWorldItem extends Base { readonly worlds: DataMap_2; /** * Event that is triggered when a world is added or removed from the `worlds` map. * The event payload contains the world instance and the action ("added" or "removed"). */ readonly onWorldChanged: Event_2<{ world: World; action: "added" | "removed"; }>; protected _currentWorld: World | null; /** * The current world this item is associated with. It can be null if no world is currently active. */ set currentWorld(value: World | null); get currentWorld(): World | null; protected constructor(components: Components); } export declare interface BCFApiComment { guid: string; date: string; author: string; comment: string; topic_guid?: string; viewpoint_guid?: string; modified_date?: string; modified_author?: string; } export declare interface BCFApiTopic { guid: string; server_assigned_id?: string; topic_type?: string; topic_status?: string; reference_links?: string[]; title: string; priority?: string; index?: number; labels?: string[]; creation_date: string; creation_author: string; modified_date?: string; modified_author?: string; assigned_to?: string; stage?: string; description?: string; bim_snippet?: { snippet_type: string; is_external: boolean; reference: string; reference_schema: string; }; due_date?: string; comments?: BCFApiComment[]; viewpoints?: BCFViewpoint[]; relatedTopics?: { related_topic_guid: string; }[]; document_references?: { guid: string; document_guid?: string; url?: string; description?: string; }[]; } export declare interface BCFTopic { guid: string; serverAssignedId?: string; type: string; status: string; title: string; priority?: string; index?: number; labels: Set; creationDate: Date; creationAuthor: string; modifiedDate?: Date; modifiedAuthor?: string; dueDate?: Date; assignedTo?: string; description?: string; stage?: string; } /** * BCFTopics manages Building Collaboration Format (BCF) data the engine. It provides functionality for importing, exporting, and manipulating BCF data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BCFTopics). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BCFTopics). */ export declare class BCFTopics extends Component implements Disposable_2, Configurable { static uuid: "de977976-e4f6-4e4f-a01a-204727839802"; enabled: boolean; static xmlParser: XMLParser; protected _defaultConfig: Required; config: BCFTopicsConfigManager; readonly list: DataMap_2; readonly documents: DataMap_2; readonly onSetup: Event_2; isSetup: boolean; setup(config?: Partial): void; readonly onBCFImported: Event_2; /** * Creates a new BCFTopic instance and adds it to the list. * * @param data - Optional partial BCFTopic object to initialize the new topic with. * If not provided, default values will be used. * @returns The newly created BCFTopic instance. */ create(data?: Partial): Topic; readonly onDisposed: Event_2; /** * Disposes of the BCFTopics component and triggers the onDisposed event. * * @remarks * This method clears the list of topics and triggers the onDisposed event. * It also resets the onDisposed event listener. */ dispose(): void; /** * Retrieves the unique set of topic types used across all topics. * * @returns A Set containing the unique topic types. */ get usedTypes(): Set; /** * Retrieves the unique set of topic statuses used across all topics. * * @returns A Set containing the unique topic statuses. */ get usedStatuses(): Set; /** * Retrieves the unique set of topic priorities used across all topics. * * @returns A Set containing the unique topic priorities. * Note: This method filters out any null or undefined priorities. */ get usedPriorities(): Set; /** * Retrieves the unique set of topic stages used across all topics. * * @returns A Set containing the unique topic stages. * Note: This method filters out any null or undefined stages. */ get usedStages(): Set; /** * Retrieves the unique set of users associated with topics. * * @returns A Set containing the unique users. * Note: This method collects users from the creation author, assigned to, modified author, and comment authors. */ get usedUsers(): Set; /** * Retrieves the unique set of labels used across all topics. * * @returns A Set containing the unique labels. */ get usedLabels(): Set; /** * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics. * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config. */ updateExtensions(): void; /** * Updates the references to viewpoints in the topics. * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list. * If a viewpoint does not exist, it is removed from the topic's viewpoints. */ updateViewpointReferences(): void; /** * Exports the given topics to a BCF (Building Collaboration Format) zip file. * * @param topics - The topics to export. Defaults to all topics in the list. * @returns A promise that resolves to a Blob containing the exported BCF zip file. */ export(topics?: Iterable): Promise; private serializeExtensions; private processMarkupComment; private getMarkupComments; private getMarkupLabels; private getMarkupViewpoints; private getMarkupRelatedTopics; private getMarkupDocumentReferences; /** * Loads BCF (Building Collaboration Format) data into the engine. * * @param world - The default world where the viewpoints are going to be created. * @param data - The BCF data to load. * * @returns A promise that resolves to an object containing the created viewpoints and topics. * * @throws An error if the BCF version is not supported. */ load(data: Uint8Array): Promise<{ viewpoints: Viewpoint[]; topics: Topic[]; }>; } /** * Configuration settings for managing BCF topics. This interface defines the properties and their meanings used to control the behavior of exporting and importing BCF topics. */ export declare interface BCFTopicsConfig { /** * The BCF version used during export. */ version: BCFVersion; /** * The email of the user creating topics using this component. */ author: string; /** * The set of allowed topic types. This is exported inside the * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). */ types: Set; /** * The set of allowed topic statuses. This is exported inside the * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). */ statuses: Set; /** * The set of allowed topic priorities. This is exported inside the * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). */ priorities: Set; /** * The set of allowed topic labels. This is exported inside the * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). */ labels: Set; /** * The set of allowed topic stages. This is exported inside the * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). */ stages: Set; /** * The set of allowed topic users. This is exported inside the * [bcf.extensions](https://github.com/buildingSMART/BCF-XML/tree/release_3_0/Documentation#bcf-file-structure). */ users: Set; /** * Whether or not to include the AuthoringSoftwareId in the viewpoint components during export. */ includeSelectionTag: boolean; /** * Updates the types, statuses, users, etc., after importing an external BCF. */ updateExtensionsOnImport: boolean; /** * Only allow to use the extensions (types, statuses, etc.) defined in the config when setting the corresponding data in a topic. */ strict: boolean; /** * If true, export the extensions (types, status, etc.) based on topics data. This doesn't update the extensions in the config. * If false, only export the extensions defined in each collection of possibilities set in the config. * In all cases, all the values from each collection of extensions defined in the config are going to be exported. */ includeAllExtensionsOnExport: boolean; /** * Version to be used when importing if no bcf.version file is present in the incoming data. * When null, the importer will throw an error if the version is missing or is not supported. */ fallbackVersionOnImport: BCFVersion | null; /** * If true, do not import a topic with missing information (guid, type, status, title, creationDate or creationAuthor). * If false, use default values for missing data. */ ignoreIncompleteTopicsOnImport: boolean; exportCustomDataAsLabels: boolean; } export declare class BCFTopicsConfigManager extends Configurator { protected _config: BCFTopicsConfigType; get version(): string; set version(value: string); get author(): string; set author(value: string); get types(): Set; set types(value: Set); get statuses(): Set; set statuses(value: Set); get priorities(): Set; set priorities(value: Set); get labels(): Set; set labels(value: Set); get stages(): Set; set stages(value: Set); get users(): Set; set users(value: Set); get includeSelectionTag(): boolean; set includeSelectionTag(value: boolean); get updateExtensionsOnImport(): boolean; set updateExtensionsOnImport(value: boolean); get strict(): boolean; set strict(value: boolean); get includeAllExtensionsOnExport(): boolean; set includeAllExtensionsOnExport(value: boolean); get fallbackVersionOnImport(): string; set fallbackVersionOnImport(value: string); get ignoreIncompleteTopicsOnImport(): boolean; set ignoreIncompleteTopicsOnImport(value: boolean); get exportCustomDataAsLabels(): boolean; set exportCustomDataAsLabels(value: boolean); } declare type BCFTopicsConfigType = { version: SelectSettingControl; author: TextSettingsControl; types: TextSetSettingControl; statuses: TextSetSettingControl; priorities: TextSetSettingControl; labels: TextSetSettingControl; stages: TextSetSettingControl; users: TextSetSettingControl; includeSelectionTag: BooleanSettingsControl; updateExtensionsOnImport: BooleanSettingsControl; strict: BooleanSettingsControl; includeAllExtensionsOnExport: BooleanSettingsControl; fallbackVersionOnImport: SelectSettingControl; ignoreIncompleteTopicsOnImport: BooleanSettingsControl; exportCustomDataAsLabels: BooleanSettingsControl; }; export declare type BCFVersion = "2.1" | "3"; /** * Represents a Building Collaboration Format (BCF) viewpoint. This interface is compliant with the BCF API specifications. */ export declare interface BCFViewpoint { /** * Optional title of the viewpoint. */ title?: string; /** * Optional index of the viewpoint. */ index?: number; /** * Unique identifier for the viewpoint. */ guid: string; /** * Optional perspective camera settings for the viewpoint. */ perspective_camera?: ViewpointPerspectiveCamera; /** * Optional orthogonal camera settings for the viewpoint. */ orthogonal_camera?: ViewpointOrthogonalCamera; /** * Optional components associated with the viewpoint. */ components?: ViewpointComponents; /** * Optional snapshot image of the viewpoint. */ snapshot?: ViewpointSnapshot; /** * Optional array of lines associated with the viewpoint. */ lines?: ViewpointLine[]; /** * Optional array of clipping planes associated with the viewpoint. */ clipping_planes?: ViewpointClippingPlane[]; /** * Optional array of bitmaps associated with the viewpoint. */ bitmaps?: ViewpointBitmap[]; } /** * Global drawing system that manages block insertions across all * {@link TechnicalDrawing} instances. * * A **block** is a named, reusable geometry definition (e.g. a furniture symbol * or a detail imported from a DXF). Multiple insertions of the same block share * the same `THREE.BufferGeometry`, so only the transform (position, rotation, * scale) differs per instance. * * Register via {@link TechnicalDrawings.use}: * ```ts * const blocks = techDrawings.use(BlockAnnotations); * ``` * * Typical workflow: * ```ts * // 1. Project external geometry to drawing space * const projected = TechnicalDrawing.toDrawingSpace(ifcLines, drawing); * * // 2. Register the block definition (global — do this once) * blocks.define("CHAIR", { lines: projected.geometry }); * * // 3. Insert on any drawing * blocks.add(drawing, { blockName: "CHAIR", position, rotation: 0, scale: 1, style: "default" }); * ``` */ export declare class BlockAnnotations extends AnnotationSystem implements Disposable_2 { enabled: boolean; readonly _item: BlockInsertion; protected _ownsChildGeometry: boolean; /** * Named block definitions in block-local XZ space. * Register via {@link define}. Geometry is shared across all drawings and insertions. */ readonly definitions: FRAGS.DataMap; constructor(components: Components); pickHandle(_drawing: TechnicalDrawing, _ray: THREE.Ray, _threshold?: number): { uuid: string; handle: "position" | "rotation" | "scale"; } | null; /** * Overrides the base `pick` to use the correct `LineSegments.raycast` (pair-based) * rather than `THREE.Line.prototype.raycast` (continuous-line). */ pick(ray: THREE.Ray, threshold?: number): string | null; /** * Registers a block definition by name (global — not tied to any drawing). * All geometry must be in block-local XZ space (Y = 0). * Use {@link TechnicalDrawing.toDrawingSpace} to project external geometry first. * * Replaces any existing definition with the same name without disposing the old geometry. */ define(name: string, definition: BlockDefinition): void; protected _buildGroup(ins: BlockInsertion, _style: BlockStyle): THREE.Group; protected _onAfterPersist(ins: BlockInsertion, group: THREE.Group): void; protected _onDispose(): void; } declare interface BlockAnnotationsSystem { item: BlockInsertion; data: BlockInsertionData; style: BlockStyle; handle: "position" | "rotation" | "scale"; } /** * The geometry content of a named block. * At least one of `lines` or `mesh` must be provided. * * - `lines` — `BufferGeometry` rendered as `LineSegments` (wire outlines). * - `mesh` — `BufferGeometry` rendered as a filled `THREE.Mesh` (e.g. hatches * or solid fills imported from DXF `SOLID`/`HATCH` entities). */ export declare interface BlockDefinition { /** Line geometry for `LineSegments`. */ lines?: THREE.BufferGeometry; /** Triangle geometry for a filled `THREE.Mesh`. */ mesh?: THREE.BufferGeometry; } /** * A single placed instance of a named block definition. * All coordinates are in drawing local space (XZ plane, Y = 0). */ export declare interface BlockInsertion { /** Unique identifier for this insertion. */ uuid: string; /** Name of the block definition to draw. Must be registered via {@link BlockAnnotations.define}. */ blockName: string; /** Insertion point in drawing local space (Y is ignored — always 0). */ position: THREE.Vector3; /** Rotation around the Y axis in radians. */ rotation: number; /** Uniform scale applied to the block geometry. */ scale: number; /** Style name — references a {@link BlockStyle} registered on the system. */ style: string; } /** Editable fields of {@link BlockInsertion} — everything except the `uuid`. */ export declare type BlockInsertionData = Omit; /** * Style for a {@link BlockAnnotations} system. * `textOffset` and `fontSize` are unused for blocks but required by * {@link BaseAnnotationStyle} — set them to `0` in the default style. */ export declare interface BlockStyle extends BaseAnnotationStyle { } export declare interface BooleanSettingsControl { type: "Boolean"; value: boolean; } /** * An implementation of bounding box utilities that works for fragments. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer). */ export declare class BoundingBoxer extends Component implements Disposable_2 { static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166"; /** {@link Component.enabled} */ enabled: boolean; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * A readonly dataset containing instances of THREE.Box3. */ readonly list: FRAGS.DataSet; constructor(components: Components); /** {@link Disposable.dispose} */ dispose(full?: boolean): void; /** * Combines all bounding boxes in the `list` property into a single bounding box. * * @returns A `THREE.Box3` instance representing the union of all bounding boxes in the `list`. */ get(): THREE.Box3; /** * Asynchronously adds bounding boxes to the list by merging boxes from models * specified in the provided `ModelIdMap`. * * @param items - A map where keys are model IDs and values are arrays of local IDs * representing specific parts of the models to include in the bounding box. */ addFromModelIdMap(items: ModelIdMap): Promise; /** * Adds bounding boxes from models to the current list based on optional filtering criteria. * * @param modelIds - An optional array of regular expressions used to filter models by their IDs. * If provided, only models whose IDs match at least one of the regular expressions * will have their bounding boxes added to the list. If not, all models will be used. */ addFromModels(modelIds?: RegExp[]): void; /** * Calculates and returns the center point of the bounding box derived from the provided model ID map. * * @param modelIdMap - A mapping of model IDs and localIds used to generate the bounding box. * @returns A `THREE.Vector3` object representing the center point of the bounding box. */ getCenter(modelIdMap: ModelIdMap): Promise; /** * Calculates the camera orientation and position based on the specified orientation * and an optional offset factor. * * @param orientation - Specifies the direction of the camera relative to the bounding box. * @param offsetFactor - A multiplier applied to the distance between the camera and the bounding box. * Defaults to `1`. * @returns An object containing: * - `position`: A `THREE.Vector3` representing the calculated camera position. * - `target`: A `THREE.Vector3` representing the center of the bounding box, which the camera should target. */ getCameraOrientation(orientation: "front" | "back" | "left" | "right" | "top" | "bottom", offsetFactor?: number): Promise<{ position: THREE.Vector3; target: THREE.Vector3; }>; } /** * Builds the flat vertex positions for a single committed angle dimension. */ export declare function buildAnglePositions(dim: AngleAnnotation, style: AngleAnnotationStyle): number[]; /** * Builds vertex positions for the live preview during `positioningArc`. * Uses the cursor distance from the vertex as the arc radius. */ export declare function buildAnglePreviewPositions(pointA: THREE.Vector3, vertex: THREE.Vector3, pointB: THREE.Vector3, cursor: THREE.Vector3 | null, style: AngleAnnotationStyle, flipped?: boolean): number[]; /** * Builds the flat vertex positions for a committed callout annotation: * enclosure outline + attachment-to-elbow line + elbow-to-extensionEnd line * + optional tick at `extensionEnd`. */ export declare function buildCalloutPositions(ann: CalloutAnnotation, style: CalloutAnnotationStyle): number[]; /** * Builds vertex positions for the live preview during interactive placement. * During `awaitingRadius`, `cursor` is treated as the SE corner of the enclosure * so halfW/halfH are derived live from the delta to `center`. */ export declare function buildCalloutPreviewPositions(kind: "awaitingRadius" | "awaitingElbow" | "awaitingExtension", center: THREE.Vector3, halfW: number, halfH: number, elbow: THREE.Vector3 | null, cursor: THREE.Vector3 | null, style: CalloutAnnotationStyle): number[]; /** * Builds the flat vertex positions (x,y,z triplets) for a single committed * linear dimension. The result can be passed directly to a * `THREE.BufferAttribute`. * * The geometry lives in drawing local space (XZ plane, Y = 0) and consists of: * - Extension line from pointA * - Extension line from pointB * - Dimension line connecting both extension line ends * - Tick geometry at each end of the dimension line (from `style.tick`) */ export declare function buildDimensionPositions(dim: LinearAnnotation, style: LinearAnnotationStyle): number[]; /** * Builds an array of {@link LinearAnnotation}s from consecutive point pairs, * all sharing the same perpendicular offset. */ export declare function buildDimensions(points: THREE.Vector3[], offset: number): LinearAnnotation[]; /** * Builds the flat vertex positions for a committed leader annotation. */ export declare function buildLeaderPositions(ann: LeaderAnnotation, style: LeaderAnnotationStyle): number[]; /** * Builds vertex positions for the live preview. */ export declare function buildLeaderPreviewPositions(kind: "placingElbow" | "placingExtension", arrowTip: THREE.Vector3, elbow: THREE.Vector3 | null, cursor: THREE.Vector3 | null, style: LeaderAnnotationStyle): number[]; /** * Builds the flat vertex positions for a live dimension preview. * * During `placingPoints`: lines connecting all placed points plus a line * to the cursor. * During `positioningOffset`: a full dimension preview using the cursor as * the offset reference, rendered with the active style's tick. */ export declare function buildPreviewPositions(kind: "placingPoints" | "positioningOffset", points: THREE.Vector3[], cursor: THREE.Vector3 | null, style: LinearAnnotationStyle): number[]; /** * Builds the `LineSegments` position array for a committed slope annotation. * * The geometry consists of: * - **Shaft**: tail → tip * - **Tick**: geometry produced by `style.tick` at the downhill tip * * @returns A flat `Float32Array` of XYZ triplets (vertex pairs for `LineSegments`). */ export declare function buildSlopePositions(ann: SlopeAnnotation, style: SlopeAnnotationStyle): Float32Array; /** * The committed data for a single callout annotation. * All coordinates are in drawing local space (XZ plane, Y = 0). */ export declare interface CalloutAnnotation { /** Unique identifier. */ uuid: string; /** Centre of the enclosure shape. */ center: THREE.Vector3; /** Half-width of the enclosure along the X axis. */ halfW: number; /** Half-height of the enclosure along the Z axis. */ halfH: number; /** Elbow — the bend between the extension line and its horizontal run. */ elbow: THREE.Vector3; /** End of the horizontal extension line — anchor for the text label. */ extensionEnd: THREE.Vector3; /** The annotation text. */ text: string; /** Name of the {@link CalloutAnnotationStyle} to use when rendering. */ style: string; } /** Editable fields of {@link CalloutAnnotation} — everything except `uuid`. */ export declare type CalloutAnnotationData = Omit; export declare type CalloutAnnotationEvent = /** A point in drawing local space was clicked. */ { type: "CLICK"; point: THREE.Vector3; drawing?: TechnicalDrawing; } /** The cursor moved to a new position in drawing local space. */ | { type: "MOUSE_MOVE"; point: THREE.Vector3; drawing?: TechnicalDrawing; } /** * Consumer supplies the annotation text after the machine enters * `enteringText`. Ignored in all other states. */ | { type: "SUBMIT_TEXT"; text: string; } /** Cancel the current operation and return to the initial state. */ | { type: "ESCAPE"; }; /** * Pure state transition function for the callout annotation tool. * Returns the **same state reference** when no transition applies. */ export declare function calloutAnnotationMachine(state: CalloutAnnotationState, event: CalloutAnnotationEvent): CalloutAnnotationState; /** * Global drawing system that manages callout annotations across all * {@link TechnicalDrawing} instances. */ export declare class CalloutAnnotations extends AnnotationSystem implements Transitionable, Disposable_2 { enabled: boolean; readonly _item: CalloutAnnotation; machineState: CalloutAnnotationState; readonly onMachineStateChanged: Event_2; constructor(components: Components); pickHandle(_drawing: TechnicalDrawing, _ray: THREE.Ray, _threshold?: number): { uuid: string; handle: string; } | null; sendMachineEvent(event: CalloutAnnotationEvent): void; protected _buildGroup(ann: CalloutAnnotation, style: CalloutAnnotationStyle): THREE.Group; protected _updatePreview(): void; private _resetMachine; } export declare type CalloutAnnotationState = /** Waiting for the user to click the enclosure centre. */ { kind: "awaitingCenter"; } /** * Centre placed. User moves the cursor to the SE corner of the enclosure * to define its half-width (X) and half-height (Z) simultaneously. */ | { kind: "awaitingRadius"; center: THREE.Vector3; cursor: THREE.Vector3 | null; } /** Size set. User clicks to place the line elbow. */ | { kind: "awaitingElbow"; center: THREE.Vector3; halfW: number; halfH: number; cursor: THREE.Vector3 | null; } /** Elbow set. User clicks the extension endpoint. */ | { kind: "awaitingExtension"; center: THREE.Vector3; halfW: number; halfH: number; elbow: THREE.Vector3; cursor: THREE.Vector3 | null; } /** * All geometry is set. Paused waiting for the consumer to supply the text * via a `SUBMIT_TEXT` event. */ | { kind: "enteringText"; center: THREE.Vector3; halfW: number; halfH: number; elbow: THREE.Vector3; extensionEnd: THREE.Vector3; } /** Annotation just committed. */ | { kind: "committed"; annotation: CalloutAnnotation; }; /** Visual appearance of a callout annotation. */ export declare interface CalloutAnnotationStyle extends BaseAnnotationStyle { /** The enclosure shape builder (cloud, rectangle, circle). */ enclosure: EnclosureBuilder; /** Size of the optional tick at the extension end in drawing local units. */ tickSize: number; /** * Line-segment tick at the extension end — included in the same `LineSegments` * as the extension line. Omit to suppress. */ lineTick?: LineTickBuilder; /** * Filled (mesh) tick at the extension end — rendered as a separate `THREE.Mesh`. * Can be combined with `tick`. */ meshTick?: MeshTickBuilder; } declare interface CalloutAnnotationSystem { item: CalloutAnnotation; data: CalloutAnnotationData; style: CalloutAnnotationStyle; handle: string; } /** * Whether a camera uses the Camera Controls library. */ export declare interface CameraControllable { /** * An instance of CameraControls that provides camera control functionalities. * This instance is used to manipulate the camera. */ controls: CameraControls; } /** * The projection system of the camera. */ export declare type CameraProjection = "Perspective" | "Orthographic"; /** * Elliptical enclosure — an ellipse approximated with line segments centred on * `center`, with semi-axis `halfW` on X and `halfH` on Z. * When `halfW === halfH` the result is a circle. */ export declare const CircleEnclosure: EnclosureBuilder; /** * Represents the data structure for a classification group. */ export declare interface ClassificationGroupData { /** * The ModelIdMap that represents the static collection of items within the group. */ map: ModelIdMap; /** * Optional query used to dynamically find items using the ItemsFinder. Some groups may only rely on static items. */ query?: ClassificationGroupQuery; /** * Asynchronously retrieves the combined map of static and dynamically found items. */ get(): Promise; } /** * Represents a query for a classification group. */ export declare interface ClassificationGroupQuery { /** * The name of the query from the finder to use in the group. */ name: string; /** * Optional configuration for the query. */ config?: QueryTestConfig; } /** * The Classifier component is responsible for grouping items from different models based on criteria. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier). */ export declare class Classifier extends Component implements Disposable_2 { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7"; /** {@link Component.enabled} */ enabled: boolean; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * A nested data map that organizes classification groups. * The outer map uses strings as keys, and the inner map contains ClassificationGroupData, also keyed by strings. */ readonly list: FRAGS.DataMap>; constructor(components: Components); private setupEvents; private getClassificationGroups; private getModelItems; /** * Retrieves data associated with a specific group within a classification. * If the group data does not exist, it creates a new entry. * * @param classification - The classification string. * @param group - The group string within the classification. * @returns The data object associated with the group, containing a map and a `get` method. */ getGroupData(classification: string, group: string): ClassificationGroupData; /** * The default save function used by the classifier. * It extracts the 'value' property from the item's Name and returns it as a string. * If the 'value' property does not exist, it returns null. * * @param item - The item data to extract the value from. * @returns The extracted value as a string, or null if the value does not exist. */ defaultSaveFunction: (item: FRAGS.ItemData) => string | null; /** * Aggregates items based on a classification and query, applying a provided function to each item. * * @param classification - The classification string used to categorize the items. * @param query - The query parameters used to find items. * @param config - Optional configuration for data and item processing. * @param config.data - Optional data configuration to pass to the item retrieval. * @param config.aggregationCallback - Optional function to apply to each item; defaults to `this.defaultSaveFunction` if not provided. * This function receives the item data and a register function to associate item local IDs with names. * If no function is provided, the default save function is used. * * @remarks * The `register` function within the `config.func` allows associating item local IDs with a given name under the specified classification. * It is used to keep track of which items belong to which classification. */ aggregateItems(classification: string, query: FRAGS.ItemsQueryParams, config?: { modelIds?: RegExp[]; data?: Partial; aggregationCallback?: (item: FRAGS.ItemData, register: (name: string, ...localIds: number[]) => void) => void; }): Promise; /** * Adds items to a specific group within a classification. * * @param classification - The classification to which the group belongs. * @param group - The group to which the items will be added. * @param items - A map of model IDs to add to the group. */ addGroupItems(classification: string, group: string, items: ModelIdMap): void; /** * Sets the query for a specific group within a classification. * * @param classification - The classification to target. * @param group - The group within the classification to target. * @param query - The query to set for the group. */ setGroupQuery(classification: string, group: string, query: ClassificationGroupQuery): void; /** * Asynchronously finds a set of ModelIdMaps based on the provided classification data. * @param data An object with classifications as keys and an array of groups as values. * @returns A promise that resolves to a ModelIdMap representing the intersection of all ModelIdMaps found. */ find(data: ClassifierIntersectionInput): Promise; /** * From the items passing the query, use the specified relation to create groupings * This method retrieves and processes related items, applying a custom aggregation callback to register * relations between items based on their attributes and local IDs. * * @param classification - The classification type used to filter items. * @param query - Query parameters for filtering items, defined by `FRAGS.ItemsQueryParams`. * @param relation - The type of relation to aggregate (e.g., "ContainedInStructure", "HasAssociations"). * @param config - Optional configuration for the aggregation process. * @returns A promise that resolves when the aggregation process is complete. * @remarks * - The `aggregationCallback` function processes each item and registers relations based on the item's * attribute value and the local ID of its relations. * - Items without the specified attribute or relations are ignored during aggregation. */ aggregateItemRelations(classification: string, query: FRAGS.ItemsQueryParams, relation: string, config?: ClassifyItemRelationsConfig): Promise; /** * Asynchronously processes and adds classifications by IfcBuildingStorey. * @param config - Optional configuration for adding classifications. * @returns A promise that resolves once the storeys have been processed and added. */ byIfcBuildingStorey(config?: AddClassificationConfig): Promise; /** * Asynchronously processes and adds classifications by category. * @param config - Optional configuration for adding classifications. * @returns A promise that resolves once the categories have been processed and added. */ byCategory(config?: AddClassificationConfig): Promise; private onBeforeFragmentsDispose; /** {@link Disposable.dispose} */ dispose(): void; /** * Removes items from the classifier based on the provided model ID map and configuration. * * @param modelIdMap - A map containing model IDs to be removed. * @param config - Optional configuration for removing items.s. * @remarks If no configuration is provided, items will be removed from all classifications */ removeItems(modelIdMap: ModelIdMap, config?: RemoveClassifierItemsConfig): void; /** * Asynchronously processes models based on the provided configuration and updates classification groups. * * @param config - Optional configuration for adding classifications. Contains the following properties. * @returns A promise that resolves when the processing is complete. */ byModel(config?: AddClassificationConfig): Promise; } /** * Represents the input structure for a classifier intersection operation. Defines a record where the keys are classification names and the values are arrays of group names within those classifications. */ export declare type ClassifierIntersectionInput = Record; /** * Configuration interface for classifying item by relation values. */ export declare interface ClassifyItemRelationsConfig { /** * The attribute whose value will be used to create the group. */ attribute?: string; /** * An array of regular expressions representing model IDs to be used in the aggregation process. */ modelIds?: RegExp[]; } /** * A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper). */ export declare class Clipper extends Component implements Createable, Disposable_2, Hideable, Configurable { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611"; /** {@link Configurable.onSetup} */ readonly onSetup: Event_2; /** Event that fires when the user starts dragging a clipping plane. */ readonly onBeforeDrag: Event_2; /** Event that fires when the user stops dragging a clipping plane. */ readonly onAfterDrag: Event_2; /** * Event that fires when the user starts creating a clipping plane. */ readonly onBeforeCreate: Event_2; /** * Event that fires when the user cancels the creation of a clipping plane. */ readonly onBeforeCancel: Event_2; /** * Event that fires after the user cancels the creation of a clipping plane. */ readonly onAfterCancel: Event_2; /** * Event that fires when the user starts deleting a clipping plane. */ readonly onBeforeDelete: Event_2; /** * Event that fires after a clipping plane has been created. * @param plane - The newly created clipping plane. */ readonly onAfterCreate: Event_2; /** * Event that fires after a clipping plane has been deleted. * @param plane - The deleted clipping plane. */ readonly onAfterDelete: Event_2; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** {@link Configurable.isSetup} */ isSetup: boolean; /** * Whether to force the clipping plane to be orthogonal in the Y direction * (up). This is desirable when clipping a building horizontally and a * clipping plane is created in its roof, which might have a slight * slope for draining purposes. */ orthogonalY: boolean; /** * The tolerance that determines whether an almost-horizontal clipping plane * will be forced to be orthogonal to the Y direction. {@link orthogonalY} * has to be `true` for this to apply. */ toleranceOrthogonalY: number; /** * Whether clipping planes should automatically scale based on * camera distance. When true, the plane surface stays proportional * to the arrow gizmo as you zoom in/out. Default is true. */ autoScalePlanes: boolean; /** * The type of clipping plane to be created. * Default is {@link SimplePlane}. */ Type: new (...args: any) => SimplePlane; /** * A list of all the clipping planes created by this component. */ readonly list: FRAGS.DataMap; /** {@link Configurable.config} */ config: ClipperConfigManager; protected _defaultConfig: ClipperConfig; /** The material used in all the clipping planes. */ private _material; private _size; private _enabled; private _visible; readonly onStateChanged: Event_2<("material" | "enabled" | "size" | "visibility")[]>; /** {@link Component.enabled} */ get enabled(): boolean; /** {@link Component.enabled} */ set enabled(state: boolean); /** {@link Hideable.visible } */ get visible(): boolean; /** {@link Hideable.visible } */ set visible(state: boolean); /** The material of the clipping plane representation. */ get material(): THREE.MeshBasicMaterial; /** The material of the clipping plane representation. */ set material(material: THREE.MeshBasicMaterial); /** The size of the geometric representation of the clippings planes. */ get size(): number; /** The size of the geometric representation of the clippings planes. */ set size(size: number); constructor(components: Components); private setEvents; /** {@link Disposable.dispose} */ dispose(): void; /** {@link Createable.create} */ create(world: World): Promise; /** * Creates a plane in a certain place and with a certain orientation, * without the need of the mouse. * * @param world - the world where this plane should be created. * @param normal - the orientation of the clipping plane. * @param point - the position of the clipping plane. * navigation. */ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): string; /** * {@link Createable.delete} * * @param world - the world where the plane to delete is. * @param planeId - the plane to delete. If undefined, the first plane * found under the cursor will be deleted. */ delete(world: World, planeId?: string): Promise; /** * Deletes all the existing clipping planes. * * @param types - the types of planes to be deleted. If not provided, all planes will be deleted. */ deleteAll(types?: Set): void; /** {@link Configurable.setup} */ setup(config?: Partial): void; private pickPlane; private getAllPlaneMeshes; private createPlaneFromIntersection; private getWorldNormal; private normalizePlaneDirectionY; private newPlane; private updateMaterialsAndPlanes; } /** * Configuration interface for the {@link Clipper}. */ declare interface ClipperConfig { color: THREE.Color; opacity: number; size: number; } declare class ClipperConfigManager extends Configurator { protected _config: ClipperConfigType; get enabled(): boolean; set enabled(value: boolean); get visible(): boolean; set visible(value: boolean); get color(): THREE.Color; set color(value: THREE.Color); get opacity(): number; set opacity(value: number); get size(): number; set size(value: number); } declare type ClipperConfigType = { enabled: BooleanSettingsControl; visible: BooleanSettingsControl; color: ColorSettingsControl; opacity: NumberSettingControl; size: NumberSettingControl; }; /** * Revision-cloud enclosure — a bumpy rectangle centred on `center`. * Width = 2 × halfW, height = 2 × halfH. */ export declare const CloudEnclosure: EnclosureBuilder; export declare interface ColorSettingsControl { type: "Color"; value: THREE.Color; } /** * Represents a comment in a BCF Topic. */ declare class Comment_2 { date: Date; author: string; guid: string; viewpoint?: string; modifiedAuthor?: string; modifiedDate?: Date; topic?: Topic; private _components; private _comment; /** * Sets the comment text and updates the modified date and author. * The author will be the one defined in BCFTopics.config.author * @param value - The new comment text. */ set comment(value: string); /** * Gets the comment text. * @returns The comment text. */ get comment(): string; /** * Constructs a new BCF Topic Comment instance. * @param components - The Components instance. * @param text - The initial comment text. */ constructor(components: Components, text: string); toJSON(): BCFApiComment; } export { Comment_2 as Comment } /** * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance. */ export declare abstract class Component extends Base { /** * Whether this component is active or not. The behaviour can vary depending * on the type of component. E.g. a disabled dimension tool will stop creating * dimensions, while a disabled camera will stop moving. A disabled component * will not be updated automatically each frame. */ abstract enabled: boolean; } /** * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks. */ export declare class Components implements Disposable_2 { /** * The version of the @thatopen/components library. */ static readonly release = "2.4.3"; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * The list of components created in this app. * The keys are UUIDs and the values are instances of the components. */ readonly list: DataMap_2; /** * If disabled, the animation loop will be stopped. * Default value is false. */ enabled: boolean; private _clock; /** * Event that triggers the Components instance is initialized. * * @remarks * This event is triggered once when the {@link Components.init} method has been called and finish processing. * This is useful to set configuration placeholders that need to be executed when the components instance is initialized. * For example, enabling and configuring custom effects in a post-production renderer. * * @example * ```typescript * const components = new Components(); * components.onInit.add(() => { * // Enable custom effects in the post-production renderer * // or any other operation dependant on the component initialization * }); * components.init(); * ``` */ readonly onInit: Event_2; /** * Adds a component to the list of components. * Throws an error if a component with the same UUID already exists. * * @param uuid - The unique identifier of the component. * @param instance - The instance of the component to be added. * * @throws Will throw an error if a component with the same UUID already exists. */ add(uuid: string, instance: Component): void; /** * Retrieves a component instance by its constructor function. * If the component does not exist in the list, it will be created and added. * * @template U - The type of the component to retrieve. * @param Component - The constructor function of the component to retrieve. * * @returns The instance of the requested component. * * @throws Will throw an error if a component with the same UUID already exists. */ get(Component: new (components: Components) => U): U; constructor(); /** * Initializes the Components instance. * This method starts the animation loop, sets the enabled flag to true, * and calls the update method. */ init(): void; /** * Disposes the memory of all the components and tools of this instance of * the library. A memory leak will be created if: * * - An instance of the library ends up out of scope and this function isn't * called. This is especially relevant in Single Page Applications (React, * Angular, Vue, etc). * * - Any of the objects of this instance (meshes, geometries,materials, etc) is * referenced by a reference type (object or array). * * You can learn more about how Three.js handles memory leaks * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). * */ dispose(): void; private update; private static setupBVH; } /** * Computes a local-to-world transformation matrix that maps a technical * drawing's local coordinate system onto a target plane in 3D world space. * * Given three point pairs — each pair being a point on the drawing (local * space) and its corresponding point in the 3D world — the function returns * the `THREE.Matrix4` that, when applied to the drawing's container, will * align the drawing to the target plane. * * The transformation encodes **translation**, **rotation**, and **uniform * scale** (derived from the ratio of world vs drawing distances between the * first pair of points, which handles unit mismatches such as mm vs m). * * @throws If either set of points is collinear (cannot define a plane). * @throws If either set contains a degenerate first pair (zero distance). * * @param drawingPoints - Three non-collinear points in drawing local space. * @param worldPoints - Three corresponding non-collinear points in world space. */ export declare function computeAlignmentMatrix(drawingPoints: THREE.Vector3[], worldPoints: THREE.Vector3[]): THREE.Matrix4; /** * Returns the angle in radians between the two rays defined by the dimension. * Result is in [0, π]. */ export declare function computeAngle(dim: AngleAnnotation): number; /** * Returns the angle (in radians, in the XZ plane) of the bisector ray between * the two measured rays. Useful for positioning the text label. */ export declare function computeBisectorAngle(dim: AngleAnnotation): number; /** * Computes the signed offset from a cursor position to the measurement axis * defined by the first and last points. * * The offset is measured perpendicular to the `(points[0] → points[last])` * direction, which is the direction along the measured lines (lineDir). */ export declare function computeOffset(points: THREE.Vector3[], cursor: THREE.Vector3): number; /** * A tool to manage all the configuration from the app centrally. 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ConfigManager). */ export declare class ConfigManager extends Component { /** * The list of all configurations of this app. */ list: DataMap_2>; /** {@link Component.enabled} */ enabled: boolean; /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "b8c764e0-6b24-4e77-9a32-35fa728ee5b4"; constructor(components: Components); } /** * Whether this component supports to be configured. */ export declare interface Configurable { /** Wether this components has been already configured. */ isSetup: boolean; /** Use the provided configuration to set up the tool. */ setup: (config?: Partial) => void | Promise; /** Fired after successfully calling {@link Configurable.setup()} */ readonly onSetup: Event_2; /** Object holding the tool configuration. You can edit this directly to change the object. */ config: Required; } export declare abstract class Configurator { protected abstract _config: U; protected _component: T; name: string; uuid: string; get controls(): U; constructor(component: T, components: Components, name: string, uuid?: string); set(data: Partial): void; export(controls?: ControlsSchema, exported?: any): any; import(exported: any, imported?: any, first?: boolean): void; } export declare type ControlEntry = BooleanSettingsControl | ColorSettingsControl | TextSettingsControl | NumberSettingControl | SelectSettingControl | Vector3SettingControl | TextSetSettingControl | NoControl; export declare interface ControlsSchema { [name: string]: ControlEntry | ControlsSchema; } export declare class ControlsUtils { static isEntry(item: any): boolean; static copySchema(schema: T, copy?: ControlsSchema): T; static copyEntry(controlEntry: ControlEntry): ControlEntry; } /** * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions. */ export declare interface Createable { /** Creates a new instance of an element (e.g. a new Dimension). */ create: (data: any) => void; /** * Finish the creation process of the component, successfully creating an * instance of whatever the component creates. */ endCreation?: (data: any) => void; /** * Cancels the creation process of the component, going back to the state * before starting to create. */ cancelCreation?: (data: any) => void; /** Deletes an existing instance of an element (e.g. a Dimension). */ delete: (data: any) => void; } /** * Configuration options for creating views from bounding boxes. */ export declare interface CreateElevationViewsConfig { /** * Determines whether to combine all models into a single bounding box. If `true`, a single bounding box will be created from all models. If `false`, each model will be treated separately. Defaults to `false`. */ combine?: boolean; /** * An optional array of regular expressions to match model IDs. If not provided, all models will be used. */ modelIds?: RegExp[]; /** * Optional world instance to use when creating the view. If not set, the component's default world will be used. */ world?: World; /** * A callback function to generate names for the views based on the model ID. Defaults to a function that generates names in the format: `: Front`, `: Back`, `: Left`, `: Right`. */ namingCallback?: (modelId: string) => { front: string; back: string; left: string; right: string; }; } /** * Configuration options for creating views from a plane. */ export declare interface CreateViewConfig { /** * Optional identifier for the view. If not provided, a random ID will be generated. */ id?: string; /** * Optional world instance to use when creating the view. If not set, the component's default world will be used. */ world?: World; } /** * Configuration options for creating a view from IFC storeys. */ export declare interface CreateViewFromIfcStoreysConfig { /** * An optional array of regular expressions to match model IDs. If not provided, all models will be used. */ modelIds?: RegExp[]; /** * An optional array of regular expressions to match storey names. If not provided, all storeys will be used. */ storeyNames?: RegExp[]; /** * An optional offset value to displace the storey plane upward. Defaults to `0.25`. */ offset?: number; /** * Optional world instance to use when creating the view. If not set, the component's default world will be used. */ world?: World; } /** * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations. * * @template K - The type of keys in the map. * @template V - The type of values in the map. */ export declare class DataMap extends Map { /** * An event triggered when a new item is set in the map. */ readonly onItemSet: Event_2<{ key: K; value: V; }>; /** * An event triggered when an existing item in the map is updated. */ readonly onItemUpdated: Event_2<{ key: K; value: V; }>; /** * An event triggered when an item is deleted from the map. */ readonly onItemDeleted: Event_2; /** * An event triggered when the map is cleared. */ readonly onCleared: Event_2; /** * Constructs a new DataMap instance. * * @param iterable - An iterable object containing key-value pairs to populate the map. */ constructor(iterable?: Iterable | null | undefined); /** * Clears the map and triggers the onCleared event. */ clear(): void; /** * Sets the value for the specified key in the map. * If the item is new, then onItemSet is triggered. * If the item is already in the map, then onItemUpdated is triggered. * * @param key - The key of the item to set. * @param value - The value of the item to set. * @returns The DataMap instance. */ set(key: K, value: V): this; /** * Sets the value in the map with a randomly generated uuidv4 key. * Only use this if your keys are strings * * @param value - The value of the item to set. * @returns The key used. */ add(value: V): K; /** * A function that acts as a guard for adding items to the set. * It determines whether a given value should be allowed to be added to the set. * * @param key - The key of the entry to be checked against the guard. * @param value - The value of the entry to be checked against the guard. * @returns A boolean indicating whether the value should be allowed to be added to the set. * By default, this function always returns true, allowing all values to be added. * You can override this behavior by providing a custom implementation. */ guard: (key: K, value: V) => boolean; /** * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found. * * @param key - The key of the item to delete. * @returns True if the key was found and deleted; otherwise, false. */ delete(key: K): boolean; /** * Clears the map and resets the events. */ dispose(): void; } /** * A class that extends the built-in Set class and provides additional functionality. It triggers events when items are added, deleted, or the set is cleared. * * @template T - The type of elements in the set. */ export declare class DataSet extends Set { /** * An event that is triggered when a new item is added to the set. */ readonly onItemAdded: Event_2; /** * An event that is triggered when an item is deleted from the set. */ readonly onItemDeleted: Event_2; /** * An event that is triggered when the set is cleared. */ readonly onCleared: Event_2; /** * Constructs a new instance of the DataSet class. * * @param iterable - An optional iterable object to initialize the set with. */ constructor(iterable?: Iterable | null); /** * Clears the set and triggers the onCleared event. */ clear(): void; /** * Adds one or multiple values to the set and triggers the onItemAdded event per each. * * @param value - The value to add to the set. * @returns - The set instance. */ add(...value: T[]): this; /** * A function that acts as a guard for adding items to the set. * It determines whether a given value should be allowed to be added to the set. * * @param value - The value to be checked against the guard. * @returns A boolean indicating whether the value should be allowed to be added to the set. * By default, this function always returns true, allowing all values to be added. * You can override this behavior by providing a custom implementation. */ guard: (value: T) => boolean; /** * Deletes a value from the set and triggers the onItemDeleted event. * * @param value - The value to delete from the set. * @returns - True if the value was successfully deleted, false otherwise. */ delete(value: T): boolean; /** * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events. */ dispose(): void; } /** * Diagonal slash tick (architectural style). * A single line crossing the dimension endpoint at 45° relative to the * dimension line direction. */ export declare const DiagonalTick: LineTickBuilder; /** * Defines how a measured value (in drawing-space metres) is converted to a * display string. Pass one of the {@link Units} presets or build your own. * * ```ts * dims.styles.get("default")!.unit = OBC.Units.cm; * ``` */ export declare interface DimensionUnit { /** Multiplier applied to the raw metre value before display. */ factor: number; /** Label appended to the formatted number (e.g. `"cm"`, `"mm"`, `"ft"`). */ suffix: string; } declare class DirectionalLightConfig { private _list; private _scene; constructor(list: SimpleSceneConfigType, scene: SimpleScene); get color(): THREE.Color; set color(value: THREE.Color); get intensity(): number; set intensity(value: number); get position(): THREE.Vector3; set position(value: THREE.Vector3); } /** * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up. */ declare interface Disposable_2 { /** * Destroys the object from memory to prevent a * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). */ dispose: () => void | Promise; /** Fired after the tool has been disposed. */ readonly onDisposed: Event_2; } export { Disposable_2 as Disposable } /** * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Disposer). */ export declare class Disposer extends Component { private _disposedComponents; /** {@link Component.enabled} */ enabled: boolean; /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe"; constructor(components: Components); /** * Return the UUIDs of all disposed components. */ get(): Set; /** * Removes a mesh, its geometry and its materials from memory. If you are * using any of these in other parts of the application, make sure that you * remove them from the mesh before disposing it. * * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D) * to remove. * * @param materials - whether to dispose the materials of the mesh. * * @param recursive - whether to recursively dispose the children of the mesh. */ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void; /** * Disposes a geometry from memory. * * @param geometry - the * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry) * to remove. */ disposeGeometry(geometry: THREE.BufferGeometry): void; private disposeGeometryAndMaterials; private disposeChildren; private static disposeMaterial; } /** * A base renderer to determine visibility on screen. */ declare class DistanceRenderer { /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * Fires after making the visibility check to the meshes. It lists the * meshes that are currently visible, and the ones that were visible * just before but not anymore. */ readonly onDistanceComputed: Event_2; /** * Objects that won't be taken into account in the distance check. */ excludedObjects: Set>; /** * Whether this renderer is active or not. If not, it won't render anything. */ enabled: boolean; /** * Render the internal scene used to determine the object visibility. Used * for debugging purposes. */ renderDebugFrame: boolean; /** The components instance to which this renderer belongs. */ components: Components; /** * The scene where the distance is computed. */ scene: THREE.Scene; /** * The camera used to compute the distance. */ camera: THREE.OrthographicCamera; /** * The material used to compute the distance. */ depthMaterial: THREE.ShaderMaterial; /** The world instance to which this renderer belongs. */ readonly world: World; protected readonly worker: Worker; private _width; private _height; private readonly _postQuad; private readonly tempRT; private readonly resultRT; private readonly bufferSize; private readonly _buffer; protected _isWorkerBusy: boolean; constructor(components: Components, world: World); /** {@link Disposable.dispose} */ dispose(): void; /** * The function that the culler uses to reprocess the scene. Generally it's * better to call needsUpdate, but you can also call this to force it. * @param force if true, it will refresh the scene even if needsUpdate is * not true. */ compute: () => Promise; private handleWorkerMessage; } export declare interface DocumentReference { type: "internal" | "external"; description?: string; } /** * Dot tick — a small circle drawn with line segments at the endpoint. * Standard ISO tick for radius and diameter dimensions. * The circle is centred on the endpoint and independent of line direction. */ export declare const DotTick: LineTickBuilder; /** * Flat annotation store for a {@link TechnicalDrawing}, keyed by UUID. * * Each entry bundles the owning system, the data, and the Three.js group — * so a single `drawing.annotations.get(uuid)` gives full access to all three. * * Systems write here when they create or update annotations; consumers read * from here or subscribe to system-level events (`onCommit`, `onDelete`). * * ```ts * // Get everything for a known UUID * const { system, data, three } = drawing.annotations.get(uuid)!; * * // Iterate all annotations owned by a specific system * for (const [uuid, dim] of drawing.annotations.getBySystem(dims)) { ... } * ``` */ export declare class DrawingAnnotations extends FRAGS.DataMap { /** * Returns a snapshot map of `uuid → item` for all annotations owned by * `system` on this drawing. Filters the flat store by system identity. * * The returned `Map` is a snapshot — it does not update reactively. * Subscribe to system events (`onCommit`, `onDelete`, `onUpdate`) for * reactive updates. */ /** * Returns a snapshot map of `uuid → item` for all annotations owned by * `system` on this drawing. TypeScript infers the item type from the * system's `_item` declaration marker, avoiding DataMap event variance issues. */ getBySystem(system: { readonly _item: T; }): Map; } /** * Result of a successful raycast against a {@link TechnicalDrawing}. * The `point` is in the drawing's **local coordinate space** (XZ plane, Y = 0). */ export declare interface DrawingIntersection { /** Hit position in drawing local space (X right, Z down-screen, Y = 0). */ point: THREE.Vector3; /** The Three.js object that was intersected (e.g. a LineSegments). */ object: THREE.Object3D; /** * The viewport whose camera was used for the raycast, or `null` when the * pick originated from a world-space camera (e.g. the 3D viewer). */ viewport: DrawingViewport | null; /** * The specific line segment that was hit, expressed as a `THREE.Line3` * in drawing local space. `null` when the hit object is not a LineSegments. */ line: THREE.Line3 | null; } /** * A named organizational layer on a {@link TechnicalDrawing}. * Mirrors the layer concept in CAD applications (AutoCAD, DXF, etc.). */ export declare interface DrawingLayer { /** Unique name identifying this layer. */ name: string; /** Whether objects on this layer are visible. Defaults to `true`. */ visible: boolean; /** * Material applied to all projection `LineSegments` on this layer. * All objects on the same layer share this instance, so mutating it * (e.g. via {@link DrawingLayers.setColor}) is reflected immediately * without any traversal. Use {@link DrawingLayers.setMaterial} to * swap the instance entirely. * * Annotation systems always use their own style material — this field * does not affect them. */ material: THREE.LineBasicMaterial; } /** * Manages the named layers of a {@link TechnicalDrawing}. * * Accessible via `drawing.layers`. Each layer owns a `THREE.LineBasicMaterial` * that is shared across all projection `LineSegments` assigned to it — * mutating the material (e.g. via {@link setColor}) is reflected on every line * immediately without any scene traversal. Annotation systems always use their * own style material and are not affected by layer materials. * * Extends `DataMap` so consumers get reactive events * (`onItemSet`, `onItemDeleted`, …) directly on `drawing.layers`. * * Layer `"0"` always exists and cannot be removed. * * ```ts * drawing.layers.create("walls", { material: new THREE.LineBasicMaterial({ color: 0x333333 }) }); * drawing.layers.setColor("walls", 0x888888); * drawing.layers.setVisibility("walls", false); * ``` */ export declare class DrawingLayers extends FRAGS.DataMap { private readonly _container; constructor(container: THREE.Group); /** * Creates a new layer. If a layer with the same name already exists, returns * the existing one without modifying it. * * @param name - Unique layer name. * @param options - Optional material and visibility. If no material is given, * a default black `LineBasicMaterial` is created. Visibility defaults to `true`. * @returns The (possibly pre-existing) layer object. */ create(name: string, options?: { material?: THREE.LineBasicMaterial; visible?: boolean; }): DrawingLayer; /** * Updates the color of a layer's material and fires reactive events. * * Because all `LineSegments` on the same layer share the same material * instance, the change is reflected immediately on all of them — no scene * traversal is required. * * Does nothing if the layer does not exist. * * @param name - Layer name. * @param color - Hex color (e.g. `0xff0000`). */ setColor(name: string, color: number): void; /** * Replaces the material of a layer and updates all `LineSegments` currently * assigned to it. The previous material is disposed. * * Does nothing if the layer does not exist. * * @param name - Layer name. * @param material - New material to assign. */ setMaterial(name: string, material: THREE.LineBasicMaterial): void; /** * Shows or hides all objects assigned to the given layer. * * Does nothing if the layer does not exist. * * @param name - Layer name. * @param visible - `true` to show, `false` to hide. */ setVisibility(name: string, visible: boolean): void; /** * Assigns an object to a named layer, applies the layer's material (if the * object is a `LineSegments`), and immediately reflects the layer's current * visibility state. * * Use this instead of setting `object.userData.layer` directly so that * the material and visibility are always in sync at insertion time. * * Does nothing if the layer does not exist. * * @param object - The Three.js object to assign. * @param name - Layer name. */ assign(object: THREE.Object3D, name: string): void; /* Excluded from this release type: resolveColor */ } /** * Minimal interface consumed by {@link TechnicalDrawingHelper}. * Satisfied by {@link TechnicalDrawing} without a direct import. */ declare interface DrawingProjectionSource { far: number; } /** * "Type bag" descriptor that fully parameterises an annotation system. * Each system declares a concrete interface extending this. * * ```ts * interface LinearAnnotationSystem extends DrawingSystemDescriptor { * item: LinearAnnotation; * data: LinearAnnotationData; * style: LinearAnnotationStyle; * handle: "pointA" | "pointB" | "offset"; * } * class LinearAnnotations extends AnnotationSystem { ... } * ``` */ export declare interface DrawingSystemDescriptor { item: { uuid: string; style: string; }; data: object; style: BaseAnnotationStyle; handle: string; } /** * Represents a framed orthographic window into a {@link TechnicalDrawing}. * * The viewport lives in the drawing's local coordinate system (XZ plane, Y = 0). * Its {@link camera} must be added as a child of the drawing's container so that * any world-space transform applied to the container automatically moves the camera. * * The camera uses **layer 1** exclusively, so only geometry explicitly assigned * to layer 1 (projection lines, dimensions) is visible in paper-space renders. * * Local coordinate convention: * - X right → world +X * - Y up (screen) → world -Z * - Normal (out of plane) → world +Y */ export declare class DrawingViewport { /** Unique identifier for this viewport instance. */ readonly uuid: string; /** Human-readable label for this viewport. */ name: string; /** * The Three.js orthographic camera for this viewport. * Add it to the drawing container via {@link DrawingViewports.add}. */ readonly camera: THREE.OrthographicCamera; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; private _left; private _right; private _top; private _bottom; private _drawingScale; private _container; private _helper; private _helperVisible; get left(): number; set left(value: number); get right(): number; set right(value: number); get top(): number; set top(value: number); get bottom(): number; set bottom(value: number); /** Drawing scale denominator (e.g. 100 = 1:100). */ get drawingScale(): number; set drawingScale(value: number); /** * The {@link DrawingViewportHelper} for this viewport. * * The helper is created lazily on first access and cached. It is a * `THREE.Group` on layer 0, so it is visible to the perspective camera but * invisible to the viewport's own orthographic camera (layer 1 only). * * Use {@link helperVisible} to attach/detach it to the drawing container * automatically, or manage it manually with `drawing.three.add/remove`. */ get helper(): DrawingViewportHelper; /** * Shows or hides the {@link DrawingViewportHelper} by attaching it to or * removing it from the drawing's container group. * * Setting this to `true` before the viewport has been registered via * `DrawingViewports.add()` has no effect until registration occurs. */ get helperVisible(): boolean; set helperVisible(value: boolean); /** * Axis-aligned bounding box of this viewport in world drawing space (Y = 0). * Used by {@link clipLine} and PDF/DXF exporters. * * Because screen-up = world −Z, the world Z range visible to the camera is * [−top, −bottom], not [bottom, top]. */ get bbox(): THREE.Box3; /** Viewport size in millimetres (based on local units × 1000). */ get size(): THREE.Vector2; /** Local X axis direction (world +X). */ get localXAxis(): THREE.Vector3; /** Local Y axis direction (world -Z). */ get localYAxis(): THREE.Vector3; /** Drawing plane normal (world +Y). */ get normal(): THREE.Vector3; constructor(config: DrawingViewportConfig); /* Excluded from this release type: setContainer */ /** * Clips a line segment to this viewport's bounding box. * Returns `null` when the line is entirely outside the viewport. */ clipLine(line: THREE.Line3): THREE.Line3 | null; /** Destroys this viewport. The camera must be removed from its parent separately. */ dispose(): void; private get bboxPlanes(); private getPlaneIntersections; } /** * Configuration to create a {@link DrawingViewport}. */ export declare interface DrawingViewportConfig { /** Left bound of the viewport in local drawing units. */ left: number; /** Right bound of the viewport in local drawing units. */ right: number; /** * Top bound of the viewport in local drawing units. * Maps to world -Z (screen Y up = local -Z). */ top: number; /** * Bottom bound of the viewport in local drawing units. * Maps to world +Z (screen Y down = local +Z). */ bottom: number; /** * Drawing scale denominator (e.g. 100 means 1:100). * Defaults to 100. */ scale?: number; /** Human-readable label for this viewport. Defaults to an empty string. */ name?: string; } /** * Visualises the bounds of a `DrawingViewport` as a rectangle in the 3D scene. * * Works exactly like the built-in Three.js helpers (e.g. `THREE.CameraHelper`): * the result is a plain `THREE.Group` you can add wherever you like in the scene * graph. It renders on **layer 0**, so it is visible to the perspective camera * but invisible to the viewport's own orthographic camera (which only renders * layer 1). * * Typically you do not construct this directly — use * `DrawingViewport.helperVisible = true` instead, which attaches the helper to * the drawing container automatically. * * When {@link editable} is `true`, two kinds of interaction are enabled: * * - **Resize** — hover one of the eight handle spheres (corners + edge midpoints) * and drag to resize the viewport in that direction. * - **Move** — hover the border rectangle itself and drag to translate the * entire viewport while keeping its width and height constant. * * In both cases the border and the hovered element turn orange as visual * feedback, and {@link isDragging} becomes `true` for the duration of the drag. * * The class contains no browser API references and is safe in Node.js * environments; the consumer forwards events: * * ```ts * container.addEventListener("mousemove", (e) => { * raycaster.setFromCamera(getNDC(e), camera); * viewport.helper.onPointerMove(raycaster.ray); * }); * container.addEventListener("mousedown", (e) => { * raycaster.setFromCamera(getNDC(e), camera); * viewport.helper.onPointerDown(raycaster.ray); * }); * container.addEventListener("mouseup", () => viewport.helper.onPointerUp()); * ``` */ export declare class DrawingViewportHelper extends THREE.Group { private readonly _viewport; private readonly _border; private readonly _handles; private readonly _raycaster; private _resizable; private _movable; private _dragHandle; private _dragConstraints; private _hoveredHandle; private _moveDrag; private _hoveringBorder; private readonly _normalMat; private readonly _hoverMat; private readonly _borderMat; private static readonly _BORDER_COLOR; private static readonly _BORDER_HOVER_COLOR; private static readonly _LINE_THRESHOLD; private static readonly _HANDLE_DEFS; /** * When `true`, the eight handle spheres are shown and resize drag is enabled. */ get resizable(): boolean; set resizable(value: boolean); /** * When `true`, hovering and dragging the border rectangle translates the * entire viewport while keeping its width and height constant. */ get movable(): boolean; set movable(value: boolean); /** `true` while either a resize or a move drag is in progress. */ get isDragging(): boolean; constructor(viewport: ViewportBoundsController); /** * Rebuilds the border geometry and repositions all handles to match the * current viewport bounds. Called automatically by the viewport whenever * any bound changes; you rarely need to call this yourself. */ update(): void; /** * Forward `mousemove` events here. * * - **Resize drag active**: updates the bound(s) controlled by the active handle. * - **Move drag active**: translates all four bounds by the cursor delta, * preserving the viewport's width and height. * - **No drag**: highlights handles on hover; highlights the border when the * cursor is over it and no handle is hovered. * * @param ray - World-space ray, e.g. from `THREE.Raycaster.setFromCamera`. */ onPointerMove(ray: THREE.Ray): void; /** * Forward `mousedown` events here. * * - If a handle is hovered, begins a **resize drag**. * - If the border is hovered (and no handle), begins a **move drag**. * * @param ray - World-space ray at the moment of the press. */ onPointerDown(ray: THREE.Ray): void; /** Forward `mouseup` events here to end any active drag. */ onPointerUp(): void; /** Releases all Three.js geometry and material resources. */ dispose(): void; /** * Projects a world-space ray onto this group's local Y = 0 plane and * returns the intersection in local coordinates. */ private _projectToLocal; /** Toggles the border hover colour and keeps `_hoveringBorder` in sync. */ private _setBorderHover; } /** * Manages the viewports of a {@link TechnicalDrawing}. * * Accessible via `drawing.viewports`. Extends `DataMap` so consumers get * reactive events (`onItemSet`, `onBeforeDelete`, …) for free. * * ```ts * const vp = drawing.viewports.create({ left: -1, right: 5, top: 1, bottom: -4 }); * drawing.viewports.delete(vp.uuid); // disposes and removes * ``` */ export declare class DrawingViewports extends FRAGS.DataMap { private readonly _container; constructor(container: THREE.Group); /** * Creates a new {@link DrawingViewport}, adds its camera to the drawing * container, and registers it. * * @param config - Bounds and scale for the new viewport. * @returns The newly created viewport. */ create(config: DrawingViewportConfig): DrawingViewport; } /** One drawing with one or more viewport placements to export. */ export declare interface DxfDrawingEntry { drawing: TechnicalDrawing; viewports: DxfViewportEntry[]; } /** * Serializes {@link TechnicalDrawing} content to DXF format (AC1015 / AutoCAD R2000). * * Used through {@link DxfManager}: * ```ts * const dxf = components.get(OBC.DxfManager).exporter.export([ * { drawing, viewports: [{ viewport, x: 10, y: 10 }] }, * ], { widthMm: 420, heightMm: 297, margin: 10 }); * ``` */ export declare class DxfExporter { private readonly _components; /** Decimal places used when formatting measurement text in DXF. */ precision: number; /** * Export configuration options. * - `trueColor` — when `true`, upgrades the output to AC1018 (AutoCAD 2004+) and * emits group code 420 (RGB true color) alongside group code 62 (ACI) on every * entity. Modern viewers prioritize 420; older apps fall back to 62. * Note: the adaptive black/white behavior of ACI 7 is lost when true color is on, * since viewers treat the explicit RGB as fixed. Defaults to `false`. */ config: { trueColor: boolean; }; private _viewport; private _paperSlot; private readonly _annotationLayers; private readonly _systemExporters; constructor(_components: Components); /** * Registers a custom DXF exporter for a {@link DrawingSystem} subclass. */ registerSystemExporter>(SystemClass: new (...args: any[]) => T, handler: (sys: T, ctx: DxfWriteContext) => void): void; /** * Serializes one or more drawings to a DXF string. * * When `paper` is supplied the output uses millimetres (INSUNITS=4) and * each viewport is placed at its (`x`, `y`) position on the sheet. * Without `paper` the output uses world units (INSUNITS=6). * * @param entries - Drawings with their viewport placements. * @param paper - Optional paper sheet dimensions for paper-space export. */ export(entries: DxfDrawingEntry[], paper?: DxfPaperOptions): string; private _writeHeader; private _writeTables; private _writeBlocks; private _writeBlock; /** Writes a rectangular border for the active viewport (no-op when no viewport is set). */ private _writeViewportBorder; /** * Writes drawing-area and full-sheet border rectangles in paper-space coordinates. * Origin (0, 0) is the top-left corner of the drawing area (inside margins). */ private _writePaperBorders; private _writeObjects; private _writeRawLines; private _writeLinearAnnotations; private _writeAngleAnnotations; private _writeLeaderAnnotations; private _writeSlopeAnnotations; private _writeCalloutAnnotations; private _writeBlockInsertions; private _writeGeoAsLines; private _writePairsAsLines; private _emitTrueColor; private _writeLine; /** Writes a LINE entity with coordinates already in DXF space (no transform applied). */ private _writeRawLine; /** * Writes a single triangle as a DXF SOLID entity. * Coordinates are in drawing local space (XZ plane) — transform is applied internally. * The 4th vertex equals the 3rd (degenerate quad = triangle). */ private _writeSolid; /** * Writes a flat XYZ triangle array (9 values per triangle, XZ plane) as SOLID entities. * Matches the output format of {@link MeshTickBuilder}. */ private _writeMeshTriangles; private _writeText; /** Maps world X to DXF X. In paper-space, output is in mm from the drawing area origin. */ private _tx; /** * Maps world Z to DXF Y. * In paper-space, output is in mm from the drawing area bottom (DXF Y-up). * In world-space mode, uses Y-down convention (Y=0 at viewport top). */ private _ty; /** Returns the coordinate scale factor: mm-per-world-unit in paper mode, 1 otherwise. */ private _scale; private _clipSegment; private _inViewport; private _bboxFromPositions; private _fullyInViewport; private _textAngle; private _writeCustomSystems; private _makeContext; } /** * Manages DXF import and export for technical drawings. * * ```ts * const manager = components.get(OBC.DxfManager); * const dxf = manager.exporter.export([{ drawing, viewports: [{ viewport }] }]); * ``` */ export declare class DxfManager extends Component { static readonly uuid: "e9a2c3d4-5f67-4b89-a012-1c3d5e7f9b2a"; enabled: boolean; /** Handles DXF serialisation of {@link TechnicalDrawing} content. */ readonly exporter: DxfExporter; constructor(components: Components); } /** Paper sheet dimensions for paper-space export. */ export declare interface DxfPaperOptions { /** Total paper width in mm. */ widthMm: number; /** Total paper height in mm. */ heightMm: number; /** Uniform margin in mm. */ margin: number; } /** Optional text formatting overrides for {@link DxfWriteContext.writeText}. */ export declare interface DxfTextOptions { layer?: string; aciColor?: number; rotDeg?: number; hAlign?: 0 | 1 | 2; } /** One viewport placement within a drawing entry. */ export declare interface DxfViewportEntry { /** Viewport to clip and transform against. If omitted, exports the full drawing. */ viewport?: DrawingViewport; /** Horizontal position in mm from the top-left of the drawing area (paper-space only). */ x?: number; /** Vertical position in mm from the top-left of the drawing area (paper-space only). */ y?: number; } /** * Write-context passed to custom system exporters registered via * {@link DxfExporter.registerSystemExporter}. */ export declare interface DxfWriteContext { writeLine(x1: number, y1: number, x2: number, y2: number, layer?: string, aciColor?: number): void; writePairs(positions: ArrayLike, layer?: string, aciColor?: number): void; writeText(text: string, x: number, y: number, height: number, options?: DxfTextOptions): void; /** Writes a flat XYZ triangle array (9 values per triangle) as DXF SOLID entities. */ writeMeshTriangles(triangles: number[], layer?: string, aciColor?: number): void; hexToAci(hex: number): number; textAngle(dx: number, dz: number): number; } /** * Result of an edge projection, containing visible/hidden geometries * and a mapping from group indices to model item identifiers. */ export declare interface EdgeProjectionResult { /** Line segment geometry for visible edges. Has a `group` vertex attribute with group indices. */ visible: THREE.BufferGeometry; /** Line segment geometry for hidden edges. Has a `group` vertex attribute with group indices. */ hidden: THREE.BufferGeometry; /** Maps group index to `{ modelId, localId }` identifying the source item. */ groups: Record; } /** * Component that generates 2D edge projections from fragment model items. * It takes a ModelIdMap, converts items to meshes, and runs them through * the three-edge-projection library to produce visible/hidden line segment geometries. */ export declare class EdgeProjector extends Component implements Disposable_2 { static readonly uuid: "f2e76c3a-8b1d-4d5e-9a3f-7c6b2d4e8f1a"; enabled: boolean; readonly onDisposed: Event_2; /** * The underlying ProjectionGenerator from three-edge-projection. * You can configure angleThreshold, iterationTime, includeIntersectionEdges, and useWebGPU. */ readonly generator: any; /** * Resolution of the visibility culler in pixels per meter. * Higher values = more accurate occlusion but slower culling. */ cullerPixelsPerMeter: number; /** * The direction the projector looks along. Meshes are projected onto the plane * perpendicular to this direction. Default is top-down (plan view). * * Common values: * - Top/Plan: `(0, -1, 0)` * - Front: `(0, 0, -1)` * - Back: `(0, 0, 1)` * - Left: `(-1, 0, 0)` * - Right: `(1, 0, 0)` */ readonly projectionDirection: THREE.Vector3; /** * Near clipping plane along the projection direction. * Meshes whose AABB is fully "behind" this plane (closer to the viewer) are excluded. * Set to -Infinity to disable. */ nearPlane: number; /** * Far clipping plane along the projection direction. * Meshes whose AABB is fully "beyond" this plane (farther from the viewer) are excluded. * Set to Infinity to disable. */ farPlane: number; constructor(components: Components); /** * Generates 2D edge projections for the given model items. * * @param modelIdMap - A map of model IDs to sets of local IDs specifying items to project. * @param world - The world whose renderer will be used for visibility culling. * @param config - Optional configuration. * @param config.onProgress - Optional progress callback receiving (message, progress?, collector?). * @returns Visible/hidden geometries with a `group` vertex attribute, and a groups mapping. */ get(modelIdMap: ModelIdMap, world: World, config?: { onProgress?: (message: string, progress?: number) => void; }): Promise; dispose(): void; } /** * Defines a closed shape (cloud, rectangle, circle, etc.) that forms the * body of a callout annotation. * * `buildGeometry` returns flat XYZ triplet pairs suitable for `THREE.LineSegments`. * `getAttachmentPoint` returns the point on the enclosure boundary in the * given direction — needed because non-circular shapes have non-radial boundaries. */ export declare type EnclosureBuilder = { /** Returns flat XYZ line-segment pairs forming the enclosure outline. */ buildGeometry: (center: THREE.Vector3, halfW: number, halfH: number) => number[]; /** * Returns the point on the enclosure boundary in the direction `dir` from * `center`. `dir` is a unit vector in the XZ plane. */ getAttachmentPoint: (center: THREE.Vector3, halfW: number, halfH: number, dir: THREE.Vector3) => THREE.Vector3; }; /** * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to `this`, you will need to declare the callback as an arrow function. */ declare class Event_2 { /** * Whether this event is active or not. If not, it won't trigger. */ enabled: boolean; /** * Add a callback to this event instance. * @param handler - the callback to be added to this event. */ add(handler: T extends void ? { (): void; } : { (data: T): void; }): void; /** * Removes a callback from this event instance. * @param handler - the callback to be removed from this event. */ remove(handler: T extends void ? { (): void; } : { (data: T): void; }): void; /** Triggers all the callbacks assigned to this event. */ trigger: (data?: T) => void; /** Gets rid of all the suscribed events. */ reset(): void; private handlers; } export { Event_2 as Event } /** * Whether it has events or not. */ export declare interface Eventable { /** * The object in charge of managing all the events. */ eventManager: EventManager; } /** * Simple class to easily toggle and reset event lists. */ export declare class EventManager { /** * The list of events managed by this instance. */ list: Set | AsyncEvent>; /** * Adds events to this manager. * @param events the events to add. */ add(events: Iterable | AsyncEvent>): void; /** * Removes events from this manager. * @param events the events to remove. */ remove(events: Iterable | AsyncEvent>): void; /** * Sets all the events managed by this instance as enabled or disabled. * @param active whether to turn on or off the events. */ set(active: boolean): void; /** * Resets all the events managed by this instance. */ reset(): void; } export declare const extensionsImporter: (manager: BCFTopics, extensionsXML: string) => void; export declare interface ExternalDocumentReference extends DocumentReference { type: "external"; url: string; } /** * A fast model picker that uses color coding to identify fragment models under the mouse cursor. This is much faster than raycasting for simple model identification. */ export declare class FastModelPicker implements Disposable_2 { /** {@link Component.enabled} */ enabled: boolean; /** The components instance to which this FastModelPicker belongs. */ components: Components; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** The position of the mouse in the screen. */ readonly mouse: Mouse; /** * A reference to the world instance to which this FastModelPicker belongs. * This is used to access the camera and scene. */ world: World; /** * Whether debug mode is enabled. When enabled, shows the color-coded canvas. */ debugMode: boolean; /** * Map from color (as RGB number) to model ID. * Color is encoded as: (r << 16) | (g << 8) | b */ private colorToModelId; /** * Map from model ID to color. */ private modelIdToColor; /** * Render target for the color-coded scene. */ private renderTarget?; /** * Size of the render target (stored separately since getSize doesn't exist). */ private renderTargetSize; /** * Debug canvas element (shown when debugMode is true). */ private debugCanvas?; /** * Debug container element. */ private debugContainer?; /** * Material used for color-coding models. */ private colorMaterials; /** * Original materials cache (to restore after picking). */ private originalMaterials; private originalLodColors; /** * Whether colors need to be reassigned (when models change). */ private colorsNeedUpdate; constructor(components: Components, world: World); /** * Sets up listeners for fragment model changes. */ private setupFragmentListeners; /** * Sets up the render target for color-coded picking. */ private setupRenderTarget; /** * Sets up the debug canvas for visualization. */ private setupDebugCanvas; /** * Generates a deterministic color for a model based on its ID. * This ensures the same model always gets the same color. */ private generateColorForModel; /** * Converts a color to a numeric ID. */ private colorToId; /** * Assigns unique colors to all fragment models. * Colors are deterministic based on model ID, so the same model always gets the same color. */ private assignColors; /** * Applies color materials to fragment models. */ private applyColorMaterials; /** * Restores original materials to fragment models. */ private restoreOriginalMaterials; /** * Renders the scene with color-coded models. */ private renderColorCoded; /** * Updates the debug canvas with the color-coded render. */ private updateDebugCanvas; /** * Gets the model ID at the given screen position. * * @param position - Optional screen position. If not provided, uses current mouse position. * @returns The model ID at the position, or null if no model is found. */ getModelAt(position?: THREE.Vector2): Promise; /** * Enables or disables debug mode. * When enabled, shows a canvas with the color-coded render. */ setDebugMode(enabled: boolean): void; /** * Removes the debug canvas. */ private removeDebugCanvas; /** {@link Disposable.dispose} */ dispose(): void; } /** * A component that manages a FastModelPicker for each world and automatically disposes it when its corresponding world is disposed. */ export declare class FastModelPickers extends Component implements Disposable_2 { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "4a82430c-7ff2-49ea-9401-60807502dad6"; /** {@link Component.enabled} */ enabled: boolean; /** * A Map that stores FastModelPicker instances for each world. * The key is the world's UUID, and the value is the corresponding FastModelPicker instance. */ list: Map; /** {@link Disposable.onDisposed} */ onDisposed: Event_2; constructor(components: Components); /** * Retrieves a FastModelPicker instance for the given world. * If a FastModelPicker instance already exists for the world, it will be returned. * Otherwise, a new FastModelPicker instance will be created and added to the list. * * @param world - The world for which to retrieve or create a FastModelPicker instance. * @returns The FastModelPicker instance for the given world. */ get(world: World): FastModelPicker; /** * Deletes the FastModelPicker instance associated with the given world. * If a FastModelPicker instance exists for the given world, it will be disposed and removed from the list. * * @param world - The world for which to delete the FastModelPicker instance. * @returns {void} */ delete(world: World): void; /** {@link Disposable.dispose} */ dispose(): void; } /** * Filled arrowhead tick (solid triangle, requires a `THREE.Mesh`). * Use this as `meshTick` on a style — pair with `NoTick` as `tick` if you * want only the filled shape and no line arrowhead. */ export declare const FilledArrowTick: MeshTickBuilder; /** * Filled circle tick (solid disc, requires a `THREE.Mesh`). * The disc is centred on the endpoint and approximated with 16 triangles. */ export declare const FilledCircleTick: MeshTickBuilder; /** * Filled square tick (solid square, requires a `THREE.Mesh`). * The square is centred on the endpoint and oriented along the dimension line. * Common in structural and steel drawings. */ export declare const FilledSquareTick: MeshTickBuilder; /** * Represents a finder query for retrieving items based on specified parameters. This class encapsulates the query logic, caching mechanism, and result management. */ export declare class FinderQuery { name: string; customData: Record; private _components; private _queries; /** * The query parameters used to find items. */ set queries(value: FRAGS.ItemsQueryParams[]); get queries(): FRAGS.ItemsQueryParams[]; private _aggregation; /** * Sets the aggregation value (AND/OR) for the query and resets the cache if the new value differs. */ set aggregation(value: QueryResultAggregation); get aggregation(): QueryResultAggregation; /** * The result of the query, a map of modelIds to localIds. * Null if the query has not been executed or has not been cached. */ readonly result: ModelIdMap | null; /** * Determines whether the query results should be cached. */ cache: boolean; constructor(components: Components, queries: FRAGS.ItemsQueryParams[]); /** * Executes the finder query to retrieve items based on the configured query and optional model IDs. * * @param config - Optional configuration object. * @param config.modelIds - Optional array of model IDs to filter the search. * @param config.force - Optional boolean to force a new search, bypassing the cache. Defaults to `false`. * @returns A promise that resolves to a `ModelIdMap` containing the search results. */ test(config?: QueryTestConfig): Promise; /** * Clears the cached result of the query, forcing a re-evaluation on the next access. */ clearCache(): void; private serializeAttributeQuery; private serializeQueryParameters; /** * Serializes the finder query into a JSON-compatible format. * Converts regular expressions to strings. * * @returns A `SerializedFinderQuery` object representing the serialized query. */ toJSON(): SerializedFinderQuery; private deserializeAttributeQuery; private deserializeQueryParameters; /** * Deserializes a JSON object into a `FinderQuery` instance. * * @param data - A `SerializedFinderQuery` object representing the serialized query. * @returns A `FinderQuery` instance. */ fromJSON(data: SerializedFinderQuery): this; } /** * A {@link NavigationMode} that allows first person navigation, simulating FPS video games. */ export declare class FirstPersonMode implements NavigationMode { private camera; /** {@link NavigationMode.enabled} */ enabled: boolean; /** {@link NavigationMode.id} */ readonly id = "FirstPerson"; constructor(camera: OrthoPerspectiveCamera); /** {@link NavigationMode.set} */ set(active: boolean): void; private setupFirstPersonCamera; } /** * Converts a slope ratio to a human-readable string. * * @param slope - Rise / run ratio (e.g. `0.15` for 15 %). * @param format - Desired output format. * @returns Formatted string, e.g. `"15.00 %"`, `"1:6.67"`, or `"8.53°"`. */ export declare function formatSlope(slope: number, format: SlopeFormat): string; /** * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager). */ export declare class FragmentsManager extends Component implements Disposable_2 { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806"; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; readonly onBeforeDispose: Event_2; /** * Event triggered when fragments are loaded. */ readonly onFragmentsLoaded: Event_2; baseCoordinationModel: string; baseCoordinationMatrix: THREE.Matrix4; /** {@link Component.enabled} */ enabled: boolean; get initialized(): boolean; private _core?; /** * Map containing all loaded fragment models. * The key is the group's unique identifier, and the value is the model itself. */ get list(): FRAGS.DataMap; get core(): FRAGS.FragmentsModels; private get _hasCoordinationModel(); constructor(components: Components); /** {@link Disposable.dispose} */ dispose(): void; init(workerURL: string, options?: { classicWorker?: boolean; }): void; raycast(data: { camera: THREE.PerspectiveCamera | THREE.OrthographicCamera; mouse: THREE.Vector2; dom: HTMLCanvasElement; snappingClasses?: FRAGS.SnappingClass[]; }): Promise; getPositions(items: ModelIdMap): Promise; getBBoxes(items: ModelIdMap): Promise; highlight(style: FRAGS.MaterialDefinition, items?: ModelIdMap): Promise; /** * Retrieves data for specified items from multiple models. * * @param items A map of model IDs to an array of local IDs, specifying which items to retrieve data for. * @param config Optional configuration for data retrieval. * @returns A record mapping model IDs to an array of item data. */ getData(items: ModelIdMap, config?: Partial): Promise>; resetHighlight(items?: ModelIdMap): Promise; private forEachModel; /** * Converts a collection of IFC GUIDs to a fragmentIdMap. * * @param guids - An iterable collection of global IDs to be converted to a fragment ID map. * * @returns A fragment ID map, where the keys are fragment IDs and the values are the corresponding express IDs. */ guidsToModelIdMap(guids: Iterable): Promise; /** * Converts a fragment ID map to a collection of GUIDs. * * @param modelIdMap - A ModelIdMap to be converted to a collection of GUIDs. * * @returns An array of GUIDs. */ modelIdMapToGuids(modelIdMap: ModelIdMap): Promise; /** * Applies the base coordinate system to the provided object. * * This function takes an object and its original coordinate system as input. * It then inverts the original coordinate system and applies the base coordinate system * to the object. This ensures that the object's position, rotation, and scale are * transformed to match the base coordinate system (which is taken from the first model loaded). * * @param object - The object to which the base coordinate system will be applied. * This should be an instance of THREE.Object3D. * * @param originalCoordinateSystem - The original coordinate system of the object. * This should be a THREE.Matrix4 representing the object's transformation matrix. */ applyBaseCoordinateSystem(object: THREE.Object3D | THREE.Vector3, originalCoordinateSystem?: THREE.Matrix4): THREE.Matrix4; } /** * Returns the tip position and inward tangent direction for each tick endpoint * of an angle dimension arc. Used by {@link AngleDimensions} to build * `meshTick` geometry. */ export declare function getAngleTickEndpoints(dim: AngleAnnotation): Array<{ tip: THREE.Vector3; dir: THREE.Vector3; }>; /** * Returns the tip position and inward direction for each tick endpoint of a * linear dimension. Used by {@link LinearDimensions} to build `meshTick` geometry. */ export declare function getDimensionTickEndpoints(dim: LinearAnnotation): Array<{ tip: THREE.Vector3; dir: THREE.Vector3; }>; /** * Returns the tip position of a slope annotation in drawing local space. */ export declare function getSlopeTip(ann: SlopeAnnotation, length: number): THREE.Vector3; /** * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids). */ export declare class Grids extends Component implements Disposable_2 { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489"; /** * A map of world UUIDs to their corresponding grid instances. */ list: Map; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** {@link Component.enabled} */ enabled: boolean; constructor(components: Components); /** * Creates a new grid for the given world. * Throws an error if a grid already exists for the world. * * @param world - The world to create the grid for. * @returns The newly created grid. * * @throws Will throw an error if a grid already exists for the given world. */ create(world: World): SimpleGrid; /** * Deletes the grid associated with the given world. * If a grid does not exist for the given world, this method does nothing. * * @param world - The world for which to delete the grid. * * @remarks * This method will dispose of the grid and remove it from the internal list. * If the world is disposed before calling this method, the grid will be automatically deleted. */ delete(world: World): void; /** {@link Disposable.dispose} */ dispose(): void; } /** * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene). */ export declare interface Hideable { /** * Whether the geometric representation of this component is * currently visible or not in the * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene). */ visible: boolean; } /** * A component that manages visibility of fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider). */ export declare class Hider extends Component { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29"; /** {@link Component.enabled} */ enabled: boolean; constructor(components: Components); /** * Sets the visibility of fragment items within the 3D scene. * If no `modelIdMap` parameter is provided, all fragments will be set to the specified visibility. * If it is provided, only the specified fragment items will be affected. * * @param visible - The visibility state to set for the items. * @param modelIdMap - An optional map of modelIds and their corresponding itemIds to be affected. * If not provided, all fragment items will be affected. */ set(visible: boolean, modelIdMap?: ModelIdMap): Promise; /** * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones. * It calls the `set` method twice: first to hide all fragments, and then to show only the specified ones. * * @param modelIdMap - A map of model IDs and their corresponding itemIds to be isolated. */ isolate(modelIdMap: ModelIdMap): Promise; /** * Toggles the visibility of specified items in the fragments. * * @param modelIdMap - An object where the keys are model IDs and the values are arrays of local IDs representing the fragments to be toggled. * @returns A promise that resolves when all visibility toggles and the core update are complete. */ toggle(modelIdMap: ModelIdMap): Promise; /** * Asynchronously retrieves a map of model IDs to their corresponding item IDs based on visibility state. * * @param state - The visibility state to filter items by. * @param modelIds - Optional array of model IDs to filter the items. If not provided, all models will be considered. * @returns A promise that resolves to a ModelIdMap record where the keys are model IDs and the values are arrays of item IDs that match the visibility state. */ getVisibilityMap(state: boolean, modelIds?: string[]): Promise>; } export declare class IDSAttribute extends IDSFacet { facetType: "Attribute"; name: IDSFacetParameter; value?: IDSFacetParameter; constructor(components: Components, name: IDSFacetParameter); serialize(type: "applicability" | "requirement"): string; getEntities(): Promise; test(items: ModelIdMap, collector: ModelIdDataMap, config?: { skipIfFails: boolean; }): Promise; } export declare interface IDSBoundsParameter { type: "bounds"; parameter: { min?: number; minInclusive?: boolean; max?: number; maxInclusive?: boolean; }; } export declare interface IDSCheck { parameter: IDSFacetParameterName | null; currentValue: any; requiredValue?: IDSFacetParameter | string; pass: boolean; } /** * The result of a check performed by an IDSFacet test. */ export declare type IDSCheckResult = ModelIdDataMap; export declare class IDSClassification extends IDSFacet { facetType: "Classification"; system: IDSFacetParameter; value?: IDSFacetParameter; uri?: string; constructor(components: Components, system: IDSFacetParameter); serialize(type: "applicability" | "requirement"): string; getEntities(_modelIds: RegExp[], _collector: ModelIdMap): Promise; test(_items: ModelIdMap, _collector: ModelIdDataMap): Promise; } export declare type IDSConditionalCardinaltiy = IDSSimpleCardinality | "optional"; export declare class IDSEntity extends IDSFacet { facetType: "Entity"; name: IDSFacetParameter; predefinedType?: IDSFacetParameter; constructor(components: Components, name: IDSFacetParameter); serialize(type: "applicability" | "requirement"): string; getEntities(modelIds: RegExp[], collector: ModelIdMap): Promise; test(items: ModelIdMap, collector: ModelIdDataMap, config: { skipIfFails: boolean; }): Promise; protected evalName(category: string, checks?: IDSCheck[]): Promise; protected evalPredefinedType(modelId: string, itemData: FRAGS.ItemData, checks?: IDSCheck[]): Promise; } export declare interface IDSEnumerationParameter { type: "enumeration"; parameter: string[] | number[] | boolean[]; } export declare abstract class IDSFacet { protected _components: Components; abstract facetType: IDSFacetType; cardinality: IDSSimpleCardinality | IDSConditionalCardinaltiy; instructions?: string; constructor(_components: Components); protected addCheckResult(check: IDSCheck, checks: IDSCheck[]): void; protected evalRequirement: (value: string | number | boolean | null, facetParameter: IDSFacetParameter, parameter: IDSFacetParameterName, checks?: IDSCheck[]) => boolean; protected getItemChecks(collector: ModelIdDataMap, modelId: string, item: FRAGS.ItemData, skipIfFails: boolean): IDSCheck[] | null; /** * Returns the list of expressIDs that pass the criteria of this facet. * @param model - The IFC model to retrieve entities from. * @param collector - An optional object to collect the retrieved entities. * @remarks * If the collector already includes the entity, it won't get processed any further. * * @returns An array of express IDs of the retrieved entities. */ abstract getEntities(modelIds: RegExp[], collector: ModelIdMap): Promise; abstract test(items: ModelIdMap, collector: ModelIdDataMap, config: { skipIfFails: boolean; }): Promise; abstract serialize(type: "applicability" | "requirement"): string; } export declare type IDSFacetParameter = IDSSimpleParameter | IDSRestrictionParameter; export declare type IDSFacetParameterName = "Name" | "PredefinedType" | "Value" | "System" | "URI" | "PropertySet" | "BaseName" | "DataType" | "Value" | "Entity" | "Relation"; export declare type IDSFacetType = "Entity" | "Attribute" | "Property" | "Classification" | "Material" | "PartOf"; export declare interface IDSInfo { title: string; description?: string; copyright?: string; version?: string; author?: string; date?: Date; purpose?: string; milestone?: string; } export declare interface IDSItemCheckResult { guid?: string; pass: boolean; checks: IDSItemFacetCheck[]; } export declare interface IDSItemFacetCheck { facetType: IDSFacetType; cardinality: IDSConditionalCardinaltiy; checks: IDSCheck[]; pass: boolean; } export declare interface IDSLengthParameter { type: "length"; parameter: { min?: number; length?: number; max?: number; }; } export declare class IDSMaterial extends IDSFacet { private _ifcMaterialEntities; facetType: "Material"; value?: IDSFacetParameter; uri?: string; serialize(type: "applicability" | "requirement"): string; getEntities(modelIds: RegExp[], collector: ModelIdMap): Promise; test(items: ModelIdMap, collector: ModelIdDataMap, config?: { skipIfFails: boolean; }): Promise; private hasValidMaterial; private evalValue; } export declare class IDSPartOf extends IDSFacet { facetType: "PartOf"; private _entityFacet; private _entity; set entity(value: { name: IDSFacetParameter; predefinedType?: IDSFacetParameter; }); get entity(): { name: IDSFacetParameter; predefinedType?: IDSFacetParameter; }; relation?: IDSPartOfRelations; cardinality: IDSSimpleCardinality; constructor(components: Components, entity: { name: IDSFacetParameter; predefinedType?: IDSFacetParameter; }); serialize(): string; getEntities(_modelIds: RegExp[], _collector: ModelIdMap): Promise; test(_items: ModelIdMap): Promise; } export declare type IDSPartOfRelations = "IFCRELAGGREGATES" | "IFCRELASSIGNSTOGROUP" | "IFCRELCONTAINEDINSPATIALSTRUCTURE" | "IFCRELNESTS" | "IFCRELVOIDSELEMENT" | "IFCRELFILLSELEMENT"; export declare interface IDSPatternParameter { type: "pattern"; parameter: string; } export declare class IDSProperty extends IDSFacet { facetType: "Property"; propertySet: IDSFacetParameter; baseName: IDSFacetParameter; value?: IDSFacetParameter; dataType?: string; uri?: string; private _unsupportedTypes; constructor(components: Components, propertySet: IDSFacetParameter, baseName: IDSFacetParameter); serialize(type: "applicability" | "requirement"): string; getEntities(modelIds: RegExp[], collector: ModelIdMap): Promise; test(items: ModelIdMap, collector: ModelIdDataMap, config?: { skipIfFails: boolean; }): Promise; private getPropertyListName; private getValueKey; private getTypePsets; private getPsets; private evalValue; private evalDataType; private evalURI; } export declare type IDSRestrictionParameter = IDSEnumerationParameter | IDSPatternParameter | IDSBoundsParameter | IDSLengthParameter; export declare type IDSSimpleCardinality = "required" | "prohibited"; export declare interface IDSSimpleParameter { type: "simple"; parameter: string | number | boolean; } /** * Represents a single specification from the Information Delivery Specification (IDS) standard. * * @remarks This class provides methods for testing a model against the specification, * as well as serializing the specification into XML format. */ export declare class IDSSpecification implements IDSSpecificationData { name: string; ifcVersion: Set; readonly identifier: string; description?: string; instructions?: string; requirementsDescription?: string; applicability: FRAGS.DataSet; requirements: FRAGS.DataSet; protected components: Components; constructor(components: Components, name: string, ifcVersion: IfcVersion[]); set(data: Partial): this; /** * Tests the model to test against the specification's requirements. * * @param modelId - The modelId of the model to be tested. * @returns An array representing the test results. * If no requirements are defined for the specification, an empty array is returned. */ test(modelIds: RegExp[], config?: { skipIfFails: boolean; }): Promise; /** * Serializes the IDSSpecification instance into XML format. * * @remarks This method is not meant to be used directly. It is used by the IDSSpecifications component. * * @returns The XML representation of the IDSSpecification. */ serialize(): string; } export declare interface IDSSpecificationData { name: string; ifcVersion: Set; identifier: string; description?: string; instructions?: string; requirementsDescription?: string; } /** * Component that manages Information Delivery Specification (IDS) data. It provides functionality for importing, exporting, and manipulating IDS data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IDSSpecifications). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IDSSpecifications). */ export declare class IDSSpecifications extends Component { static uuid: "9f0b9f78-9b2e-481a-b766-2fbfd01f342c"; enabled: boolean; static xmlParser: XMLParser; IDSInfo?: IDSInfo; constructor(components: Components); readonly list: DataMap_2; /** * Processes the results of an IDS check and categorizes the items into passing and failing. * * @param result - An `IDSCheckResult` object containing the check results for various model IDs. * @returns An object containing two `ModelIdMap` objects: * - `pass`: A ModelIdMap representing items that passed the check. * - `fail`: A ModelIdMap representing items that failed the check. */ getModelIdMap(result: IDSCheckResult): { pass: ModelIdMap; fail: ModelIdMap; }; /** * Creates a new IDSSpecification instance and adds it to the list. * * @param name - The name of the IDSSpecification. * @param ifcVersion - An array of IfcVersion values that the specification supports. * * @returns The newly created IDSSpecification instance. */ create(name: string, ifcVersion: IfcVersion[], identifier?: string): IDSSpecification; /** * Parses and processes an XML string containing Information Delivery Specification (IDS) data. * It creates IDSSpecification instances based on the parsed data and returns them in an array. * Also, the instances are added to the list array. * * @param data - The XML string to parse. * * @returns An array of IDSSpecification instances created from the parsed data. */ load(data: string): IDSSpecification[]; /** * Exports the IDSSpecifications data into an XML string. * * @param info - The metadata information for the exported XML. * @param specifications - An optional iterable of IDSSpecification instances to export. * If not provided, all specifications in the list will be exported. * * @returns A string containing the exported IDSSpecifications data in XML format. */ export(info: IDSInfo, specifications?: Iterable): string; } /** Configuration of the IFC-fragment conversion. */ export declare class IfcFragmentSettings { /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */ wasm: { path: string; absolute: boolean; logLevel?: WEBIFC.LogLevel; }; /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */ webIfc: WEBIFC.LoaderSettings; /** * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). * If set to true, the path will be set to the default path of the WASM file. * If set to false, the path must be provided manually in the `wasm.path` property. * Default value is true. */ autoSetWasm: boolean; /** * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file. * If set to null, the default file location handler will be used. * * @param url - The URL of the file to locate. * @returns The absolute path of the file. */ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null; } /** * The IfcLoader component is responsible of converting IFC files into Fragments. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader). */ export declare class IfcLoader extends Component implements Disposable_2 { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624"; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * An event triggered when the IFC file starts loading. */ readonly onIfcStartedLoading: Event_2; /** * An event triggered when the IFC importer is initialized. */ readonly onIfcImporterInitialized: Event_2; /** * An event triggered when the setup process is completed. */ readonly onSetup: Event_2; /** * The settings for the IfcLoader. * It includes options for excluding categories, setting WASM paths, and more. */ settings: IfcFragmentSettings; /** * The instance of the Web-IFC library used for handling IFC data. */ webIfc: WEBIFC.IfcAPI; /** {@link Component.enabled} */ enabled: boolean; constructor(components: Components); /** {@link Disposable.dispose} */ dispose(): void; /** * Sets up the IfcLoader component with the provided configuration. * * @param config - Optional configuration settings for the IfcLoader. * If not provided, the existing settings will be used. * * @returns A Promise that resolves when the setup process is completed. * * @remarks * If the `autoSetWasm` option is enabled in the configuration, * the method will automatically set the WASM paths for the Web-IFC library. * * @example * ```typescript * const ifcLoader = new IfcLoader(components); * await ifcLoader.setup({ autoSetWasm: true }); * ``` */ setup(config?: Partial): Promise; /** * Loads an IFC file and processes it for 3D visualization. * * By default, the loader imports a minimal set of attributes and relations * needed for typical visualization workflows. * * **Default attributes** * - Base entities: Project, Site, Building, BuildingStorey * - Materials: IFC material definitions and layers * - Properties: Property Sets, quantities (area, volume, length, etc.) * * **Default relations** * - DefinesByProperties (IsDefinedBy / DefinesOccurrence) * - AssociatesMaterial (HasAssociations / AssociatedTo) * - Aggregates (IsDecomposedBy / Decomposes) * - ContainedInSpatialStructure (ContainsElements / ContainedInStructure) * * If you need *all* attributes or relations to be loaded, you can enable them * via the `instanceCallback`. * * The callback provides direct access to the underlying `IfcImporter`, * allowing advanced configuration before processing begins. * * @param data - The Uint8Array containing the IFC file data. * @param coordinate - Boolean indicating whether to coordinate the loaded IFC data. Default is true. * @param name - Name for the fragments model. * @param config - Optional extra data for loading the IFC. * * @returns A Promise that resolves to the FragmentsModel containing the loaded and processed IFC data. * * @example * // Load all attributes and relations using the instanceCallback * ```ts * const model = await ifcLoader.load(ifcData, true, "modelName", { * instanceCallback: (importer) => { * importer.addAllAttributes(); * importer.addAllRelations(); * }, * }); * ``` * @example * // Default loading (built-in attributes and relations only) * ```typescript * const ifcLoader = components.get(IfcLoader); * const model = await ifcLoader.load(ifcData); * ``` */ load(data: Uint8Array, coordinate: boolean, name: string, config?: { userData?: Record; processData?: Omit; instanceCallback?: (importer: FRAGS.IfcImporter) => void; }): Promise; /** * Reads an IFC file and initializes the Web-IFC library. * * @param data - The Uint8Array containing the IFC file data. * * @returns A Promise that resolves when the IFC file is opened and initialized. * * @remarks * This method sets the WASM path and initializes the Web-IFC library based on the provided settings. * It also opens the IFC model using the provided data and settings. * * @example * ```typescript * const ifcLoader = components.get(IfcLoader); * await ifcLoader.readIfcFile(ifcData); * ``` */ readIfcFile(data: Uint8Array): Promise; /** * Cleans up the IfcLoader component by resetting the Web-IFC library, * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library. * * @remarks * This method is called automatically after using the .load() method, so usually you don't need to use it manually. * * @example * ```typescript * const ifcLoader = components.get(IfcLoader); * ifcLoader.cleanUp(); * ``` */ cleanUp(): void; private autoSetWasm; } export declare type IfcVersion = "IFC2X3" | "IFC4" | "IFC4X3_ADD2"; export declare interface InternalDocumentReference extends DocumentReference { type: "internal"; fileName: string; data: Uint8Array; } /** * Manages and executes queries to find items within models based on specified criteria. This class provides functionalities to create, store, and execute FinderQuery instances, allowing for efficient retrieval of items that match given query parameters. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/ItemsFinder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ItemsFinder). */ export declare class ItemsFinder extends Component implements Serializable { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "0da7ad77-f734-42ca-942f-a074adfd1e3a"; /** {@link Component.enabled} */ enabled: boolean; /** * A map of FinderQuery objects, indexed by a string key. */ readonly list: FRAGS.DataMap; constructor(components: Components); /** * Retrieves items from specified models based on a query. * * @param queries - The query parameters to filter items. * @param modelIds - Optional array of model IDs to include in the search. If not provided, all models are searched. * @returns A map of model IDs to sets of item IDs that match the query. */ getItems(queries: FRAGS.ItemsQueryParams[], config?: { modelIds?: RegExp[]; aggregation?: QueryResultAggregation; items?: ModelIdMap; }): Promise; /** * Creates a new FinderQuery instance and adds it to the list of queries. * * @param name - The name of the query. * @param queries - The queries to use. * @returns The newly created FinderQuery instance. */ create(name: string, queries: FRAGS.ItemsQueryParams[]): FinderQuery; /** * Adds queries based on categories from items that have geometry. * * @param modelIds - An optional array of model IDs to filter fragments. If not provided, all fragments are processed. * @returns An array with the categories used to create the queries */ addFromCategories(modelIds?: RegExp[]): Promise; /** * Imports a list of `FinderQuery` instances from a `SerializationResult` containing serialized finder query data. * * @param result - The `SerializationResult` containing the serialized `SerializedFinderQuery` data. * @returns An array of `FinderQuery` instances created from the serialized data. Returns an empty array if the input data is null or undefined. */ import(result: SerializationResult): FinderQuery[]; /** * Serializes the ItemsFinder's data into a format suitable for export. * * @returns An object containing an array of serialized finder queries. */ export(): { data: SerializedFinderQuery[]; }; } /** * The committed data for a single leader annotation. * Stored in drawing local space (XZ plane, Y = 0). */ export declare interface LeaderAnnotation { /** Unique identifier. */ uuid: string; /** Tip of the arrow — the annotated point. */ arrowTip: THREE.Vector3; /** Elbow — the bend between the leader line and the extension. */ elbow: THREE.Vector3; /** End of the horizontal extension line — anchor for the text. */ extensionEnd: THREE.Vector3; /** The annotation text. */ text: string; /** Name of the {@link LeaderAnnotationStyle} to use when rendering. */ style: string; } /** Editable fields of {@link LeaderAnnotation} — everything except `uuid`. */ export declare type LeaderAnnotationData = Omit; export declare type LeaderAnnotationEvent = /** First event that starts the machine — carries the target drawing. */ { type: "CLICK"; point: THREE.Vector3; drawing?: TechnicalDrawing; } /** The cursor moved — drawing context is already set from the initial CLICK. */ | { type: "MOUSE_MOVE"; point: THREE.Vector3; } /** * Consumer supplies the annotation text after the machine enters * `enteringText`. Ignored in all other states. */ | { type: "SUBMIT_TEXT"; text: string; } /** Cancel the current operation and return to the initial state. */ | { type: "ESCAPE"; }; /** * Pure state transition function for the leader annotation tool. * Returns the **same state reference** when no transition applies. */ export declare function leaderAnnotationMachine(state: LeaderAnnotationState, event: LeaderAnnotationEvent): LeaderAnnotationState; /** * Global drawing system that manages leader (arrow + text) annotations across * all {@link TechnicalDrawing} instances. */ export declare class LeaderAnnotations extends AnnotationSystem implements Transitionable, Disposable_2 { enabled: boolean; readonly _item: LeaderAnnotation; machineState: LeaderAnnotationState; readonly onMachineStateChanged: Event_2; private readonly _previewMeshMaterial; private _previewMeshObject; constructor(components: Components); pickHandle(drawing: TechnicalDrawing, ray: THREE.Ray, threshold?: number): { uuid: string; handle: "elbow" | "extensionEnd"; } | null; sendMachineEvent(event: LeaderAnnotationEvent): void; protected _buildGroup(ann: LeaderAnnotation, style: LeaderAnnotationStyle): THREE.Group; protected _updatePreview(): void; protected _clearPreview(): void; protected _onDispose(): void; private _resetMachine; private _clearPreviewMesh; } export declare type LeaderAnnotationState = /** Tool active, waiting for the first click (arrow tip). */ { kind: "awaitingArrowTip"; } /** Arrow tip placed. User moves toward the elbow point. */ | { kind: "placingElbow"; arrowTip: THREE.Vector3; cursor: THREE.Vector3 | null; } /** Elbow placed. User moves toward the extension end. */ | { kind: "placingExtension"; arrowTip: THREE.Vector3; elbow: THREE.Vector3; cursor: THREE.Vector3 | null; } /** * All geometry is set. The machine is paused waiting for the consumer to * supply the annotation text via a `SUBMIT_TEXT` event. */ | { kind: "enteringText"; arrowTip: THREE.Vector3; elbow: THREE.Vector3; extensionEnd: THREE.Vector3; } /** Annotation just committed. */ | { kind: "committed"; annotation: LeaderAnnotation; }; /** Visual appearance of a leader annotation. */ export declare interface LeaderAnnotationStyle extends BaseAnnotationStyle { /** Size of the tick at the arrow tip in drawing local units. */ tickSize: number; /** * Distance from `extensionEnd` to the text label anchor, * measured along the extension direction. */ textOffset: number; /** * Leader line shape. * - `"angular"` (default) — two straight segments: arrowTip → elbow → extensionEnd. * - `"curved"` — quadratic Bézier with `elbow` as the control point. */ leaderShape?: "angular" | "curved"; /** * Line-segment tick at the arrow tip — geometry is included in the same * `LineSegments` as the leader line. * When both `tick` and `meshTick` are absent, nothing is drawn at the tip. */ lineTick?: LineTickBuilder; /** * Filled (mesh) tick at the arrow tip — rendered as a separate `THREE.Mesh`. * Can be combined with `tick` (e.g. open circle + filled disc = target). */ meshTick?: MeshTickBuilder; } declare interface LeaderAnnotationSystem { item: LeaderAnnotation; data: LeaderAnnotationData; style: LeaderAnnotationStyle; handle: "elbow" | "extensionEnd"; } /** * The committed data for a single linear annotation. * Stored in drawing local space (XZ plane, Y = 0). */ export declare interface LinearAnnotation { /** Unique identifier. */ uuid: string; /** First measured point in drawing local space. */ pointA: THREE.Vector3; /** Second measured point in drawing local space. */ pointB: THREE.Vector3; /** * Signed distance from the AB segment to the dimension line, * measured along the direction perpendicular to the measurement axis. */ offset: number; /** Name of the {@link LinearAnnotationStyle} to use when rendering this annotation. */ style: string; } /** Editable fields of {@link LinearAnnotation} — everything except the `uuid`. */ export declare type LinearAnnotationData = Omit; export declare type LinearAnnotationEvent = /** * A point in drawing local space was clicked. * Carries `drawing` so the machine can lock it in as `_previewDrawing` on the * first click — subsequent events reuse that cached context. * * `line` MUST be provided when in `awaitingFirstPoint` or `placingPoints` — * the machine silently ignores the click without it (only line snaps accepted). * It is optional in `positioningOffset` (free-space placement). */ { type: "CLICK"; point: THREE.Vector3; line?: THREE.Line3; drawing?: TechnicalDrawing; } /** The cursor moved — drawing context is already cached from the initial CLICK or SELECT_LINE. */ | { type: "MOUSE_MOVE"; point: THREE.Vector3; } /** * Consumer signals "done placing points — move to offset positioning". * Relevant only in `sequential` mode; in `individual` the machine auto-advances. * The consumer decides the DOM mapping (Enter, double-click, etc.). */ | { type: "CONFIRM"; } /** * Alternative first event: selects an entire line as the dimension's measured * segment, jumping directly to `positioningOffset`. * Carries `drawing` to set the drawing context (same role as the first CLICK). */ | { type: "SELECT_LINE"; line: THREE.Line3; drawing?: TechnicalDrawing; } /** Cancel the current operation and return to the initial state. */ | { type: "ESCAPE"; }; /** * Global drawing system that manages linear dimension annotations across all * {@link TechnicalDrawing} instances. */ export declare class LinearAnnotations extends AnnotationSystem implements Transitionable, Disposable_2 { enabled: boolean; readonly _item: LinearAnnotation; machineState: LinearAnnotationState; readonly onMachineStateChanged: Event_2; constructor(components: Components); pickHandle(drawing: TechnicalDrawing, ray: THREE.Ray, threshold?: number): { uuid: string; handle: "pointA" | "pointB" | "offset"; } | null; sendMachineEvent(event: LinearAnnotationEvent): void; protected _buildGroup(dim: LinearAnnotation, style: LinearAnnotationStyle): THREE.Group; protected _updatePreview(): void; private _resetMachine; } export declare type LinearAnnotationState = /** Tool is active but no interaction has started. */ { kind: "awaitingFirstPoint"; } /** * First point placed. Stores the direction of the measured lines so that * subsequent clicks can be validated (must be on parallel lines) and the * cursor preview constrained to the orthogonal measurement direction. * * In `individual` mode the tool auto-advances after the second CLICK. * In `sequential` mode the user accumulates points and sends CONFIRM when done. */ | { kind: "placingPoints"; points: THREE.Vector3[]; cursor: THREE.Vector3 | null; /** Normalised direction of the first (and all subsequent) measured lines. */ lineDir: THREE.Vector3; /** The first line segment hit — used to reject clicks on the same segment. */ firstLine: THREE.Line3; } /** * All measurement points are set. The user drags to define the perpendicular * offset of the dimension line, then clicks to commit. */ | { kind: "positioningOffset"; points: THREE.Vector3[]; cursor: THREE.Vector3 | null; } /** One or more annotations have just been committed. */ | { kind: "committed"; dimensions: LinearAnnotation[]; }; /** Visual appearance of a linear annotation. Registered by name on the component. */ export declare interface LinearAnnotationStyle extends BaseAnnotationStyle { /** Tick mark geometry builder. Use one of the built-in exports or provide a custom one. */ lineTick: LineTickBuilder; /** * Optional filled tick mark builder. When provided, a `THREE.Mesh` triangle * is rendered at each dimension endpoint in addition to (or instead of) the * line tick. Set `tick` to {@link NoTick} when you only want the filled shape. */ meshTick?: MeshTickBuilder; /** Size of the tick mark in drawing local units. */ tickSize: number; /** Gap between the measured geometry and the start of each extension line. */ extensionGap: number; /** How far extension lines overshoot beyond the dimension line. */ extensionOvershoot: number; /** * Signed perpendicular distance from the dimension line to the text label, * measured outward from the measured geometry. * Positive moves the text away from the geometry; negative moves it inward. */ textOffset: number; } declare interface LinearAnnotationSystem { item: LinearAnnotation; data: LinearAnnotationData; style: LinearAnnotationStyle; handle: "pointA" | "pointB" | "offset"; } /** * Pure state transition function for the linear dimension tool. * * Given the current state and an incoming event, returns the next state. * Returns the **same state reference** when no transition applies (caller can * skip re-renders with a `===` check). */ export declare function linearDimensionMachine(state: LinearAnnotationState, event: LinearAnnotationEvent): LinearAnnotationState; /** * A function that produces tick mark geometry at one endpoint of a dimension * or leader line. Returns a flat array of XYZ triplets (vertex pairs for * `LineSegments`). * * @param tip - The endpoint of the line (drawing local space). * @param lineDir - Normalised direction FROM `tip` TOWARD the other endpoint. * @param size - Tick size in drawing local units. */ export declare type LineTickBuilder = (tip: THREE.Vector3, lineDir: THREE.Vector3, size: number) => number[]; /** * Represents an edge measurement result. */ export declare interface MeasureEdge { /** * The distance between the two points of the edge. */ distance: number; /** * The two points that define the edge. */ points: THREE.Vector3[]; } /** * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils). */ export declare class MeasurementUtils extends Component { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static uuid: string; /** {@link Component.enabled} */ enabled: boolean; constructor(components: Components); /** * Utility method to calculate the distance from a point to a line segment. * * @param point - The point from which to calculate the distance. * @param lineStart - The start point of the line segment. * @param lineEnd - The end point of the line segment. * @param clamp - If true, the distance will be clamped to the line segment's length. * @returns The distance from the point to the line segment. */ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number; /** * Method to round the vector's components to a specified number of decimal places. * This is used to ensure numerical precision in edge detection. * * @param vector - The vector to round. * @returns The vector with rounded components. */ round(vector: THREE.Vector3): void; /** * @deprecated Use {@link getItemsVolume} instead. * * Calculates the volume of a set of items. */ getVolumeFromFragments(modelIdMap: ModelIdMap): Promise; /** * Calculates the total volume of items for a given map of model IDs to local IDs. * @param modelIdMap A map where the key is the model ID and the value is an array of local IDs. * @returns A promise that resolves to the total volume of the specified items. */ getItemsVolume(modelIdMap: ModelIdMap): Promise; /** * Converts a value from one unit to another for length, area, or volume without using external libraries. * * @param value - The value to convert. * @param fromUnit - The unit of the input value (e.g., "m", "cm", "mm" for lengths; "m2", "cm2" for areas; "m3", "cm3" for volumes). * @param toUnit - The unit to convert to (e.g., "cm", "mm", "m" for lengths; "cm2", "m2" for areas; "cm3", "m3" for volumes). * @param precision - The number of decimal places to round the result to, as number between 0 and 5. (default is 2). * @throws {Error} If the rounding value is not a valid integer or is out of range (0-5). * @returns The converted value rounded to the specified precision. */ static convertUnits(value: number, fromUnit: string, toUnit: string, precision?: number): number; } /** * A function that produces filled tick mark geometry (triangles) at one * endpoint. Returns a flat array of XYZ triplets forming non-indexed triangles * for a `THREE.Mesh`. * * Same signature as {@link LineTickBuilder} — swap one for the other freely. * * @param tip - The endpoint of the dimension or leader line. * @param lineDir - Normalised direction FROM `tip` TOWARD the other endpoint. * @param size - Tick/arrow size in drawing local units. */ export declare type MeshTickBuilder = (tip: THREE.Vector3, lineDir: THREE.Vector3, size: number) => number[]; export declare type ModelIdDataMap = FRAGS.DataMap>; /** * Mapping of model identifiers to a collection of numbers representing localIds. */ export declare type ModelIdMap = Record>; /** * Utility class for manipulating and managing `ModelIdMap` objects. A `ModelIdMap` is a mapping of model identifiers (strings) to sets of local IDs (numbers). This class provides methods for joining, intersecting, cloning, adding, removing, and comparing `ModelIdMap` objects, as well as converting between `ModelIdMap` and plain JavaScript objects. */ export declare class ModelIdMapUtils { /** * Creates a new ModelIdMap from the union of multiple ModelIdMaps. * @param maps - An array of ModelIdMaps to join. * @returns A new ModelIdMap containing all model identifiers and localIds from all input maps. */ static join(maps: ModelIdMap[]): ModelIdMap; /** * Creates a new ModelIdMap from the intersection of multiple ModelIdMaps. * @param maps - An array of ModelIdMaps. * @returns A new ModelIdMap containing only model identifiers and localIds present in all input maps. */ static intersect(maps: ModelIdMap[]): ModelIdMap; /** * Creates a deep clone of a ModelIdMap. * @param source - The ModelIdMap to clone. * @returns A new ModelIdMap with the same model identifiers and localIds as the original. */ static clone(source: ModelIdMap): ModelIdMap; /** * Remove all entries from one ModelIdMap to another. * @param target - The ModelIdMap to subtract from. * @param source - The ModelIdMap to subtract. */ static remove(target: ModelIdMap, source: ModelIdMap, clone?: boolean): void; /** * Adds all entries from one ModelIdMap to another. * @param target - The ModelIdMap to add to. * @param source - The ModelIdMap to add from. */ static add(target: ModelIdMap, source: ModelIdMap, clone?: boolean): void; static append(target: ModelIdMap, modelId: string, ...localIds: number[]): void; /** * Checks if two ModelIdMaps are equal. * @param a - The first ModelIdMap. * @param b - The second ModelIdMap. * @returns True if the ModelIdMaps are equal, false otherwise. */ static isEqual(a: ModelIdMap, b: ModelIdMap): boolean; /** * Checks if a ModelIdMap is empty. * @param map - The ModelIdMap to check. * @returns True if the ModelIdMap is empty, false otherwise. */ static isEmpty(map: ModelIdMap): boolean; /** * Converts a ModelIdMap into a plain JavaScript object with array values. * @param map - The ModelIdMap to convert. * @returns A plain JavaScript object where each key (model ID) maps to an array of local IDs. */ static toRaw(map: ModelIdMap): { [modelID: string]: number[]; }; /** * Creates a ModelIdMap from a plain JavaScript object with array values. * @param raw - A plain JavaScript object where each key (model ID) maps to an array of local IDs. * @returns A ModelIdMap. */ static fromRaw(raw: { [modelID: string]: number[]; }): ModelIdMap; } /** * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen. */ export declare class Mouse implements Disposable_2 { dom: HTMLCanvasElement; private _event?; private _position; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; constructor(dom: HTMLCanvasElement); /** * The real position of the mouse or touch of the Three.js canvas. */ get position(): THREE.Vector2; /** * The raw position of the mouse or touch of the Three.js canvas. */ get rawPosition(): THREE.Vector2; /** {@link Disposable.dispose} */ dispose(): void; private updatePosition; private getPositionY; private getPositionX; private updateMouseInfo; private getDataObject; private setupEvents; } /** * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc). */ export declare interface NavigationMode { /** The unique ID of this navigation mode. */ id: NavModeID; /** * Enable or disable this navigation mode. * When a new navigation mode is enabled, the previous navigation mode * must be disabled. * * @param active - whether to enable or disable this mode. * @param options - any additional data required to enable or disable it. * */ set: (active: boolean, options?: any) => void; /** Whether this navigation mode is active or not. */ enabled: boolean; } /** * The extensible list of supported navigation modes. */ export declare type NavModeID = "Orbit" | "FirstPerson" | "Plan"; export declare interface NoControl { type: "None"; value: any; } /** * No tick — dimension line ends cleanly at the extension lines. */ export declare const NoTick: LineTickBuilder; export declare interface NumberSettingControl { type: "Number"; interpolable: boolean; min?: number; max?: number; value: number; } /** * Open-V arrowhead tick — two lines from the tip to the wing points, no base. */ export declare const OpenArrowTick: LineTickBuilder; /** * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares. */ export declare class OrbitMode implements NavigationMode { camera: OrthoPerspectiveCamera; /** {@link NavigationMode.enabled} */ enabled: boolean; /** {@link NavigationMode.id} */ readonly id = "Orbit"; constructor(camera: OrthoPerspectiveCamera); /** {@link NavigationMode.set} */ set(active: boolean): void; private activateOrbitControls; } /** * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera). */ export declare class OrthoPerspectiveCamera extends SimpleCamera { /** * A ProjectionManager instance that manages the projection modes of the camera. */ readonly projection: ProjectionManager; /** * A THREE.OrthographicCamera instance that represents the orthographic camera. * This camera is used when the projection mode is set to orthographic. */ readonly threeOrtho: THREE.OrthographicCamera; /** * A THREE.PerspectiveCamera instance that represents the perspective camera. * This camera is used when the projection mode is set to perspective. */ readonly threePersp: THREE.PerspectiveCamera; protected readonly _userInputButtons: any; protected readonly _frustumSize = 50; protected readonly _navigationModes: Map; protected _mode: NavigationMode | null; private previousSize; /** * Getter for the current navigation mode. * Throws an error if the mode is not found or the camera is not initialized. * * @returns {NavigationMode} The current navigation mode. * * @throws {Error} Throws an error if the mode is not found or the camera is not initialized. */ get mode(): NavigationMode; constructor(components: Components); /** {@link Disposable.dispose} */ dispose(): void; /** * Sets a new {@link NavigationMode} and disables the previous one. * * @param mode - The {@link NavigationMode} to set. */ set(mode: string): void; /** * Make the camera view fit all the specified meshes. * * @param meshes the meshes to fit. If it is not defined, it will * evaluate {@link Components.meshes}. * @param offset the distance to the fit object */ fit(meshes: Iterable, offset?: number): Promise; /** * Allows or prevents all user input. * * @param active - whether to enable or disable user inputs. */ setUserInput(active: boolean): void; /** * Adds a custom {@link NavigationMode} to the camera that can be used using the {@link OrthoPerspectiveCamera.set} method. * * @param mode - The custom {@link NavigationMode} to add. */ addCustomNavigationMode(mode: NavigationMode): void; private disableUserInput; private enableUserInput; private newOrthoCamera; private setOrthoPerspCameraAspect; } /** * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools. */ export declare class PlanMode implements NavigationMode { private camera; /** {@link NavigationMode.enabled} */ enabled: boolean; /** {@link NavigationMode.id} */ readonly id = "Plan"; private mouseAction1?; private mouseAction2?; private mouseInitialized; private readonly defaultAzimuthSpeed; private readonly defaultPolarSpeed; constructor(camera: OrthoPerspectiveCamera); /** {@link NavigationMode.set} */ set(active: boolean): void; } /** Basic type to describe the progress of any kind of process. */ export declare interface Progress { /** The amount of things that have been done already. */ current: number; /** The total amount of things to be done by the process. */ total: number; } /** * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}. */ export declare class ProjectionManager { /** * Event that fires when the {@link CameraProjection} changes. */ readonly onChanged: Event_2; /** * Current projection mode of the camera. * Default is "Perspective". */ current: CameraProjection; /** * The camera controlled by this ProjectionManager. * It can be either a PerspectiveCamera or an OrthographicCamera. */ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera; /** Match Ortho zoom with Perspective distance when changing projection mode */ matchOrthoDistanceEnabled: boolean; private _component; private _previousDistance; constructor(camera: OrthoPerspectiveCamera); /** * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}. * * @param projection - the new projection to set. If it is the current projection, * it will have no effect. */ set(projection: CameraProjection): Promise; /** * Changes the current {@link CameraProjection} from Ortographic to Perspective * and vice versa. */ toggle(): Promise; private setOrthoCamera; private getPerspectiveDims; private setupOrthoCamera; private getDistance; private setPerspectiveCamera; } /** * Represents the type of aggregation used in a query result. `inclusive`: Equivalent to OR. `exclusive`: Equivalent to AND. */ export declare type QueryResultAggregation = "inclusive" | "exclusive"; /** * Configuration for testing queries. */ export declare interface QueryTestConfig { /** * An optional array of regular expressions used to know the models to be tested. */ modelIds?: RegExp[]; /** * An optional boolean indicating whether to force the query execution no matter if there is a cached result already. */ force?: boolean; } /** * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters). */ export declare class Raycasters extends Component implements Disposable_2 { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace"; /** {@link Component.enabled} */ enabled: boolean; /** * A Map that stores raycasters for each world. * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance. */ list: Map; /** {@link Disposable.onDisposed} */ onDisposed: Event_2; constructor(components: Components); /** * Retrieves a SimpleRaycaster instance for the given world. * If a SimpleRaycaster instance already exists for the world, it will be returned. * Otherwise, a new SimpleRaycaster instance will be created and added to the list. * * @param world - The world for which to retrieve or create a SimpleRaycaster instance. * @returns The SimpleRaycaster instance for the given world. */ get(world: World): SimpleRaycaster; /** * Deletes the SimpleRaycaster instance associated with the given world. * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list. * * @param world - The world for which to delete the SimpleRaycaster instance. * @returns {void} */ delete(world: World): void; /** {@link Disposable.dispose} */ dispose(): void; } /** * Rectangular enclosure — a plain axis-aligned rectangle centred on `center`. * Width = 2 × halfW, height = 2 × halfH. */ export declare const RectEnclosure: EnclosureBuilder; /** * Configuration options for removing items from a classifier. */ export declare interface RemoveClassifierItemsConfig { /** * The name of the classification from which items should be removed. */ classificationName?: string; /** * The name of the group within the classification from which items should be removed. */ groupName?: string; } /** * The mode of the renderer. If MANUAL, the renderer will be updated on command. If AUTO, the renderer will render on every update tick. */ export declare enum RendererMode { MANUAL = 0, AUTO = 1 } /** * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale. */ export declare interface Resizeable { /** * Sets size of this component (e.g. the resolution of a * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) * component. */ resize: (size?: THREE.Vector2) => void; /** Event that fires when the component has been resized. */ onResize: Event_2; /** * Gets the current size of this component (e.g. the resolution of a * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) * component. */ getSize: () => THREE.Vector2; } export declare interface SelectSettingControl { type: "Select"; multiple: boolean; options: Set; value: string; } export declare interface Serializable = Record, S extends Record = Record> { import: (result: SerializationResult, ...args: any) => any; export: (...args: any) => SerializationResult; } export declare interface SerializationResult = Record, S extends Record = Record> { data?: D[]; settings?: S; } /** * Represents a serialized query for an item finder. */ export declare interface SerializedFinderQuery { /** * The ID of the query. */ guid: string; /** * The name of the query. */ name: string; /** * An object to define custom data. */ customData: Record; /** * An array of serialized query parameters. */ queries: SerializedQueryParameters[]; /** * The type of aggregation applied to the query results. */ aggregation: QueryResultAggregation; /** * Indicates whether the query results should be cached. */ cache: boolean; } export declare interface SerializedQueryAttribute { /** * The name of the attribute. */ name: string; /** * The value of the attribute, which can be a string, an array of strings, a number, or a boolean. Optional. */ value?: string | string[] | number | boolean; /** * The type of the attribute, typically used to define the data type or category. Optional. */ type?: string; /** * Indicates whether the query should negate this attribute. Optional. */ negate?: boolean; /** * An array of item IDs associated with this attribute. Optional. */ itemIds?: number[]; } /** * Represents the serialized query parameters used for item finding. */ export declare interface SerializedQueryParameters { /** * An optional array of category strings to filter items. */ categories?: string[]; /** * An optional object containing attribute-based queries. */ attributes?: { /** * Specifies the aggregation type for attributes, either "exclusive" or "inclusive". */ aggregation?: "exclusive" | "inclusive"; /** * An array of serialized query attributes used for filtering. */ queries: SerializedQueryAttribute[]; }; /** * An optional object defining a relational query. */ relation?: { /** * The name of the relation. */ name: string; /** * An optional nested query of type SerializedQueryParameters. */ query?: SerializedQueryParameters; }; } /** * A scene that supports efficient cast shadows. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/ShadowedScene). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ShadowedScene). */ export declare class ShadowedScene extends SimpleScene implements Disposable_2, Configurable { private _distanceRenderer?; /** * Whether the bias property should be set automatically depending on the shadow distance. */ autoBias: boolean; protected _defaultShadowConfig: { cascade: number; resolution: number; }; private _lightsWithShadow; private _isComputingShadows; private _shadowsEnabled; private _bias; /** * The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005. */ get bias(): number; /** * The setter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005. */ set bias(value: number); /** * Getter to see whether the shadows are enabled or not in this scene instance. */ get shadowsEnabled(): boolean; /** * Setter to control whether the shadows are enabled or not in this scene instance. */ set shadowsEnabled(value: boolean); /** * Getter to get the renderer used to determine the farthest distance from the camera. */ get distanceRenderer(): DistanceRenderer; /** {@link Configurable.setup} */ setup(config?: Partial): void; /** {@link Disposable.dispose} */ dispose(): void; /** Update all the shadows of the scene. */ updateShadows(): Promise; private recomputeShadows; } /** * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights, as well as shadows. */ export declare interface ShadowedSceneConfig extends SimpleSceneConfig { shadows: { cascade: number; resolution: number; }; } /** * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers. */ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable_2 { /** {@link Updateable.onBeforeUpdate} */ readonly onBeforeUpdate: Event_2; /** {@link Updateable.onAfterUpdate} */ readonly onAfterUpdate: Event_2; /** * Event that is triggered when the aspect of the camera has been updated. * This event is useful when you need to perform actions after the aspect of the camera has been changed. */ readonly onAspectUpdated: Event_2; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * A three.js PerspectiveCamera or OrthographicCamera instance. * This camera is used for rendering the scene. */ three: THREE.PerspectiveCamera | THREE.OrthographicCamera; protected _resizeObserver: ResizeObserver | null; private _allControls; /** * The object that controls the camera. An instance of * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls). * Transforming the camera directly will have no effect: you need to use this * object to move, rotate, look at objects, etc. */ get controls(): CameraControls; /** * Getter for the enabled state of the camera controls. * If the current world is null, it returns false. * Otherwise, it returns the enabled state of the camera controls. * * @returns {boolean} The enabled state of the camera controls. */ get enabled(): boolean; /** * Setter for the enabled state of the camera controls. * If the current world is not null, it sets the enabled state of the camera controls to the provided value. * * @param {boolean} enabled - The new enabled state of the camera controls. */ set enabled(enabled: boolean); set currentWorld(value: World | null); get currentWorld(): World | null; constructor(components: Components); /** {@link Disposable.dispose} */ dispose(): void; fitToItems(items?: ModelIdMap): Promise; setOrbitToItems(items?: ModelIdMap): Promise; /** {@link Updateable.update} */ update(_delta: number): void; /** * Updates the aspect of the camera to match the size of the * {@link Components.renderer}. */ updateAspect: () => void; private getItemsBounding; private setupCamera; private newCameraControls; private setupEvents; private static getSubsetOfThree; } /** * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts). */ export declare class SimpleGrid implements Hideable, Disposable_2, Configurable { /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** {@link Configurable.onSetup} */ readonly onSetup: Event_2; /** {@link Configurable.isSetup} */ isSetup: boolean; /** The world instance to which this Raycaster belongs. */ world: World; /** The components instance to which this grid belongs. */ components: Components; /** {@link Configurable.config} */ config: SimpleGridConfigManager; protected _defaultConfig: SimpleGridConfig; /** {@link Hideable.visible} */ get visible(): boolean; /** {@link Hideable.visible} */ set visible(visible: boolean); /** The material of the grid. */ get material(): THREE.ShaderMaterial; /** * Whether the grid should fade away with distance. Recommended to be true for * perspective cameras and false for orthographic cameras. */ get fade(): boolean; /** * Whether the grid should fade away with distance. Recommended to be true for * perspective cameras and false for orthographic cameras. */ set fade(active: boolean); /** The Three.js mesh that contains the infinite grid. */ readonly three: THREE.Mesh; private _fade; constructor(components: Components, world: World); /** {@link Configurable.setup} */ setup(config?: Partial): void; /** {@link Disposable.dispose} */ dispose(): void; private setupEvents; private updateZoom; } /** * Configuration interface for the {@link SimpleGrid}. */ export declare interface SimpleGridConfig { /** * Whether the grid is visible or not. */ visible: boolean; /** * The color of the grid lines. */ color: THREE.Color; /** * The size of the primary grid lines. */ primarySize: number; /** * The size of the secondary grid lines. */ secondarySize: number; /** * The distance at which the grid lines start to fade away. */ distance: number; } export declare class SimpleGridConfigManager extends Configurator { protected _config: SimpleGridConfigType; /** * Whether the grid is visible or not. */ get visible(): boolean; /** * Whether the grid is visible or not. */ set visible(value: boolean); /** * The color of the grid lines. */ get color(): THREE.Color; /** * The color of the grid lines. */ set color(value: THREE.Color); /** * The size of the primary grid lines. */ get primarySize(): number; /** * The size of the primary grid lines. */ set primarySize(value: number); /** * The size of the secondary grid lines. */ get secondarySize(): number; /** * The size of the secondary grid lines. */ set secondarySize(value: number); /** * The distance at which the grid lines start to fade away. */ get distance(): number; /** * The distance at which the grid lines start to fade away. */ set distance(value: number); } declare type SimpleGridConfigType = { visible: BooleanSettingsControl; color: ColorSettingsControl; primarySize: NumberSettingControl; secondarySize: NumberSettingControl; distance: NumberSettingControl; }; /** * Each of the clipping planes created by the clipper. */ export declare class SimplePlane implements Disposable_2, Hideable { /** Event that fires when the user starts dragging a clipping plane. */ readonly onDraggingStarted: Event_2; /** Event that fires when the user stops dragging a clipping plane. */ readonly onDraggingEnded: Event_2; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * The normal vector of the clipping plane. */ readonly normal: THREE.Vector3; /** * The origin point of the clipping plane. */ readonly origin: THREE.Vector3; /** * The THREE.js Plane object representing the clipping plane. */ readonly three: THREE.Plane; /** The components instance to which this plane belongs. */ components: Components; /** The world instance to which this plane belongs. */ world: World; /** A custom string to identify what this plane is used for. */ type: string; private _title; set title(value: string); get title(): string; protected readonly _helper: THREE.Object3D; protected _visible: boolean; protected _enabled: boolean; private _controlsActive; private readonly _arrowBoundBox; private readonly _planeMesh; private readonly _controls; private readonly _hiddenMaterial; private _sizeMultiplier; private _autoScale; get autoScale(): boolean; set autoScale(value: boolean); /** * Getter for the enabled state of the clipping plane. * @returns {boolean} The current enabled state. */ get enabled(): boolean; /** * Setter for the enabled state of the clipping plane. * Updates the clipping plane state in the renderer and throws an error if no renderer is found. * @param {boolean} state - The new enabled state. */ set enabled(state: boolean); private _visibilityBeforeDisabled; /** {@link Hideable.visible } */ get visible(): boolean; /** {@link Hideable.visible } */ set visible(state: boolean); /** The meshes used for raycasting */ get meshes(): THREE.Mesh[]; /** The material of the clipping plane representation. */ get planeMaterial(): THREE.Material | THREE.Material[]; /** The material of the clipping plane representation. */ set planeMaterial(material: THREE.Material | THREE.Material[]); /** The size of the clipping plane representation. */ get size(): number; /** Sets the size of the clipping plane representation. */ set size(size: number); /** * Getter for the helper object of the clipping plane. * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects. * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene. * * @returns {THREE.Object3D} The helper object of the clipping plane. */ get helper(): THREE.Object3D; /** * Getter for the transform controls of the clipping plane. * The controls allow interactive manipulation (translation, rotation, etc.) of the clipping plane. * * @returns {TransformControls} The transform controls of the clipping plane. */ get controls(): TransformControls; constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean); private notifyManager; /** * Sets the clipping plane's normal and origin from the given normal and point. * This method resets the clipping plane's state, updates the normal and origin, * and positions the helper object accordingly. * * @param normal - The new normal vector for the clipping plane. * @param point - The new origin point for the clipping plane. * * @returns {void} */ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void; /** {@link Updateable.update} */ update: () => void; private updateScale; /** {@link Disposable.dispose} */ dispose(): void; private reset; protected toggleControls(state: boolean): void; private newTransformControls; private initializeControls; private createArrowBoundingBox; private changeDrag; private notifyDraggingChanged; private preventCameraMovement; private newHelper; private static newPlaneMesh; } /** * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events. */ export declare class SimpleRaycaster implements Disposable_2 { /** {@link Component.enabled} */ enabled: boolean; /** The components instance to which this Raycaster belongs. */ components: Components; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** The position of the mouse in the screen. */ readonly mouse: Mouse; /** * A reference to the Three.js Raycaster instance. * This is used for raycasting operations. */ readonly three: THREE.Raycaster; /** * A reference to the world instance to which this Raycaster belongs. * This is used to access the camera and meshes. */ world: World; /** * Whether to use fast model picking to optimize raycasting. * When enabled, the raycaster will first use FastModelPicker to identify * which model is under the mouse, then only raycast that specific model. * This can significantly improve performance when there are many models. */ useFastModelPicking: boolean; constructor(components: Components, world: World); /** {@link Disposable.dispose} */ dispose(): void; castRayToObjects(items?: THREE.Object3D[], position?: THREE.Vector2): THREE.Intersection | null; /** * Throws a ray from the camera to the mouse or touch event point and returns * the first item found. This also takes into account the clipping planes * used by the renderer. * * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh) * to query. If not provided, it will query all the meshes stored in * {@link Components.meshes}. * @param position - the screen position to use for raycasting. If not provided, * the last pointer (mouse/touch) position will be used. */ castRay(data?: { snappingClasses?: FRAGS.SnappingClass[]; items?: THREE.Object3D[]; position?: THREE.Vector2; }): Promise; /** * Casts a ray from a given origin in a given direction and returns the first item found. * This method also takes into account the clipping planes used by the renderer. * * @param origin - The origin of the ray. * @param direction - The direction of the ray. * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}. * @returns The first intersection found or `null` if no intersection was found. */ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection> | null; private intersect; private filterClippingPlanes; } /** * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D). */ export declare class SimpleRenderer extends BaseRenderer { /** * Indicates whether the renderer is enabled. If it's not, it won't be updated. * Default is `true`. */ enabled: boolean; /** * The HTML container of the THREE.js canvas where the scene is rendered. */ container: HTMLElement; /** * The THREE.js WebGLRenderer instance. */ three: THREE.WebGLRenderer; /** * The mode of the renderer. If MANUAL, the renderer will be updated manually. If AUTO, the renderer will render on every update tick. */ mode: RendererMode; /** * Whether the renderer needs to be updated. If true, the renderer will be updated on the next frame. */ needsUpdate: boolean; protected _canvas: HTMLCanvasElement; protected _parameters?: Partial; protected _resizeObserver: ResizeObserver | null; protected onContainerUpdated: Event_2; private _resizing; /** * Constructor for the SimpleRenderer class. * * @param components - The components instance. * @param container - The HTML container where the THREE.js canvas will be rendered. * @param parameters - Optional parameters for the THREE.js WebGLRenderer. */ constructor(components: Components, container: HTMLElement, parameters?: Partial); /** {@link Updateable.update} */ update(): void; /** {@link Disposable.dispose} */ dispose(): void; /** {@link Resizeable.getSize}. */ getSize(): THREE.Vector2; /** {@link Resizeable.resize} */ resize: (size?: THREE.Vector2) => void; /** * Sets up and manages the event listeners for the renderer. * * @param active - A boolean indicating whether to activate or deactivate the event listeners. * * @throws Will throw an error if the renderer does not have an HTML container. */ setupEvents(active: boolean): void; private resizeEvent; private setupRenderer; private onContextLost; private onContextBack; } /** * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it. */ export declare class SimpleScene extends BaseScene implements Configurable { /** {@link Configurable.onSetup} */ readonly onSetup: Event_2; /** {@link Configurable.isSetup} */ isSetup: boolean; /** * The underlying Three.js scene object. * It is used to define the 3D space containing objects, lights, and cameras. */ three: THREE.Scene; /** {@link Configurable.config} */ config: SimpleSceneConfigManager; protected _defaultConfig: SimpleSceneConfig; constructor(components: Components); /** {@link Configurable.setup} */ setup(config?: Partial): void; dispose(): void; } /** * Configuration interface for the {@link SimpleScene}. */ export declare interface SimpleSceneConfig { backgroundColor: THREE.Color; directionalLight: { color: THREE.Color; intensity: number; position: THREE.Vector3; }; ambientLight: { color: THREE.Color; intensity: number; }; } export declare class SimpleSceneConfigManager extends Configurator { protected _config: SimpleSceneConfigType; ambientLight: AmbientLightConfig; directionalLight: DirectionalLightConfig; get backgroundColor(): THREE.Color; set backgroundColor(value: THREE.Color); } declare type SimpleSceneConfigType = { backgroundColor: ColorSettingsControl; ambientLight: { color: ColorSettingsControl; intensity: NumberSettingControl; }; directionalLight: { color: ColorSettingsControl; intensity: NumberSettingControl; position: Vector3SettingControl; }; }; /** * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface. * * @template T - The type of the scene. Default is BaseScene. * @template U - The type of the camera. Default is BaseCamera. * @template S - The type of the renderer. Default is BaseRenderer. */ export declare class SimpleWorld extends Base implements World, Disposable_2, Updateable { readonly onCameraChanged: Event_2; /** * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting. */ readonly meshes: Set, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>; /** {@link Updateable.onAfterUpdate} */ readonly onAfterUpdate: Event_2; /** {@link Updateable.onBeforeUpdate} */ readonly onBeforeUpdate: Event_2; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world. */ isDisposing: boolean; /** * Indicates whether the world is currently enabled. * When disabled, the world will not be updated. */ enabled: boolean; private _dynamicAnchor; set dynamicAnchor(value: boolean); get dynamicAnchor(): boolean; /** * A unique identifier for the world. Is not meant to be changed at any moment. */ readonly uuid: string; /** * An optional name for the world. */ name?: string; private _scene?; private _camera?; private _renderer; private onPointerDown; private _defaultCamera?; get defaultCamera(): U; set defaultCamera(value: U); /** * Getter for the scene. If no scene is initialized, it throws an error. * @returns The current scene. */ get scene(): T; /** * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set, * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action. * @param scene - The new scene to be set. */ set scene(scene: T); /** * Getter for the camera. If no camera is initialized, it throws an error. * @returns The current camera. */ get camera(): U; /** * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set, * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action. * @param camera - The new camera to be set. */ set camera(camera: U); /** * Getter for the renderer. * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user). */ get renderer(): S | null; /** * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set, * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action. * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer. * @param renderer - The new renderer to be set or null to remove the current renderer. */ set renderer(renderer: S | null); useDefaultCamera(): void; /** {@link Updateable.update} */ update(delta?: number): void; /** {@link Disposable.dispose} */ dispose(disposeResources?: boolean): void; } /** * A single committed slope annotation. * All coordinates are in drawing local space (XZ plane, Y = 0). */ export declare interface SlopeAnnotation { /** Unique identifier. */ uuid: string; /** Anchor point of the arrow tail in drawing local space. */ position: THREE.Vector3; /** Normalised downhill direction in the XZ plane. */ direction: THREE.Vector3; /** * Slope ratio: rise / run (e.g. `0.15` for a 15 % slope). * Use {@link formatSlope} to convert to the desired display string. */ slope: number; /** Name of the {@link SlopeAnnotationStyle} to use. */ style: string; } /** Editable fields of {@link SlopeAnnotation} — everything except the `uuid`. */ export declare type SlopeAnnotationData = Omit; /** * Global drawing system that manages slope annotations across all * {@link TechnicalDrawing} instances. * * Because slope data comes from the 3D model, there is no state machine. * Call {@link add} directly with the computed slope values: * ```ts * slopes.add(drawing, { position, direction, slope, style: "default" }); * ``` */ export declare class SlopeAnnotations extends AnnotationSystem implements Disposable_2 { enabled: boolean; readonly _item: SlopeAnnotation; constructor(components: Components); pickHandle(_drawing: TechnicalDrawing, _ray: THREE.Ray, _threshold?: number): { uuid: string; handle: string; } | null; protected _buildGroup(ann: SlopeAnnotation, style: SlopeAnnotationStyle): THREE.Group; } /** Visual appearance of a slope annotation. */ export declare interface SlopeAnnotationStyle extends BaseAnnotationStyle { /** Tick mark builder at the downhill tip of the arrow. */ lineTick: LineTickBuilder; /** Optional filled tick mark builder at the downhill tip. */ meshTick?: MeshTickBuilder; /** Tick size in drawing local units. */ tickSize: number; /** Length of the arrow shaft in drawing local units. */ length: number; /** * Distance from the arrow midpoint to the near edge of the text label, * measured perpendicularly to the slope direction. */ textOffset: number; /** How the slope ratio is formatted in the text label. */ format: SlopeFormat; } declare interface SlopeAnnotationSystem { item: SlopeAnnotation; data: SlopeAnnotationData; style: SlopeAnnotationStyle; handle: string; } /** How the slope value is displayed in the text label. */ export declare type SlopeFormat = "percentage" | "ratio" | "degrees"; /** * A single technical drawing — the core spatial aggregate. * * Brings together: * - A {@link three} (`THREE.Group`) that anchors the drawing in world space. * All 2D geometry (projection lines, dimensions) must be added as children of * this group so they inherit its world transform. * - A collection of {@link viewports}, each defining an orthographic framing * window and owning a camera that is itself a child of the container. * * Moving or rotating the container repositions the entire drawing — including * all its viewport cameras — in the 3D world without affecting any local * coordinates. * * --- * * ### Rotation convention * * The drawing projects geometry along its **local −Y axis**. The drawing * plane is the local **XZ plane** (Y = 0). * * When rotating `drawing.three`, two constraints must hold at the same time: * * 1. **Projection direction** — local −Y must point toward the surface you * want to capture. * 2. **Text orientation** — local +X must point toward the right side of the * screen when the drawing is viewed from the projection direction. * Violating this causes annotations and dimension text to appear mirrored. * * For the six standard orthographic views, use {@link orientTo} — it enforces * both constraints with a single call: * * ```ts * drawing.orientTo(new THREE.Vector3(0, -1, 0)); // top / plan * drawing.orientTo(new THREE.Vector3(0, 0, -1)); // front elevation * ``` * * --- * * Typically created via {@link TechnicalDrawings.create}. */ export declare class TechnicalDrawing { /** Unique identifier for this drawing instance. */ readonly uuid: string; private readonly _raycaster; private readonly _components; constructor(components: Components); /** * The world that hosts this drawing. Set automatically by * {@link TechnicalDrawings.create} — do not assign manually unless you are * managing the drawing's scene integration yourself. */ world: World | null; /** * Root Three.js group for all 2D content belonging to this drawing. * All geometry (projection lines, dimensions) must be added as children so * they inherit its world transform. */ readonly three: THREE.Group; /** * Typed access to all annotation data stored on this drawing. * * ```ts * const dims = techDrawings.use(OBC.LinearAnnotations); * const data = drawing.annotations.getBySystem(dims); * // DataMap * ``` */ readonly annotations: DrawingAnnotations; /** * Layer manager for this drawing. * Use it to create layers, set colors, control visibility, and subscribe to * lifecycle events for reactive UI. * * ```ts * drawing.layers.create("walls", { color: 0x333333 }); * drawing.layers.setColor("walls", 0x888888); * drawing.layers.setVisibility("walls", false); * ``` */ readonly layers: DrawingLayers; /** * Name of the layer new annotations will be assigned to when added via any * drawing system. Must be a layer registered via {@link DrawingLayers.create}. * Defaults to `"0"`. */ activeLayer: string; /** * Depth of the projection capture volume, in world units, measured from the * drawing plane along the local -Y axis (the projection direction). * * Used by {@link TechnicalDrawingHelper} to visualise the volume, and by * `addProjectionFromItems` to set the far clipping plane of the * {@link EdgeProjector} automatically. * * Defaults to `10`. */ far: number; /** All viewports registered on this drawing, keyed by their UUID. */ readonly viewports: DrawingViewports; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * Intersects a pre-built ray against all layer-1 `LineSegments` in this drawing. * * The caller is responsible for building the ray (via `THREE.Raycaster.setFromCamera` * or any other method) so this method stays agnostic to which camera or canvas * the pick originated from. * * The returned {@link DrawingIntersection.point} is in drawing **local space** * (XZ plane, Y = 0), ready to use for dimension creation or snapping. * * @param ray - World-space ray to cast. * @param viewport - The viewport the ray was built from, if any. Pass `null` * when picking from the 3D world camera. * @returns The closest intersection, or `null` if nothing was hit. */ raycast(ray: THREE.Ray, viewport?: DrawingViewport | null): DrawingIntersection | null; /** * Aligns this drawing to a target plane in 3D world space using three * point correspondences. * * Pass three points picked on the drawing (in drawing local space) and * three corresponding points picked on the 3D model (in world space). * The drawing's container will be repositioned, rotated, and uniformly * scaled so that the drawing points map to their world counterparts. * * @throws If either set of points is collinear or degenerate — see * {@link computeAlignmentMatrix} for details. * * @param drawingPoints - Three non-collinear points in drawing local space. * @param worldPoints - Three corresponding points in world space. */ alignTo(drawingPoints: THREE.Vector3[], worldPoints: THREE.Vector3[]): void; /** * Projects a `THREE.LineSegments` from any world-space position onto the * given drawing's local XZ plane (Y = 0), returning a new `THREE.LineSegments` * ready to be added to {@link container}. * * Vertex coordinates are transformed from the input object's local space → * world space → drawing local space, then Y is zeroed. The input object is * not modified. * * ```ts * const projected = TechnicalDrawing.toDrawingSpace(myIFCLines, drawing); * drawing.three.add(projected); * ``` * * @param ls - Source `LineSegments` to project. Its world matrix must be * up-to-date (call `updateWorldMatrix(true, false)` if unsure). * @param drawing - Target drawing whose local XZ plane is used as destination. * @returns A new `LineSegments` with the projected geometry in drawing local * space. No material is assigned — set one before rendering. */ static toDrawingSpace(ls: THREE.LineSegments, drawing: TechnicalDrawing): THREE.LineSegments; /** * Adds a `THREE.LineSegments` to this drawing's {@link container} and * automatically computes a BVH on its geometry so that {@link raycast} can * pick individual line segments efficiently. * * Use this instead of `drawing.three.add()` whenever the geometry will * participate in picking. Plain `container.add()` still works for rendering, * but without BVH the raycast falls back to a brute-force O(n) test on every * segment — noticeably slow for dense projections. * * The layer assignment and Three.js rendering-layer setup (layer 1) are handled * internally — the caller does not need to touch `userData` or `ls.layers`. * If the named layer has a color defined, it is applied to the material immediately. * * ```ts * drawing.layers.create("walls", { color: 0x333333 }); * drawing.addProjectionLines(wallLines, "walls"); * ``` * * @param ls - The `LineSegments` to add. * @param layer - Layer name to assign. Defaults to `"0"`. If the layer does not * exist, a warning is logged and the lines fall back to `"0"`. * @returns The same `LineSegments` instance, for chaining. */ addProjectionLines(ls: THREE.LineSegments, layer?: string): THREE.LineSegments; /** * Projects the visible and hidden edges of the given BIM model items onto * this drawing using {@link EdgeProjector}. * * The projection direction is inferred from the drawing's current world * orientation (local `-Y` axis). The capture volume extends from the drawing * plane by {@link far} world units along that direction. Items outside the * volume are excluded automatically. * * Both layer names must already exist on this drawing before calling this * method — create them with {@link DrawingLayers.create} beforehand. * * ```ts * drawing.layers.create("visible", { material: new THREE.LineBasicMaterial({ color: 0x000000 }) }); * drawing.layers.create("hidden", { material: new THREE.LineDashedMaterial({ color: 0x888888, dashSize: 0.2, gapSize: 0.1 }) }); * * await drawing.addProjectionFromItems(modelIdMap, { * layers: { visible: "visible", hidden: "hidden" }, * onProgress: (msg, pct) => console.log(msg, pct), * }); * ``` * * @param modelIdMap - Items to project, keyed by model ID. * @param config - Required layer names and optional progress callback. */ addProjectionFromItems(modelIdMap: ModelIdMap, config: { layers: { visible: string; hidden: string; }; onProgress?: (message: string, progress?: number) => void; }): Promise; /** * Orients the drawing to one of the six standard orthographic projection * directions. * * Pass any of the six axis-aligned unit vectors. The method sets * `drawing.three.quaternion` to the correct rotation so that: * - The drawing's local **−Y** axis aligns with `direction`. * - The drawing's local **+X** axis points toward the right side of the * screen when the drawing is viewed from that direction, ensuring * annotations and text render without mirroring. * * ```ts * drawing.orientTo(new THREE.Vector3(0, -1, 0)); // top / plan * drawing.orientTo(new THREE.Vector3(0, 1, 0)); // bottom / RCP * drawing.orientTo(new THREE.Vector3(0, 0, -1)); // front elevation * drawing.orientTo(new THREE.Vector3(0, 0, 1)); // back elevation * drawing.orientTo(new THREE.Vector3(-1, 0, 0)); // right elevation * drawing.orientTo(new THREE.Vector3(1, 0, 0)); // left elevation * ``` * * A console warning is emitted if `direction` does not match any of the six * standard axes. * * @param direction - Desired projection direction (need not be pre-normalized). */ orientTo(direction: THREE.Vector3): void; /** Disposes all viewports, layers, annotations and removes the container (and all its Three.js geometry) from memory. */ dispose(): void; } /** * Visualises a {@link TechnicalDrawing}'s projection volume in the 3D scene * and exposes three gizmo anchors for interactive control. * * Works exactly like the built-in Three.js helpers (e.g. `THREE.CameraHelper`): * add it as a child of `drawing.three` so it inherits the drawing's world * transform automatically. * * It renders on **layer 0** — visible to the perspective camera, invisible to * the drawing's orthographic cameras (which only render layer 1). * * The helper draws three things: * - A rectangular frame on the drawing plane (Y = 0 in drawing local space). * - Four pillar lines dropping from each corner along the projection direction * (local −Y) to the far boundary. * - A matching rectangle at the far boundary. * * ### Interactive control via gizmos * * Three `THREE.Object3D` anchors are exposed for `TransformControls`: * * | Anchor | Controls | Constrained axis | * |---|---|---| * | {@link farHandle} | `drawing.far` | local Y | * | {@link widthHandle} | {@link width} (symmetric) | local X | * | {@link heightHandle} | {@link height} (symmetric) | local Z | * * Use the corresponding `attach*Gizmo` methods instead of configuring the * gizmos manually — they enforce the correct axis constraints, local space, * and change listeners automatically: * * ```ts * const helper = new TechnicalDrawingHelper(drawing); * helper.width = 20; * helper.height = 15; * drawing.three.add(helper); * * // Main gizmo — full translate + rotate on drawing.three * const mainGizmo = new TransformControls(camera, domElement); * mainGizmo.attach(drawing.three); * scene.add(mainGizmo); * * // Depth gizmo — controls drawing.far * const farGizmo = new TransformControls(camera, domElement); * scene.add(farGizmo); * helper.attachFarGizmo(farGizmo); * * // Width gizmo * const widthGizmo = new TransformControls(camera, domElement); * scene.add(widthGizmo); * helper.attachWidthGizmo(widthGizmo); * * // Height gizmo * const heightGizmo = new TransformControls(camera, domElement); * scene.add(heightGizmo); * helper.attachHeightGizmo(heightGizmo); * ``` * * Call {@link update} after changing {@link width}, {@link height}, or * `drawing.far` programmatically to rebuild the geometry. */ export declare class TechnicalDrawingHelper extends THREE.Group { private readonly _drawing; private readonly _topFrame; private readonly _pillars; private readonly _bottomFrame; private readonly _topPlane; private readonly _bottomPlane; private readonly _frameMat; private readonly _depthMat; private readonly _planeMat; private static readonly _FRAME_COLOR; private static readonly _DEPTH_COLOR; /** * Width of the drawing frame indicator along the local X axis, in world * units. Call {@link update} after changing this value programmatically. */ width: number; /** * Height of the drawing frame indicator along the local Z axis, in world * units. Call {@link update} after changing this value programmatically. */ height: number; /** * Gizmo anchor positioned at the centre of the bottom frame. * Pass a `TransformControls` instance to {@link attachFarGizmo} — do not * manipulate this object's position directly. */ readonly farHandle: THREE.Object3D; /** * Gizmo anchor positioned at the right-edge midpoint of the top frame. * Pass a `TransformControls` instance to {@link attachWidthGizmo} — do not * manipulate this object's position directly. */ readonly widthHandle: THREE.Object3D; /** * Gizmo anchor positioned at the bottom-edge midpoint of the top frame. * Pass a `TransformControls` instance to {@link attachHeightGizmo} — do not * manipulate this object's position directly. */ readonly heightHandle: THREE.Object3D; constructor(drawing: DrawingProjectionSource); /** * Rebuilds the helper geometry and repositions all gizmo anchors to match * the current {@link width}, {@link height}, and `drawing.far`. Call this * whenever any of those values change programmatically. */ update(): void; /** * Configures a `TransformControls` instance to control `drawing.far` and * attaches it to the {@link farHandle}. * * The gizmo is constrained to the drawing's local Y axis (the projection * direction) and wired to update `drawing.far` on every change. Call this * once — calling it again on the same gizmo accumulates listeners. * * @param gizmo - A `TransformControls` instance (or any {@link AxisGizmoLike}). */ attachFarGizmo(gizmo: AxisGizmoLike): void; /** * Configures a `TransformControls` instance to control {@link width} and * attaches it to the {@link widthHandle}. * * The gizmo is constrained to the drawing's local X axis. Width grows * symmetrically — dragging the right-edge handle outward expands both sides. * * @param gizmo - A `TransformControls` instance (or any {@link AxisGizmoLike}). */ attachWidthGizmo(gizmo: AxisGizmoLike): void; /** * Configures a `TransformControls` instance to control {@link height} and * attaches it to the {@link heightHandle}. * * The gizmo is constrained to the drawing's local Z axis. Height grows * symmetrically — dragging the bottom-edge handle outward expands both sides. * * @param gizmo - A `TransformControls` instance (or any {@link AxisGizmoLike}). */ attachHeightGizmo(gizmo: AxisGizmoLike): void; /** Releases all Three.js geometry and material resources. */ dispose(): void; } /** * OBC Component that creates and manages {@link TechnicalDrawing} instances. * * A TechnicalDrawing is a 2D drawing plane that lives in 3D world space. * It contains projection lines and dimension annotations (layer 1 geometry) * framed by one or more orthographic {@link DrawingViewport}s. * * The drawing's `container` (a `THREE.Group`) can be freely transformed in the * 3D world — all viewports and geometry move together as a single unit. * * @example * ```ts * const techDrawings = components.get(TechnicalDrawings); * const drawing = techDrawings.create(world); * * // Add layer-1 geometry to the drawing * const lines = new THREE.LineSegments(geometry, material); * lines.layers.set(1); * drawing.three.add(lines); * * // Add viewports * const vp = drawing.viewports.create({ left: -1, right: 5, top: 1, bottom: -4 }); * ``` */ export declare class TechnicalDrawings extends Component implements Disposable_2 { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "5c7d3b9a-4e8f-4a2b-9c1d-0e3f2a5b7c8d"; /** {@link Component.enabled} */ enabled: boolean; /** All active drawings, keyed by their UUID. */ readonly list: FRAGS.DataMap; /** * Global system instances keyed by their constructor. * Register a system with {@link use}; inspect or iterate here for UI purposes. */ readonly systems: FRAGS.DataMap>; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; constructor(components: Components); /** * Returns the global singleton instance of the given system, creating it if it * does not yet exist. The system constructor must accept `Components` as its * only argument (new-style global systems). Safe to call multiple times — always * returns the same instance. * * ```ts * const dims = techDrawings.use(OBC.LinearAnnotations); * dims.styles.set("default", { ... }); * ``` */ use>(SystemClass: new (components: Components) => T): T; /** * Creates a new {@link TechnicalDrawing} hosted in the given world. * * The drawing's Three.js group is added to the world's scene and its * lifecycle is tied to the world — it is automatically removed when the * world is disposed. Three.js rendering layer 1 is enabled on the world * camera so that annotation geometry is visible in the 3D view. Both * perspective and orthographic cameras are configured when using * {@link OrthoPerspectiveCamera}. * * To hide the drawing from the 3D view without removing it from the world, * either set `drawing.three.visible = false` or disable layer 1 on the * world camera: `world.camera.three.layers.disable(1)`. * * @param world - The world that will host this drawing. * @returns The newly created drawing. */ create(world: World): TechnicalDrawing; /** {@link Disposable.dispose} */ dispose(): void; } export declare interface TextSetSettingControl { type: "TextSet"; value: Set; } export declare interface TextSettingsControl { type: "Text"; value: string; } export declare class Topic implements BCFTopic { /** * Default values for a BCF Topic, excluding `guid`, `creationDate`, and `creationAuthor`. */ static default: Omit & { title: string; type: string; status: string; }, "guid" | "creationDate" | "creationAuthor">; /** * A unique identifier for the topic. * * @remarks * The `guid` is automatically generated upon topic creation and by no means it should change. */ guid: string; title: string; creationDate: Date; creationAuthor: string; readonly viewpoints: DataSet_2; readonly relatedTopics: DataSet_2; readonly comments: DataMap_2; readonly documentReferences: DataSet_2; customData: Record; description?: string; serverAssignedId?: string; dueDate?: Date; modifiedAuthor?: string; modifiedDate?: Date; index?: number; private _type; set type(value: string); get type(): string; private _status; set status(value: string); get status(): string; private _priority?; set priority(value: string | undefined); get priority(): string | undefined; private _stage?; set stage(value: string | undefined); get stage(): string | undefined; private _assignedTo?; set assignedTo(value: string | undefined); get assignedTo(): string | undefined; private _labels; set labels(value: Set); get labels(): Set; private _components; private get _managerVersion(); /** * Initializes a new instance of the `Topic` class representing a BCF (BIM Collaboration Format) topic. * It provides methods and properties to manage and serialize BCF topics. * * @remarks * The default creationUser is the one set in BCFTopics.config.author * It should not be created manually. Better use BCFTopics.create(). * * @param components - The `Components` instance that provides access to other components and services. */ constructor(components: Components); /** * Sets properties of the BCF Topic based on the provided data. * * @remarks * This method iterates over the provided `data` object and updates the corresponding properties of the BCF Topic. * It skips the `guid` property as it should not be modified. * * @param data - An object containing the properties to be updated. * @returns The topic * * @example * ```typescript * const topic = new Topic(components); * topic.set({ * title: "New BCF Topic Title", * description: "This is a new description.", * status: "Resolved", * }); * ``` */ set(data: Partial): this; /** * Creates a new comment associated with the current topic. * * @param text - The text content of the comment. * @param viewpoint - (Optional) The viewpoint associated with the comment. * * @returns The newly created comment. * * @example * ```typescript * const viewpoint = viewpoints.create(world); // Created with an instance of Viewpoints * const topic = topics.create(); // Created with an instance of BCFTopics * topic.viewpoints.add(viewpoint); * const comment = topic.createComment("This is a new comment", viewpoint); * ``` */ createComment(text: string, viewpoint?: string): Comment_2; private createLabelTags; private createCommentTags; private createViewpointTags; private createRelatedTopicTags; private createDocumentReferencesTag; toJSON(): BCFApiTopic; /** * Serializes the BCF Topic instance into an XML string representation based on the official schema. * * @remarks * This method constructs an XML string based on the properties of the BCF Topic instance. * It includes the topic's guid, type, status, creation date, creation author, priority, index, * modified date, modified author, due date, assigned to, description, stage, labels, related topics, * comments, and viewpoints. * * @returns A string representing the XML serialization of the BCF Topic. * * @example * ```typescript * const topic = bcfTopics.create(); // Created with an instance of BCFTopics * const xml = topic.serialize(); * console.log(xml); * ``` */ serialize(): string; } /** * Whether this component manages its interaction through an explicit state machine. * The machine is the single source of truth: the system can only be in one state at * a time, and every transition is deterministic given the current state and the event. * * @template TState - Discriminated union of all valid states (each with a `kind` string). * @template TEvent - Discriminated union of all accepted events (each with a `type` string). */ export declare interface Transitionable { /** The current state. TypeScript guarantees it is always a valid, well-typed state. */ readonly machineState: TState; /** * Dispatches an event to the machine, producing a deterministic state transition. * Events that do not apply to the current state are silently ignored. */ sendMachineEvent(event: TEvent): void; /** Fired synchronously after every state transition with the new state as payload. */ readonly onMachineStateChanged: Event_2; } /** * Built-in {@link DimensionUnit} presets. * * ```ts * style.unit = OBC.Units.mm; * ``` */ export declare const Units: { readonly m: { readonly factor: 1; readonly suffix: "m"; }; readonly cm: { readonly factor: 100; readonly suffix: "cm"; }; readonly mm: { readonly factor: 1000; readonly suffix: "mm"; }; readonly ft: { readonly factor: 3.28084; readonly suffix: "ft"; }; readonly in: { readonly factor: 39.3701; readonly suffix: "in"; }; }; /** Whether this component should be updated each frame. */ export declare interface Updateable { /** Actions that should be executed after updating the component. */ onAfterUpdate: Event_2; /** Actions that should be executed before updating the component. */ onBeforeUpdate: Event_2; /** * Function used to update the state of this component each frame. For * instance, a renderer component will make a render each frame. */ update(delta?: number): void; } export declare class UUID { private static _pattern; private static _lut; static create(): string; static validate(uuid: string): void; } export declare interface Vector3SettingControl { type: "Vector3"; value: THREE.Vector3; } /** * A class that provides functionality for picking vertices in a 3D scene. */ export declare class VertexPicker extends Component implements Disposable_2 { /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * An event that is triggered when a vertex is found. * The event passes a THREE.Vector3 representing the position of the found vertex. */ readonly onVertexFound: Event_2; /** * An event that is triggered when a vertex is lost. * The event passes a THREE.Vector3 representing the position of the lost vertex. */ readonly onVertexLost: Event_2; /** * An event that is triggered when the picker is enabled or disabled */ readonly onEnabled: Event_2; /** * A reference to the Components instance associated with this VertexPicker. */ components: Components; /** * A reference to the working plane used for vertex picking. * This plane is used to determine which vertices are considered valid for picking. * If this value is null, all vertices are considered valid. */ workingPlane: THREE.Plane | null; private _pickedPoint; private _config; private _enabled; /** * Sets the enabled state of the VertexPicker. * When enabled, the VertexPicker will actively search for vertices in the 3D scene. * When disabled, the VertexPicker will stop searching for vertices and reset the picked point. * * @param value - The new enabled state. */ set enabled(value: boolean); /** * Gets the current enabled state of the VertexPicker. * * @returns The current enabled state. */ get enabled(): boolean; /** * Sets the configuration for the VertexPicker component. * * @param value - A Partial object containing the configuration properties to update. * The properties not provided in the value object will retain their current values. * * @example * ```typescript * vertexPicker.config = { * snapDistance: 0.5, * showOnlyVertex: true, * }; * ``` */ set config(value: Partial); /** * Gets the current configuration for the VertexPicker component. * * @returns A copy of the current VertexPickerConfig object. * * @example * ```typescript * const currentConfig = vertexPicker.config; * console.log(currentConfig.snapDistance); // Output: 0.25 * ``` */ get config(): Partial; constructor(components: Components, config?: Partial); /** {@link Disposable.dispose} */ dispose(): void; /** * Performs the vertex picking operation based on the current state of the VertexPicker. * * @param world - The World instance to use for raycasting. * * @returns The current picked point, or null if no point is picked. * * @remarks * This method checks if the VertexPicker is enabled. If not, it returns the current picked point. * If enabled, it performs raycasting to find the closest intersecting object. * It then determines the closest vertex or point on the face, based on the configuration settings. * If the picked point is on the working plane (if defined), it triggers the `onVertexFound` event and updates the `pickedPoint`. * If the picked point is not on the working plane, it resets the `pickedPoint`. * If no intersecting object is found, it triggers the `onVertexLost` event and resets the `pickedPoint`. */ get(world: World): Promise; } /** * Configuration interface for the VertexPicker component. */ export declare interface VertexPickerConfig { /** * If true, only vertices will be picked, not the closest point on the face. */ showOnlyVertex: boolean; /** * The maximum distance for snapping to a vertex. */ snapDistance: number; /** * The HTML element to use for previewing the picked vertex. */ previewElement: HTMLElement; } export declare class View implements Disposable_2 { private _components; private _cameraOffset; private _planeHelper; private _farPlaneHelper; private _cameraHelper; private get _planeNormalOpposite(); private get _planePosition(); private get _cameraPosition(); readonly onStateChanged: Event_2; readonly onUpdated: Event_2; readonly onDisposed: Event_2; readonly camera: OrthoPerspectiveCamera; readonly plane: THREE.Plane; readonly farPlane: THREE.Plane; readonly id: string; private _open; set open(value: boolean); get open(): boolean; set planeHelperColor(value: THREE.Color); set farPlaneHelperColor(value: THREE.Color); private _range; set range(value: number); get range(): number; set distance(value: number); get distance(): number; private _world; set world(value: World | null); get world(): World | null; private _helpersVisible; set helpersVisible(value: boolean); get helpersVisible(): boolean; private _planesEnabled; set planesEnabled(value: boolean); get planesEnabled(): boolean; constructor(components: Components, config?: { id?: string; normal?: THREE.Vector3; point?: THREE.Vector3; }); dispose(): void; update(): void; flip(): void; } /** * Represents a BCF compliant viewpoint from BuildingSMART. The Viewpoint class provides methods for managing and interacting with viewpoints. It includes functionality for setting viewpoint properties, updating the camera, applying color to components, and serializing the viewpoint for export. */ export declare class Viewpoint { title?: string; readonly guid: string; /** * ClippingPlanes can be used to define a subsection of a building model that is related to the topic. * Each clipping plane is defined by Location and Direction. * The Direction vector points in the invisible direction meaning the half-space that is clipped. */ readonly clippingPlanes: FRAGS.DataSet; camera: ViewpointPerspectiveCamera | ViewpointOrthogonalCamera; customData: Record; /** * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false */ readonly exceptionComponents: FRAGS.DataSet; /** * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint. */ readonly selectionComponents: FRAGS.DataSet; /** * A map of colors and components GUIDs that should be colorized when displaying a viewpoint. * For this to work, call viewpoint.colorize() */ readonly componentColors: FRAGS.DataMap; /** * Boolean flags to allow fine control over the visibility of spaces. * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden. * @default false */ spacesVisible: boolean; /** * Boolean flags to allow fine control over the visibility of space boundaries. * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden. * @default false */ spaceBoundariesVisible: boolean; /** * Boolean flags to allow fine control over the visibility of openings. * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden. * @default false */ openingsVisible: boolean; /** * When true, all components should be visible unless listed in the exceptions * When false all components should be invisible unless listed in the exceptions */ defaultVisibility: boolean; /** * The snapshotID that will be used for this viewpoint when exported. */ snapshot: string; getSelectionMap(): Promise; getExceptionMap(): Promise; /** * Retrieves the projection type of the viewpoint's camera. * * @returns A string representing the projection type of the viewpoint's camera. * It can be either 'Perspective' or 'Orthographic'. */ get projection(): CameraProjection; /** * Retrieves the position vector of the viewpoint's camera. * * @returns A THREE.Vector3 representing the position of the viewpoint's camera. */ get position(): THREE.Vector3; /** * Sets the position of the viewpoint's camera. * @param value - The new position for the viewpoint's camera. */ set position(value: THREE.Vector3); /** * Retrieves the direction vector of the viewpoint's camera. * @returns A THREE.Vector3 representing the direction of the viewpoint's camera. */ get direction(): THREE.Vector3; private _components; private _world; /** * Represents the world in which the viewpoint will take effect. */ set world(value: World | null); get world(): World | null; private get _managerVersion(); /** * Retrieves the list of BCF topics associated with the current viewpoint. * * @remarks * This function retrieves the BCFTopics manager from the components, * then filters the list of topics to find those associated with the current viewpoint. * * @returns An array of BCF topics associated with the current viewpoint. */ get topics(): Topic[]; constructor(components: Components, data?: Partial); private notifyUpdate; private setEvents; /** * Fully replace the properties of the viewpoint with the provided data. * The properties not included will remain unchanged. * * @remarks The guid will be ommited as it shouldn't change after it has been initially set. * * @param data - An object containing the properties to be set. */ set(data: Partial): void; /** * Sets the viewpoint of the camera in the world. * * @remarks * This function calculates the target position based on the viewpoint information. * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls. * * @param transition - Indicates whether the camera movement should have a transition effect. * Default value is `true`. * * @throws An error if the world's camera does not have camera controls. * * @returns A Promise that resolves when the camera has been set. */ go(_config?: { transition?: boolean; applyClippings?: boolean; clippingsVisibility?: boolean; applyVisibility?: boolean; }): Promise; /** * Updates the camera settings of the viewpoint based on the current world's camera and renderer. * @returns A boolean indicating if the camera data was updated or not. */ updateCamera(takeSnapshot?: boolean): Promise; /** * Captures a snapshot of the current viewpoint and stores it in the snapshots manager. */ takeSnapshot(): Promise; /** * Updates the collection of clipping planes by clearing the current set and adding enabled planes * from the associated `Clipper` component. */ updateClippingPlanes(): void; /** * Applies visibility settings to components based on default visibility, exceptions, and selections. * * This method adjusts the visibility of components using the `Hider` instance. It ensures that: * - The default visibility is applied to all components. * - Exceptions are handled to override the default visibility. * - Selected components are always visible. */ applyVisibility(): Promise; /** * Asynchronously sets the colorization state for the viewpoint's components. * When the state is true, it applies the defined component colors to the corresponding fragments. * When the state is false, it resets the highlight for the corresponding fragments. * * @param state - A boolean indicating whether to apply or reset the colorization. * If true, the components will be colorized. If false, the colorization will be reset. * @returns A Promise that resolves when all colorization or reset operations are complete. * @remarks Be careful when using this method along with the Highlighter as it can cause unwanted results */ setColorizationState(state: boolean): Promise; /** * Sets the enabled state of all clipping planes associated with this viewpoint. * @param state A boolean indicating whether the clipping planes should be enabled or disabled. */ setClippingState(state: boolean): void; /** * Sets the visibility of all clipping planes associated with this viewpoint. * * @param visibility - A boolean indicating whether the clipping planes should be visible (`true`) or hidden (`false`). */ setClippingVisibility(visibility: boolean): void; private createComponentTags; private createColorTags; /** * Converts the current viewpoint instance into a JSON representation compliant with the BCFViewpoint format. * * @returns A BCF API JSON complaint object representing the viewpoint, including its GUID, components, * visibility settings, clipping planes, camera configuration, and snapshot data. */ toJSON(): BCFViewpoint; /** * Serializes the viewpoint into a buildingSMART compliant XML string for export. * * @param version - The version of the BCF Manager to use for serialization. * If not provided, the current version of the manager will be used. * * @returns A Promise that resolves to an XML string representing the viewpoint. * The XML string follows the BCF VisualizationInfo schema. * * @throws An error if the world's camera does not have camera controls. * @throws An error if the world's renderer is not available. */ serialize(version?: string): Promise; } /** * Represents a bitmap image associated with a viewpoint. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointBitmap { /** * The type of the bitmap image, either "png" or "jpg". */ bitmap_type: "png" | "jpg"; /** * The base64-encoded string representing the bitmap image data. */ bitmap_data: string; /** * The 3D vector specifying the location of the bitmap in space. */ location: ViewpointVector; /** * The 3D vector specifying the normal direction of the bitmap. */ normal: ViewpointVector; /** * The 3D vector specifying the upward direction of the bitmap. */ up: ViewpointVector; /** * The height of the bitmap in units. */ height: number; } /** * Represents the properties of a camera viewpoint in a 3D space. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointCamera { /** * The position of the camera in 3D space, defined by x, y, and z coordinates. */ camera_view_point: { x: number; y: number; z: number; }; /** * The direction the camera is pointing towards, represented by x, y, and z components. */ camera_direction: { x: number; y: number; z: number; }; /** * The upward direction vector of the camera, used to define the camera's orientation, represented by x, y, and z components. */ camera_up_vector: { x: number; y: number; z: number; }; /** * The aspect ratio of the camera's view, typically defined as the ratio of width to height. */ aspect_ratio: number; } /** * Represents a clipping plane in a viewpoint, defined by its location and direction. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointClippingPlane { /** * The position vector of the clipping plane. */ location: ViewpointVector; /** * The direction vector indicating the orientation of the clipping plane. */ direction: ViewpointVector; } /** * Represents the coloring information for a viewpoint, including the color and associated components. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointColoring { /** * The color associated with the viewpoint, represented as a string (e.g., a hex code or color name). */ color: string; /** * An array of components that are associated with the specified color in the viewpoint. */ components: ViewpointComponent[]; } /** * Represents a component within a viewpoint, typically used in Building Information Modeling (BIM) workflows. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointComponent { /** * The unique identifier for the component in the IFC format. Can be `null` if not applicable. */ ifc_guid: string | null; /** * The identifier of the component as defined by the authoring tool. Can be `null` if not applicable. */ authoring_tool_id: string | null; /** * (Optional) The name of the system or application that originated the component. */ originating_system?: string; } /** * Represents the components of a viewpoint in the BCF API. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointComponents { /** * An array of viewpoint components representing the selection. */ selection: ViewpointComponent[]; /** * An array of viewpoint coloring definitions. */ coloring: ViewpointColoring[]; /** * Defines the visibility settings for the viewpoint. */ visibility: ViewpointVisibility; } /** * Represents a line defined by a start and end point in a viewpoint. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointLine { /** * The starting point of the line, represented as a `ViewpointVector`. */ start_point: ViewpointVector; /** * The ending point of the line, represented as a `ViewpointVector`. */ end_point: ViewpointVector; } /** * Represents an orthogonal camera viewpoint, extending the base `ViewpointCamera` type. This interface is compliant with the BCF API specifications. */ export declare type ViewpointOrthogonalCamera = ViewpointCamera & { /** * Defines the scale factor between the view space and the world space. */ view_to_world_scale: number; }; /** * Represents a perspective camera viewpoint compliant with the BCF API specifications. Extends the `ViewpointCamera` type and includes additional properties specific to perspective cameras. */ export declare type ViewpointPerspectiveCamera = ViewpointCamera & { /** * The field of view of the perspective camera, expressed in degrees. */ field_of_view: number; }; export declare class Viewpoints extends Component implements Disposable_2, Configurable { static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66"; enabled: boolean; /** * Represents the default world where all viewpoints will be created. * A viewpoint can specify a different world if necessary. */ world: World | null; /** * A DataMap that stores Viewpoint instances, indexed by their unique identifiers (guid). * This map is used to manage and retrieve Viewpoint instances within the Viewpoints component. */ readonly list: DataMap_2; /** * A collection of snapshots represented as a mapping between string keys and their corresponding binary data. */ readonly snapshots: DataMap_2; /** * Creates a new Viewpoint instance and adds it to the list. * * @param data - Optional partial data for the Viewpoint. If not provided, default data will be used. * * @returns The newly created Viewpoint instance. */ create(data?: Partial): Viewpoint; constructor(components: Components); /** * Determines the file extension of a snapshot based on its header bytes. * * @param name - The name of the snapshot from the list to retrieve its extension. * @returns The file extension as a string. Defaults to "jpeg" if the snapshot * does not exist or the header bytes do not match known formats. */ getSnapshotExtension(name: string): string; isSetup: boolean; setup(): void; onSetup: Event_2; config: ViewpointsConfigManager; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * Disposes of the Viewpoints component and its associated resources. * * This method is responsible for cleaning up any resources held by the Viewpoints component, * such as disposing of the DataMap of Viewpoint instances and triggering and resetting the * onDisposed event. */ dispose(): void; } /** * Configuration interface for the Viewpoints general behavior. */ declare interface ViewpointsConfig { /** * Indicates whether to overwrite the fragments colors when applying viewpoints. * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any. * @default false */ overwriteColors: boolean; } declare class ViewpointsConfigManager extends Configurator { protected _config: ViewpointsConfigType; get overwriteColors(): boolean; set overwriteColors(value: boolean); } declare type ViewpointsConfigType = { overwriteColors: BooleanSettingsControl; }; /** * Represents a snapshot of a viewpoint, including its type and data. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointSnapshot { /** * The type of the snapshot, either "png" or "jpg". */ snapshot_type: "png" | "jpg"; /** * The base64-encoded string representing the snapshot data. */ snapshot_data: string; } /** * Represents a 3D vector with x, y, and z coordinates. */ export declare interface ViewpointVector { x: number; y: number; z: number; } /** * Represents the visibility settings for a viewpoint. This interface is compliant with the BCF API specifications. */ export declare interface ViewpointVisibility { /** * Indicates whether the default visibility is enabled. */ default_visibility: boolean; /** * A list of viewpoint components that are exceptions to the default visibility. */ exceptions: ViewpointComponent[]; /** * Configuration hints for the viewpoint setup. */ view_setup_hints: { /** * Specifies whether spaces are visible. */ spaces_visible: boolean; /** * Specifies whether space boundaries are visible. */ space_boundaries_visible: boolean; /** * Specifies whether openings are visible. */ openings_visible: boolean; }; } /** * Minimal interface consumed by {@link DrawingViewportHelper}. * Satisfied by {@link DrawingViewport} without a direct import, which keeps * the two classes free of circular dependencies. */ declare interface ViewportBoundsController { left: number; right: number; top: number; bottom: number; } /** * The `Views` class is responsible for managing and interacting with a collection of 2D sections. It provides methods for creating, opening, closing, and managing views, as well as generating views from specific configurations such as IFC storeys or bounding boxes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Views). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Views). */ export declare class Views extends Component { static uuid: "fb22f1f5-6598-4664-a11d-de8963ae420f"; /** * The default range value used by the Views component. * This represents the standard range setting applied unless explicitly overridden. */ static defaultRange: number; /** * A readonly map that associates string keys with `View` instances. * This map is used to store and manage a collection of views. */ readonly list: DataMap_2; enabled: boolean; /** * The default world to be used when creating views. * * - If `world` is set to `null`, views can still specify another world directly in their instance. * - This property allows views to inherit a default world context unless explicitly overridden. */ world: World | null; private _fragmentsUpdateEvent; /** * Determines whether there are any open views in this component's list. */ get hasOpenViews(): boolean; constructor(components: Components); private setupEvents; /** * Creates a new view with the specified normal vector, point, and optional configuration. * * @param normal - The normal vector defining the orientation of the view. * @param point - The point in space where the view is centered. * @param config - Optional configuration for the view creation. * @returns The newly created `View` instance. * @remarks The created view will be added to the component's list data map. */ create(normal: THREE.Vector3, point: THREE.Vector3, config?: CreateViewConfig): View; /** * Creates a new view from the specified plane and optional configuration. * * @param plane - The `THREE.Plane` object representing the plane to create the view from. * @param config - Optional configuration for creating the view. * @returns The newly created `View` instance. * @remarks The created view will be added to the component's list data map. */ createFromPlane(plane: THREE.Plane, config?: CreateViewConfig): View; /** * Creates views from IFC storeys based on the provided configuration. * This method iterates through the fragments of the model, filters storeys * based on the configuration, and generates views for each storey. * * @param config - Optional configuration for creating views from IFC storeys. * @returns A promise that resolves to an array of `View` objects created from the IFC storeys. * * @remarks Each IfcBuilsingStorey is represented as a plane in 3D space, with its elevation adjusted by the `offset`. The created views will be added to the component's list data map. */ createFromIfcStoreys(config?: CreateViewFromIfcStoreysConfig): Promise; /** * Creates views representing the front, back, left, and right sides of bounding boxes for specified models or a combined bounding box of all models. * * @param config - Optional configuration object for creating bounding views. * @returns A promise that resolves to an array of `View` objects created from the boundings. * @remarks The method calculates bounding boxes for the specified models, optionally combines them into a single bounding box, and creates views for the planes representing the bounding box sides. */ createElevations(config?: { combine?: boolean; modelIds?: RegExp[]; world?: World; namingCallback?: (modelId: string) => { front: string; back: string; left: string; right: string; }; }): View[]; /** * Opens a view by its unique identifier. Ensures that no more than one view * is opened in the same world at a time. If the view is already open, the method * returns without performing any action. * * @param id - The unique identifier of the view to open. * @remarks This method changes world camera to use the view's. */ open(id: string): void; /** * Closes a view by its unique identifier and performs necessary cleanup operations. * * @param id - The unique identifier of the view to be closed. If not provided, all opened views across worlds will be closed. * @remarks This method resets the world to use its default camera. */ close(id?: string): void; } /** * Whether it has a UI or not. */ export declare interface WithUi { /** * The UI of the component. */ ui: { [key: string]: () => HTMLElement; }; } /** * Represents a 3D world with meshes, scene, camera, renderer, and other properties. */ export declare interface World extends Disposable_2, Updateable { /** * A set of meshes present in the world. This is taken into account for operations like raycasting. */ meshes: Set; /** * The base scene of the world. */ scene: BaseScene; /** * The default camera of the world. */ defaultCamera: BaseCamera; /** * The base camera of the world. */ camera: BaseCamera; onCameraChanged: Event_2; useDefaultCamera: () => void; /** * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment). */ renderer: BaseRenderer | null; /** * A unique identifier for the world. */ uuid: string; /** * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed). */ isDisposing: boolean; } /** * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds). */ export declare class Worlds extends Component implements Updateable, Disposable_2 { /** * A unique identifier for the component. * This UUID is used to register the component within the Components system. */ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a"; /** {@link Updateable.onAfterUpdate} */ readonly onAfterUpdate: Event_2; /** {@link Updateable.onBeforeUpdate} */ readonly onBeforeUpdate: Event_2; /** {@link Disposable.onDisposed} */ readonly onDisposed: Event_2; /** * A collection of worlds managed by this component. * The key is the unique identifier (UUID) of the world, and the value is the World instance. */ list: DataMap_2; /** {@link Component.enabled} */ enabled: boolean; constructor(components: Components); /** * Creates a new instance of a SimpleWorld and adds it to the list of worlds. * * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene. * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera. * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer. * * @throws {Error} - Throws an error if a world with the same UUID already exists in the list. */ create(): SimpleWorld; /** * Deletes a world from the list of worlds. * * @param {World} world - The world to be deleted. * * @throws {Error} - Throws an error if the provided world is not found in the list. */ delete(world: World): void; /** * Disposes of the Worlds component and all its managed worlds. * This method sets the enabled flag to false, disposes of all worlds, clears the list, * and triggers the onDisposed event. */ dispose(): void; /** {@link Updateable.update} */ update(delta?: number): void | Promise; } export declare class XML { static parser: XMLParser; static builder: XMLBuilder; } export { }