import { BimVertexData, BimProductMeshDescriptor } from './bim-format-types';
import { BimIfcIndex } from './BimIfcIndex';
import { BimChangeIfc } from './bim-api-client';
import { BimVertexDataRepository, WriteBatchResult } from './bim-vertex-data-repository';
import { BimPropertySetRepository } from './bim-property-set-repository';
import { BimTransformsRepository } from './bim-transforms-repository';
import { BimIfcObject, BimIfcSpace, BimIfcBuildingStorey } from './bim-ifc-object';
import { Discipline } from './discipline';
import { Materials } from './materials';
import { BimIfcStyle } from './bim-ifc-style';
import { BimIfcClass } from './bim-ifc-class';
import { BimIfcLoaderElementParent } from './bim-ifc-loader';
import { BimApiIfcObjectsLoadOptions } from '../BimApiLoadOptions';
import { BimCoreApiClient } from './client/BimCoreApiClient';
import { FastTransform } from '../math/FastTransform';
import { GeometryArrayOffset, GeometryArrays } from './GeometryBuffer';
import { Matrix, Vector3 } from './babylonjs-maths-import';
import { BimTypeObjectRepository } from './BimTypeObjectRepository';
import { Failure } from '../fail';
import { BimProductMesh } from './BimProductMesh';
import { BimGeometricFeaturesRepository } from './bim-geometric-features-repository';
import { T8BimIfcLoaderElementCreateFailure } from './T8BimIfcLoaderElement';
export type GeometryFormat = 'geom' | 't8gd';
/**
 * Represents an IFC file and provides access to its data.
 */
