/** * Columnar parser - builds columnar data structures * * OPTIMIZED: Single-pass extraction for maximum performance * Instead of multiple passes through entities, we extract everything in ONE loop. */ import type { EntityRef } from './types.js'; import { StringTable, EntityTableBuilder, PropertyTableBuilder, RelationshipGraphBuilder } from '@ifc-lite/data'; import type { QuantityTable, PropertyValue, IfcStoreBase, IfcEntity, IfcAttributeValue } from '@ifc-lite/data'; import type { EntityByIdIndex } from './columnar-parser-indexes.js'; export type { SpatialIndex, EntityByIdIndex } from './columnar-parser-indexes.js'; export interface IfcDataStore extends IfcStoreBase { parseTime: number; source: Uint8Array; entityIndex: { byId: EntityByIdIndex; byType: Map; }; deferredEntityIndex?: EntityByIdIndex; strings: StringTable; entities: ReturnType; properties: ReturnType; quantities: QuantityTable; relationships: ReturnType; /** * On-demand property lookup: entityId -> array of property set expressIds * Used for fast single-entity property access without pre-building property tables. * Use extractPropertiesOnDemand() with this map for instant property retrieval. */ onDemandPropertyMap?: Map; /** * On-demand quantity lookup: entityId -> array of quantity set expressIds * Used for fast single-entity quantity access without pre-building quantity tables. * Use extractQuantitiesOnDemand() with this map for instant quantity retrieval. */ onDemandQuantityMap?: Map; /** * On-demand classification lookup: entityId -> array of IfcClassificationReference expressIds * Built from IfcRelAssociatesClassification relationships during parsing. */ onDemandClassificationMap?: Map; /** * On-demand material lookup: entityId -> relatingMaterial expressId * Built from IfcRelAssociatesMaterial relationships during parsing. * Value is the expressId of IfcMaterial, IfcMaterialLayerSet, IfcMaterialProfileSet, or IfcMaterialConstituentSet. */ onDemandMaterialMap?: Map; /** * On-demand document lookup: entityId -> array of IfcDocumentReference/IfcDocumentInformation expressIds * Built from IfcRelAssociatesDocument relationships during parsing. */ onDemandDocumentMap?: Map; /** * Project-level length unit scale to convert raw IFC numeric measure * values into base SI metres. `1.0` for metres, `0.001` for milli, * `0.0254` for inches, etc. Surfaced on the store so consumers * (notably the IDS validator, where IDS literals are always in * base SI units) can convert without re-parsing the unit graph. */ lengthUnitScale?: number; } export declare class ColumnarParser { /** * Parse IFC file into columnar data store * * Uses fast semicolon-based scanning with on-demand property extraction. * Properties are parsed lazily when accessed, not upfront. * This provides instant UI responsiveness even for very large files. */ parseLite(buffer: ArrayBuffer | SharedArrayBuffer, entityRefs: EntityRef[], options?: { onProgress?: (progress: { phase: string; percent: number; }) => void; onDiagnostic?: (message: string) => void; yieldIntervalMs?: number; deferPropertyAtomIndex?: boolean; onSpatialReady?: (partialStore: IfcDataStore) => void; }): Promise; /** * Extract properties for a single entity ON-DEMAND * Parses only what's needed from the source buffer - instant results. */ extractPropertiesOnDemand(store: IfcDataStore, entityId: number): Array<{ name: string; globalId?: string; properties: Array<{ name: string; type: number; value: PropertyValue; values?: string[]; dataType?: string; }>; }>; /** * Extract quantities for a single entity ON-DEMAND * Parses only what's needed from the source buffer - instant results. */ extractQuantitiesOnDemand(store: IfcDataStore, entityId: number): Array<{ name: string; quantities: Array<{ name: string; type: number; value: number; }>; }>; } /** * Standalone on-demand property extractor * Can be used outside ColumnarParser class */ export declare function extractPropertiesOnDemand(store: IfcDataStore, entityId: number): Array<{ name: string; globalId?: string; properties: Array<{ name: string; type: number; value: PropertyValue; values?: string[]; }>; }>; /** * Standalone on-demand quantity extractor * Can be used outside ColumnarParser class */ export declare function extractQuantitiesOnDemand(store: IfcDataStore, entityId: number): Array<{ name: string; quantities: Array<{ name: string; type: number; value: number; }>; }>; /** * Extract entity attributes on-demand from source buffer. * Returns globalId, name, description, objectType, tag mapped by schema name * (see {@link extractRootAttributesFromEntity}), so the result stays correct * for entity types whose attribute order differs from the IfcElement layout. * This is used for entities that weren't fully parsed during initial load. */ export declare function extractEntityAttributesOnDemand(store: IfcDataStore, entityId: number): { globalId: string; name: string; description: string; objectType: string; tag: string; }; /** * Extract ALL named entity attributes on-demand from source buffer. * Uses the IFC schema to map attribute indices to names. * Returns only string/enum attributes, skipping references and structural attributes. */ export declare function extractAllEntityAttributes(store: IfcDataStore, entityId: number): Array<{ name: string; value: string | number | boolean; }>; /** * Returns named raw attribute pairs for an entity, filtered to display-relevant attributes. * Skips structural/reference attributes using the IFC schema. Used by query layer for coercion. */ export declare function getRawNamedAttributes(entity: IfcEntity): Array<{ name: string; raw: IfcAttributeValue; }>; /** * Resolve the common IfcRoot-family display attributes (GlobalId, Name, * Description, ObjectType, Tag) from an entity's raw attribute array. * * These are mapped by schema-derived attribute *name*, not fixed index. The * fixed indices `[0],[2],[3],[4],[7]` only hold for the IfcElement layout: for * a spatial element `attrs[7]` is LongName (not Tag), and for a resource entity * like IfcMaterial `attrs[0]` is Name (not GlobalId). Name-mapping keeps all of * these correct for every entity type, returning '' for attributes the type * does not declare. * * For types the schema registry does not recognise (e.g. an IFC4x3 infra leaf * outside the codegen pin, or a vendor extension) we fall back to the canonical * IfcRoot/IfcElement positions so we never regress vs. the old fixed-index path. */ export declare function extractRootAttributesFromEntity(entity: IfcEntity): { globalId: string; name: string; description: string; objectType: string; tag: string; }; /** * Resolve an entity's LongName (IfcZone, IfcSystem subtypes, IfcSpatialZone, * IfcBuildingSystem, …) by schema attribute name. Groups frequently leave Name * empty and carry their human label in LongName, so consumers fall back to this * for the display label. Returns '' when the type does not declare LongName. * (#1075) */ export declare function pickLongName(entity: IfcEntity): string; export { extractClassificationsOnDemand, extractMaterialsOnDemand, extractMaterialPropertiesOnDemand, extractMaterialPropertiesForMaterialId, resolveMaterialDefId, collectMaterialLeaves, buildMaterialUsageIndex, getMaterialDisplay, extractTypePropertiesOnDemand, extractTypeEntityOwnProperties, extractDocumentsOnDemand, extractRelationshipsOnDemand, extractGroupMembersOnDemand, extractGeoreferencingOnDemand, parsePropertyValue, extractPsetsFromIds, } from './on-demand-extractors.js'; export type { ClassificationInfo, MaterialInfo, MaterialLayerInfo, MaterialProfileInfo, MaterialConstituentInfo, MaterialPsetGroup, MaterialLeaf, MaterialUsage, TypePropertyInfo, DocumentInfo, EntityRelationships, GroupMember, GeorefInfo, } from './on-demand-extractors.js'; //# sourceMappingURL=columnar-parser.d.ts.map