export interface IBimIfcLoaderElement {
    /**
     * The total number of vertices contained in all instances of {@link BimProductMesh}
     * in this IFC file.
     */
    readonly numberOfVertices: number;
    /**
     * The total number of indices contained in all instances of {@link BimProductMesh}
     * in this IFC file.
     */
    readonly numberOfIndices: number;
    /**
     * The total number of triangles contained in all instances of {@link BimProductMesh}
     * in this IFC file.
     */
    readonly numberOfTriangles: number;
    /**
     * All {@link BimIfcClass} instances referenced by {@link BimProduct}'s in the IFC file this instance represents.
     */
    readonly classes: BimIfcClass[];
    /**
     * The IfcProject instance of the IFC file this instance represents.
     */
    readonly project: BimIfcObject;
    /**
     * The format that the geometry is stored in.
     */
    readonly geometryFormat: GeometryFormat;
    /**
     * The total number of {@link BimProductMesh} instances in the IFC file this instance represents.
     * Same as {@link ifcProductsWithGeometryCount}.
     */
    readonly meshCount: number;
    /**
     * The total number of {@link BimProductMesh} instances in the IFC file this instance represents.
     * Same as {@link meshCount}.
     */
    readonly ifcProductsWithGeometryCount: number;
    /**
     * All IfcSpace ({@link BimIfcSpace}) instances in the IFC file this instance represents.
     */
    readonly spaces: BimIfcSpace[];
    /**
     * All IfcBuildingStorey ({@link BimIfcBuildingStorey}) instances in the IFC file this instance represents.
     */
    readonly floors: BimIfcBuildingStorey[];
    /**
     * All IFC products in the IFC file this instance represents. Here represented as a flat list.
     */
    readonly products: BimIfcObject[];
    /**
     * The discipline of the IFC file this instance represents.
     */
    readonly discipline: Discipline;
    /**
     * The IFC index (.idx file)  of the IFC file this instance represents. This describes (in a very raw format)
     * the content of the IFC file. It does not include any geometry or property sets.
     */
    readonly index: BimIfcIndex;
    /**
     * Url where the IFC index (.idx file) will be retrieved from.
     */
    readonly indexUrl: URL | undefined;
    /**
     * Url where the IFC geometry (.geom file) will be retrieved from.
     */
    readonly geometryUrl: URL | undefined;
    /**
     * Url where the IFC property set (.prop file) will be retrieved from.
     */
    readonly propertiesUrl: URL | undefined;
    /**
     * Url where the IFC geometric features file (.geom-feature file) will be retrieved from.
     */
    readonly geometricFeaturesUrl: URL | undefined;
    /**
     * Reference to the transform repository this instance uses when
     * transforming IFC product geometries.
     */
    readonly transformsRepository: BimTransformsRepository;
    /**
     * Reference to the type object repository this instance uses for type properties.
     */
    readonly typeObjectRepository: BimTypeObjectRepository;
    /**
     * Reference to a {@link Materials} instance.
     */
    readonly materials: Materials;
    /**
     * All IFC styles that the {@link BimProductMesh} instances in the IFC file refers to.
     * The styles are used to color the meshes.
     */
    readonly styles: BimIfcStyle[];
    /**
     * The url where the contents of the IFC file can be retrieved from.
     */
    readonly ifcUrl: URL;
    /**
     * The name of the IFC file this instance represents.
     */
    readonly ifcName: string;
    /**
     * The {@link BimApiIfcObjectsLoadOptions} options (if any) that was used when this instance was created.
     */
    readonly loadOptions?: BimApiIfcObjectsLoadOptions;
    /**
     * The loader this instance belongs to.
     */
    readonly loader: BimIfcLoaderElementParent;
    /**
     * The IFC change (file) this instance represents.
     */
    readonly ifc: BimChangeIfc;
    /**
     * An optional transform for the IFC file. This transform will be applied to all IFC product geometries
     */
    readonly transform?: Matrix;
    /**
     * Ensures that the vertex data is loaded.
     * @returns A promise that resolves to a boolean. See it as a signal. I will be true if the call actualy loaded the data. Otherwhise it will be false (data loading is either in progress or has completed).
     */
    ensureVertexDataLoaded(): Promise<boolean>;
    /**
     * Gets the vertex data for a given product mesh descriptor.
     * @param productMeshDescriptor - The product mesh descriptor.
     * @returns The vertex data.
     */
    getVertexData(productMeshDescriptor: BimProductMeshDescriptor): BimVertexData;
    /**
     * Writes the vertex data to the specified destination.
     * @param ifcProductMesh - The IFC product mesh.
     * @param transform - The transformation matrix.
     * @param destination - The destination geometry arrays.
     * @param offset - The offset in the geometry arrays.
     * @param aabb - The axis-aligned bounding box.
     * @returns The actual vertex and index counts written.
     */
    writeVertexData(ifcProductMesh: BimProductMesh, transform: FastTransform, destination: GeometryArrays, offset: GeometryArrayOffset, aabb: {
        min: Vector3;
        max: Vector3;
    }, options: {
        includeNormals?: boolean;
    }): {
        vertexCount: number;
        indexCount: number;
    };
    /**
     * Whether batch vertex data writing is supported via WASM.
     */
    readonly hasBatchSupport: boolean;
    /**
     * WASM memory usage in bytes.
     */
    readonly wasmMemoryUsage: {
        used: number;
        capacity: number;
        allocated: number;
        outputBuffers: number;
    };
    /**
     * Writes vertex data for multiple meshes in a single batch operation using WASM.
     * Falls back to undefined if batch support is not available.
     * @param meshes - The meshes to write.
     * @param destination - The destination geometry arrays.
     * @param offset - The offset in the geometry arrays.
     * @returns The batch result containing AABB and counts, or undefined if batch is not available.
     */
    writeBatch(meshes: BimProductMesh[], destination: GeometryArrays, offset: GeometryArrayOffset): WriteBatchResult | undefined;
    /**
     * Loads the property sets and assigns them to the IFC products contained within this instance.
     * @returns A promise that resolves to a boolean indicating whether the property set was loaded
     */
    loadPropertySets(): Promise<boolean>;
    /**
     * Loads the geometric feature data and assigns them to the IFC product meshes contained within this instance.
     * @returns A promise that resolves to a boolean indicating whether the geometric feature data was loaded
     *
     * @internal
     * @hidden
     */
    loadGeometricFeatures(): Promise<boolean>;
    /**
     * Access the geometric features repository for per-mesh edge resolution.
     * @internal
     * @hidden
     */
    readonly geometricFeaturesRepository: BimGeometricFeaturesRepository;
    /**
     * Calculates, or extends a existing, axis-aligned bounding box (AABB) of the regions in the IFC file this instance represents.
     * The provided min, and max values will be updated to contain the min and max values of the AABB.
     * @param min Will be set to min vector of the AABB after call. If not part of existing AABB it must be set to (Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE)
     * @param max Will be set to max vector of the AABB after call. If not part of existing AABB it must be set to (Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE)
     * @param o Optional. Options object. If `onlyMostPopulatedRegions` is set to `true` then only the most populated regions will be considered.
     * @returns `true` if a valid AABB was calculated. Otherwise `false`. If `false` is returned then the min and max values will not be updated.
     * @example
     * ```typescript
     * // Example of how to calculate a AABB that encompasses the most populated regions of two IFC files.
     * const min = setMax(Vector3.Zero());
     * const max = setMin(Vector3.Zero());
     * // min and max will now contain the min and max values of the AABB encompassing the mostly populated region in loaderElementA.
     * loaderElementA.tryCreateOrExtendAABBFromRegions(min, max, { onlyMostPopulatedRegions: true});
     * // min and max will now contain the min and max values of the AABB that encompasses both loaderElementA and loaderElementB.
     * loaderElementB.tryCreateOrExtendAABBFromRegions(min, max, { onlyMostPopulatedRegions: true});
     * ```
     */
    tryCreateOrExtendAABBFromRegions(min: Vector3, max: Vector3, o?: {
        onlyMostPopulatedRegions?: boolean;
    }): boolean;
}
/**
 * Represents a predicate function used to query BIM products.
 * The function takes a `loaderElement` of type {@link BimIfcLoaderElement} and a `bimIfcObject` of type {@link BimIfcObject} as parameters,
 * and returns a boolean value indicating whether the object satisfies the query condition.
 */
export interface BimProductQueryPredicate {
    (loaderElement: BimIfcLoaderElement, bimIfcObject: BimIfcObject): boolean;
}
/**
 * Represents the failure result when creating a {@link BimIfcLoaderElement} fails.
 */
export type BimIfcLoaderElementCreateFailure = Failure<{
    /**
     * Status of the HTTP request that failed.
     */
    httpStatus: number;
    /**
     * Gives the reason for the failure.
     */
    reason: string;
} & {
    ifc: Pick<BimChangeIfc, 'id' | 'version' | 'url'>;
}>;
/**
 * Represents an IFC file and provides access to its data.
 */
export declare class BimIfcLoaderElement implements IBimIfcLoaderElement {
    readonly loader: BimIfcLoaderElementParent;
    readonly ifcHttpResource: BimChangeIfc;
    readonly materials: Materials;
    readonly index: BimIfcIndex;
    private readonly _propertySetRepository;
    private readonly _geometricFeaturesRepository;
    private readonly _vertexDataRepository;
    readonly loadOptions?: BimApiIfcObjectsLoadOptions | undefined;
    readonly transform?: Matrix | undefined;
    private _numberOfVertices;
    private _numberOfIndices;
    private _ifcUrl;
    private readonly _objectAttributes;
    /** @inheritDoc */
    readonly transformsRepository: BimTransformsRepository;
    /** @inheritDoc */
    readonly typeObjectRepository: BimTypeObjectRepository;
    /** @inheritDoc */
    readonly project: BimIfcObject;
    /** @inheritDoc */
    readonly spaces: BimIfcSpace[];
    /** @inheritDoc */
    readonly floors: BimIfcBuildingStorey[];
    /** @inheritDoc */
    readonly products: BimIfcObject[];
    /** @inheritDoc */
    readonly meshCount: number;
    /** @inheritDoc */
    readonly discipline: Discipline;
    /** @inheritDoc */
    readonly styles: BimIfcStyle[];
    /** @inheritDoc */
    readonly classes: BimIfcClass[];
    /** @inheritDoc */
    readonly ifcName: string;
    private _propertySetLoadResult?;
    private _geometricFeaturesPromise?;
    private constructor();
    /**
     * Creates a new instance of the BimIfcLoaderElement class.
     *
     * @param bimApi - The {@link BimCoreApiClient} instance.
     * @param materials - The {@link Materials} instance.
     * @param vertexDataRepository - The {@link BimVertexDataRepository} instance.
     * @param propertySetRepository - The {@link BimPropertySetRepository} instance.
     * @param geometricFeaturesRepository - The {@link BimGeometricFeaturesRepository} instance.
     * @param parent - The {@link BimIfcLoaderElementParent} instance.
     * @param ifcHttpResource - The {@link BimChangeIfc} instance.
     * @param options - Optional. The {@link BimApiIfcObjectsLoadOptions} instance.
     * @param transform - Optional. The `Matrix` instance that will be applied to all transformations in the IFC.
     * @returns A Promise that resolves to a {@link BimIfcLoaderElement} instance or a {@link BimIfcLoaderElementCreateFailure} instance.
     */
    static create(bimApi: BimCoreApiClient, materials: Materials, vertexDataRepository: BimVertexDataRepository, propertySetRepository: BimPropertySetRepository, geometricFeaturesRepository: BimGeometricFeaturesRepository, parent: BimIfcLoaderElementParent, ifcHttpResource: BimChangeIfc, options?: BimApiIfcObjectsLoadOptions, transform?: Matrix): Promise<IBimIfcLoaderElement | BimIfcLoaderElementCreateFailure | T8BimIfcLoaderElementCreateFailure>;
    /** @inheritDoc */
    get ifc(): BimChangeIfc;
    /** @inheritDoc */
    get ifcUrl(): URL;
    /** @inheritDoc */
    get numberOfVertices(): number;
    /** @inheritDoc */
    get numberOfIndices(): number;
    /** @inheritDoc */
    get numberOfTriangles(): number;
    /** @inheritDoc */
    get ifcProductsWithGeometryCount(): number;
    /** @inheritDoc */
    get indexUrl(): URL | undefined;
    /** @inheritDoc */
    get geometryUrl(): URL | undefined;
    /** @inheritDoc */
    get propertiesUrl(): URL | undefined;
    /** @inheritDoc */
    get geometricFeaturesRepository(): BimGeometricFeaturesRepository;
    /** @inheritDoc */
    get geometricFeaturesUrl(): URL | undefined;
    /** @inheritDoc */
    ensureVertexDataLoaded(): Promise<boolean>;
    /** @inheritDoc */
    getVertexData(productMeshDescriptor: BimProductMeshDescriptor): BimVertexData;
    get geometryFormat(): GeometryFormat;
    /** @inheritDoc */
    tryCreateOrExtendAABBFromRegions(min: Vector3, max: Vector3, o?: {
        onlyMostPopulatedRegions?: boolean;
    }): boolean;
    /** @inheritDoc */
    writeVertexData(ifcProductMesh: BimProductMesh, transform: FastTransform, destination: GeometryArrays, offset: GeometryArrayOffset, aabb: {
        min: Vector3;
        max: Vector3;
    }, options: {
        includeNormals?: boolean;
    }): {
        vertexCount: number;
        indexCount: number;
    };
    /** @inheritDoc */
    get hasBatchSupport(): boolean;
    /** @inheritDoc */
    get wasmMemoryUsage(): {
        used: number;
        capacity: number;
        allocated: number;
        outputBuffers: number;
    };
    /** @inheritDoc */
    writeBatch(meshes: BimProductMesh[], destination: GeometryArrays, offset: GeometryArrayOffset): WriteBatchResult | undefined;
    /** @inheritDoc */
    loadPropertySets(clearCache?: boolean): Promise<boolean>;
    /**
     * @internal
     * @hidden
     */
    loadGeometricFeatures(clearCache?: boolean): Promise<boolean>;
    private doLoadGeometricFeatures;
    private deleteUnreferencedTransforms;
    private deleteUnreferencedMeshDescriptors;
    private deleteLeafNodesWithNoGeometry;
    private isValidAABB;
}
//# sourceMappingURL=bim-ifc-loader-element.d.ts.map