/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */ /** * Built-in component types and runtime stubs. * Auto-generated by platform_builtin-components/scripts/distribute-types.mjs */ import type * as OBC from '@thatopen/components'; import type * as THREE from 'three'; import type { EngineServicesClient, Item, ItemFolder, ItemVersion, PlatformClient } from '../'; export interface CDEContext { client: PlatformClient; projectId: string; } export interface CDEUserPermissions { canRead: boolean; canCreate: boolean; canUpdate: boolean; canDelete: boolean; canManage: boolean; } export type CDEMetadataValue = string | number | boolean | null; export interface CDENamingSegment { key: string; config?: { transform: (value: CDEMetadataValue) => string; }; } export interface CDENamingSchema { separator: string; segments: CDENamingSegment[]; } export interface CDEFile extends Omit { createdBy: string; metadata: Record; versions?: ItemVersion[]; /** Tag of the file's current version (set by CDEManager from the loaded version). */ versionTag?: string; } export interface CDEMetadataField { type: "string" | "number" | "boolean" | "list"; description?: string; required?: boolean; label: string; icon?: string; options?: { value: string | number | boolean; label: string; }[]; } export type CDEMetadataSchema = Record; export interface CDEFileActivity { user: string; action: string; timestamp: string; } export interface CDEFileHistoryEntry { fileId: string; activity: CDEFileActivity[]; } export interface CDEMetadataView { id: string; name: string; fields: string[]; } export type CDEPendingMetadata = Record; export type CDEPendingMetadataSchemaEdits = Record; export type FolderPendingChange = { kind: "create"; tempId: string; name: string; parentId: string | null; } | { kind: "rename"; folderId: string; name: string; } | { kind: "archive"; folderId: string; }; export type FolderPendingChanges = FolderPendingChange[]; export type CDEViewFileStatus = "loading" | "ready" | "failed" | "cancelled"; export type CDEMachineState = { kind: "idle"; } | { kind: "loading"; } | { kind: "preparing"; files: CDEFile[]; } | { kind: "selected"; files: CDEFile[]; } | { kind: "viewing"; files: CDEFile[]; fileStatus: Record; selectedFiles?: CDEFile[]; } | { kind: "editing"; files: CDEFile[]; pendingMetadata: CDEPendingMetadata; } | { kind: "saving"; files: CDEFile[]; pendingMetadata: CDEPendingMetadata; } | { kind: "deleting"; files: CDEFile[]; } | { kind: "configuringMetadataSchema"; pendingEdits: CDEPendingMetadataSchemaEdits; } | { kind: "savingMetadataSchema"; pendingEdits: CDEPendingMetadataSchemaEdits; } | { kind: "configuringMetadataViews"; pendingViews: CDEMetadataView[]; } | { kind: "savingMetadataViews"; pendingViews: CDEMetadataView[]; } | { kind: "dragging"; files: CDEFile[]; sourceFolderId: string | null; previousState: CDEMachineState; } | { kind: "movingFiles"; files: CDEFile[]; targetFolderId: string; } | { kind: "draggingFolder"; folderId: string; parentFolderId: string | null; previousState: CDEMachineState; } | { kind: "movingFolder"; folderId: string; targetFolderId: string | null; } | { kind: "editingFolders"; pendingChanges: FolderPendingChanges; } | { kind: "savingFolderChanges"; pendingChanges: FolderPendingChanges; } | { kind: "editingFiles"; pendingEdits: Record>; pendingArchives: string[]; pendingRenames: Record; previousState: { kind: "idle"; } | { kind: "selected"; files: CDEFile[]; }; } | { kind: "savingFiles"; pendingEdits: Record>; pendingArchives: string[]; pendingRenames: Record; previousState: { kind: "idle"; } | { kind: "selected"; files: CDEFile[]; }; } | { kind: "error"; reason: string; previous: CDEMachineState; }; export type CDEMachineEvent = { type: "LOAD"; } | { type: "UPLOAD"; } | { type: "DOWNLOAD"; } | { type: "SELECT"; files: CDEFile[]; } | { type: "DESELECT"; } | { type: "VIEW"; } | { type: "ADD_TO_VIEW"; file: CDEFile; } | { type: "REMOVE_FROM_VIEW"; fileId: string; } | { type: "CLOSE_VIEW"; } | { type: "SET_VIEW_FILE_STATUS"; fileId: string; status: CDEViewFileStatus; } | { type: "START_EDIT"; } | { type: "UPDATE_METADATA"; key: string; value: CDEMetadataValue; } | { type: "SAVE"; } | { type: "CANCEL_EDIT"; } | { type: "ARCHIVE_FILE"; } | { type: "START_CONFIGURE_METADATA_SCHEMA"; } | { type: "ADD_METADATA_FIELD"; } | { type: "UPDATE_METADATA_FIELD"; key: string; value: CDEMetadataField; } | { type: "DELETE_METADATA_FIELD"; key: string; } | { type: "RESTORE_METADATA_FIELD"; key: string; } | { type: "SAVE_METADATA_SCHEMA"; } | { type: "CANCEL_CONFIGURE_METADATA_SCHEMA"; } | { type: "START_DRAG"; files: CDEFile[]; sourceFolderId: string | null; } | { type: "END_DRAG"; } | { type: "DROP_FILES"; targetFolderId: string | null; } | { type: "START_FOLDER_DRAG"; folderId: string; parentFolderId: string | null; } | { type: "END_FOLDER_DRAG"; } | { type: "DROP_FOLDER"; targetFolderId: string | null; } | { type: "START_EDIT_FILES"; } | { type: "UPDATE_FILE_METADATA"; fileId: string; key: string; value: CDEMetadataValue; } | { type: "REVERT_FILE_METADATA"; fileId: string; } | { type: "ARCHIVE_FILE_EDIT"; fileId: string; } | { type: "UNARCHIVE_FILE_EDIT"; fileId: string; } | { type: "RENAME_FILE"; fileId: string; name: string; } | { type: "RENAME_FILE_IMMEDIATE"; fileId: string; name: string; } | { type: "SAVE_FILE_EDITS"; } | { type: "CANCEL_EDIT_FILES"; } | { type: "START_EDIT_FOLDERS"; } | { type: "ADD_FOLDER"; tempId: string; name: string; parentId: string | null; } | { type: "RENAME_FOLDER"; folderId: string; name: string; } | { type: "ARCHIVE_FOLDER"; folderId: string; } | { type: "SAVE_FOLDER_CHANGES"; } | { type: "CANCEL_FOLDER_CHANGES"; } | { type: "RESET_FOLDER"; folderId: string; } | { type: "START_CONFIGURE_METADATA_VIEWS"; } | { type: "ADD_METADATA_VIEW"; } | { type: "UPDATE_METADATA_VIEW"; id: string; view: CDEMetadataView; } | { type: "DELETE_METADATA_VIEW"; id: string; } | { type: "SAVE_METADATA_VIEWS"; } | { type: "CANCEL_CONFIGURE_METADATA_VIEWS"; } | { type: "SET_ACTIVE_METADATA_VIEW"; id: string | null; } | { type: "SET_GROUPS_VIEW_MODE"; mode: "groups" | "metadata"; } | { type: "FAIL"; reason: string; } | { type: "DISMISS"; }; declare class _CDEManager extends OBC.Component implements OBC.Transitionable { static readonly uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61"; readonly onFilesChanged: OBC.Event; readonly onFoldersChanged: OBC.Event; readonly onPermissionsChanged: OBC.Event; readonly onSelectedGroupChanged: OBC.Event; readonly onMachineStateChanged: OBC.Event; readonly onMetadataViewsChanged: OBC.Event; readonly onGroupsViewModeChanged: OBC.Event<"groups" | "metadata">; readonly onMetadataGroupChanged: OBC.Event | null>; readonly onDownloadReady: OBC.Event<{ blob: Blob; filename: string; }>; readonly onUploadCompleted: OBC.Event<{ created: CDEFile[]; versioned: CDEFile[]; }>; readonly onFolderChangesCompleted: OBC.Event<{ created: number; renamed: number; archived: number; }>; readonly onFilesMovedCompleted: OBC.Event<{ files: CDEFile[]; targetFolderName: string | null; }>; readonly onRenameCompleted: OBC.Event<{ success: boolean; error?: string; }>; readonly onFolderMovedCompleted: OBC.Event<{ folderName: string; targetFolderName: string | null; }>; readonly onShowArchivedChanged: OBC.Event; readonly onRestoreCompleted: OBC.Event<{ files?: CDEFile[]; folder?: ItemFolder; }>; readonly onUploadStarted: OBC.Event<{ count: number; }>; readonly onIfcConversionStarted: OBC.Event<{ file: CDEFile; }>; readonly onIfcConversionProgress: OBC.Event<{ file: CDEFile; progress: number; }>; readonly onIfcConversionCompleted: OBC.Event<{ file: CDEFile; success: boolean; error?: string; }>; /** Fires when `_derivedFileIds` finishes a (re)sync — consumers that filter * or resolve by source↔derived link (e.g. `top-files-panel` hiding an * already-linked `.frag` row) should reload on this, since it can complete * after `onFilesChanged` already fired with the (still unsynced) list. */ readonly onDerivedFileIdsChanged: OBC.Event>; readonly conversionProgress: Map; enabled: boolean; projectName: string; missingMetadataPlaceholder: string; availableColumns: Set; visibleColumns: Set; ctx?: CDEContext; private _machineState; private _activeUploads; private _showArchived; private _preArchivedViewMode; private _archivedFiles; private _archivedFolders; private _archivedLoaded; viewerGroups: { extensions: string[]; multiple?: boolean; }[]; get viewableExtensions(): Set; private _files; /** ifcFileId → its linked derivedFileId (FRAG today; other source formats * once they get a converter too), read from each IFC's own version * metadata. Kept as an in-memory cache — synced by `_syncDerivedFileIds` * whenever `_files` is (re)set, or right after a conversion succeeds — * rather than fetched live per call, so `resolveViewFile` can stay a plain * synchronous lookup (same contract as before, no ripple into * `sendMachineEvent`'s callers). */ private _derivedFileIds; private _folders; private _fileHistory; private _metadataSchema; private _metadataViews; private _activeMetadataViewId; private _groupsViewMode; private _selectedGroup; private _selectedMetadataGroup; private _namingSchema; cacheMaxBytes: number; cacheExtensions: Set; private _fileCache; private _fileCacheBytes; private _dedup; private _cacheKey; private _isCacheable; private _addToCache; downloadFile(file: CDEFile): Promise; private _permissions; private _projectDataFolderId; private _appFolderIds; /** In-flight folder ensures. Two concurrent first calls (user config and * app config load in parallel) used to each miss the cache and create a * second folder of the same name; the promise is the lock. */ private _projectDataFolderPromise; private _appFolderPromises; private _excludedFolderIds; private _projectMembers; get projectMembers(): { fullName: string; email: string; role: string; }[]; get userPermissions(): CDEUserPermissions; query: string | null; get machineState(): CDEMachineState; get files(): CDEFile[]; set files(value: CDEFile[]); /** ifcFileId → derivedFileId — see `_derivedFileIds`. */ get derivedFileIds(): Record; get folders(): ItemFolder[]; set folders(value: ItemFolder[]); get showArchived(): boolean; set showArchived(value: boolean); get fileHistory(): CDEFileHistoryEntry[]; set fileHistory(value: CDEFileHistoryEntry[]); get metadataSchema(): CDEMetadataSchema; set metadataSchema(value: CDEMetadataSchema); get selectedGroup(): string | null; set selectedGroup(value: string | null); get metadataViews(): CDEMetadataView[]; get activeMetadataViewId(): string | null; get activeMetadataView(): CDEMetadataView | null; get groupsViewMode(): "groups" | "metadata"; get selectedMetadataGroup(): Record | null; set selectedMetadataGroup(value: Record | null); get visibleFiles(): CDEFile[]; get namingSchema(): CDENamingSchema | null; constructor(components: OBC.Components); hasViewer(extension: string): boolean; private _groupOf; private _sameGroup; canView(files: CDEFile[]): boolean; canAddToView(files: CDEFile[]): boolean; setNamingSchema(schema: CDENamingSchema): void; buildFileName(file: CDEFile): string; getSelectedFiles(): CDEFile[]; getActivity(fileId: string): CDEFileActivity[]; updateFilesMetadata(fileIds: string[], updates: Record): Promise; /** The context this component cannot work without. Reading or writing * project data with no context used to resolve with null / the empty * string while persisting NOTHING - a call indistinguishable from * success, which cost an integrator days (reported 2026-10-01). A * missing context is a setup problem and must say so. */ private _requireCtx; readProjectData(app: string, filename: string): Promise; writeProjectData(app: string, filename: string, data: unknown): Promise; /** Of several same-named folders, always the oldest. Duplicates exist in * real projects (the backend had no unique index and this class had no * lock), and `loadFolders` used to pick the LAST root match while the * ensure path picked the FIRST: reads and writes could land in different * folders of the same name. ObjectIds sort by creation time as strings. */ private static _oldest; private _ensureProjectDataFolder; private _ensureAppFolder; private _loadPermissions; loadFolders(): Promise; createFolder(name: string, parentId?: string): Promise; getUserId(): Promise; loadUserConfig(): Promise<{ visibleColumns?: string[]; metadataViews?: CDEMetadataView[]; hideDerivedFiles?: boolean; } | null>; saveUserConfig(config: { visibleColumns?: string[]; metadataViews?: CDEMetadataView[]; hideDerivedFiles?: boolean; }): Promise; loadMetadataSchema(): Promise; initMetadataViews(views: CDEMetadataView[], activeId: string | null): void; loadArchivedItems(): Promise; restoreFiles(files: CDEFile[]): Promise; restoreFolder(folderId: string): Promise; detectConflicts(files: File[]): { file: File; existing: CDEFile; }[]; checkMoveConflicts(files: CDEFile[], targetFolderId: string | null): { file: CDEFile; existing: CDEFile; }[]; /** Which file to actually load when the user views `file` — its linked FRAG * if it has one, else the IFC itself. Reads `_derivedFileIds` (the IFC's * own version metadata, kept in sync — see `_syncDerivedFileIds`), NOT a * name+folder match anymore. Stays synchronous: `_derivedFileIds` is a * pre-synced in-memory cache, so this is a plain lookup, keeping the * contract every existing caller (`sendMachineEvent`'s `VIEW` case, * `top-files-panel`'s "add to view" actions) already relies on. */ resolveViewFile(file: CDEFile): CDEFile; /** Populates `_derivedFileIds` from every IFC's own version metadata — the * source of truth for the IFC↔FRAG link (same mechanism as `models-list`'s * `_syncDerivedFileIds`). Reads the unified `derivedFileId` key, falling * back to the legacy `fragmentsFileId` key that `IfcFragmenter` still * stamps until it's updated (see issue #3, Task 3). Called whenever * `_files` is (re)set and right after a conversion succeeds — never * cached indefinitely, so a reconversion or manual metadata edit is picked * up on the next sync instead of going stale. */ private _syncDerivedFileIds; private _saveConversionIndex; private _loadConversionIndex; private _resumePendingConversions; /** Cached id of the IfcFragmenter component, resolved by name for this session. */ private _ifcFragmenterId?; /** * Resolves the platform IFC→FRAG cloud component's id by its stable name * (`IfcFragmenter`) within the current project, so it works across dev/prod * without a hardcoded id. Cached for the session. Returns `undefined` if no * such component is available in the project. */ private _resolveIfcFragmenterId; private _triggerIfcConversions; uploadFiles(files: File[], folderId?: string | null, options?: { forceNew?: boolean; }): Promise; sendMachineEvent(event: CDEMachineEvent): void; private _transition; private _getAllArchivedIds; private _collectTempDescendants; private _saveFolderChanges; private _moveFolder; moveFiles(files: CDEFile[], targetFolderId: string | null): Promise; private _moveFiles; private _resolveFullName; private _prepareDownload; private _saveMetadataSchema; private _resolveKeys; private _saveFileMetadata; private _renameFileImmediate; private _saveFileEdits; private _applyMetadataEdits; private _applyMetadataSchemaEdits; private _saveMetadataViews; private _archiveFiles; } export type CDEManager = InstanceType; export const CDEManager = { uuid: 'a3f82c1d-5b74-4e9a-bc30-d7e12f894a61' } as typeof _CDEManager & { uuid: 'a3f82c1d-5b74-4e9a-bc30-d7e12f894a61' }; export type ClashStatus = "new" | "active" | "resolved" | "acknowledged"; export type ClashType = "hard" | "clearance"; export interface ClashElement { guid: string; name: string; localId: number; modelId: string; } export interface ClashQueryFilter { categories?: string[]; attributes?: { aggregation?: 'exclusive' | 'inclusive'; queries: Array<{ name: string; value?: string | string[] | number | boolean; type?: string; negate?: boolean; }>; }; relation?: { name: string; query?: ClashQueryFilter; }; } export interface ClashQuery { id: string; name: string; modelFileIds: string[]; /** Filter conditions. Omit or leave empty to match all elements with geometry. */ query?: ClashQueryFilter; } export interface ClashMatrix { id: string; name: string; /** Ordered list of query IDs — index order = priority (0 = most constrained). */ queryIds: string[]; /** Active cell job IDs (subset of upper-triangle pairs). */ jobIds: string[]; /** Active upper-triangle pair keys in the form "queryAId:queryBId". */ activePairs: string[]; /** Clash type applied to all jobs generated by this matrix. Defaults to 'hard'. */ jobType?: ClashType; /** Clearance tolerance in metres. Only used when jobType is 'clearance'. */ tolerance?: number; } export interface ClashJob { id: string; name: string; type: ClashType; queryAId: string; queryBId: string; matrixId?: string; /** Clearance tolerance in metres. Only present when type is 'clearance'. */ tolerance?: number; } export interface ClashRun { id: string; jobId: string; date: string; clashCount: number; } interface ClashBase { /** Deterministic FNV-1a hash of the normalized pair (elementA.guid, elementB.guid). Stable across runs. */ id: string; jobId: string; firstSeenRunId: string; lastSeenRunId: string; elementA: ClashElement; elementB: ClashElement; point: [number, number, number]; status: ClashStatus; comments?: string; } export interface HardClash extends ClashBase { type: "hard"; volume?: number; } export interface ClearanceClash extends ClashBase { type: "clearance"; distance: number; } export type Clash = HardClash | ClearanceClash; export interface MarkerGroup { id?: string; point: [number, number, number]; count: number; status?: ClashStatus; } /** `clashes.frag`'s path relative to `__project_data/`, for consumers that * persist it via `projectStorageContext` instead of talking to `client` * directly (see `buildClashBuffer`). */ export declare const CLASH_DATA_PATH = "collider/clashes.frag"; export interface ExecutionEntry { jobId: string; executionId: string; startedAt: string; } /** `cachedFileId`, when given, skips folder/file resolution (3 of the 4 * network round-trips this normally takes) — the file's ID never changes * once created, so callers that already know it (see `ClashesManager`'s * `_clashFragFileId`) should always pass it. */ export declare function ensureClashFragFileId(client: PlatformClient, projectId: string, cachedFileId?: string): Promise; export declare function getExecutions(client: PlatformClient, projectId: string | undefined): Promise; export interface ClashData { jobs: ClashJob[]; runs: ClashRun[]; clashes: Clash[]; queries: ClashQuery[]; matrices: ClashMatrix[]; /** Resolved once here — callers should cache and pass back into * `loadClashData`/`buildClashBuffer` as `cachedFileId` to skip * re-resolving it (see `ensureClashFragFileId`). */ fileId: string; } export declare function loadClashData(client: PlatformClient, projectId: string, cachedFileId?: string): Promise; /** * Diffs `data` against the persisted `clashes.frag` and builds the updated * buffer, WITHOUT uploading it — callers decide how/where to persist the * result (direct `client.updateFile`, via `projectStorageContext`, etc). * Still reads the current file via `client` to diff against (job/id * reconciliation needs the previous state), same as `saveClashData` always did. */ export declare function buildClashBuffer(client: PlatformClient, projectId: string, data: { queries: ClashQuery[]; matrices: ClashMatrix[]; jobs: ClashJob[]; clashes: Clash[]; }, onJobsReconciled: (toAdd: ClashJob[], toRemove: Set) => void, cachedFileId?: string): Promise<{ blob: Blob; fileId: string; }>; /** Default persistence path: builds the buffer and uploads it straight to * `client`. Kept as the manager's out-of-the-box behavior for any consumer * that never overrides `ClashesManager.save` (e.g. doesn't route through * `projectStorageContext`). */ export declare function saveClashData(client: PlatformClient, projectId: string, data: { queries: ClashQuery[]; matrices: ClashMatrix[]; jobs: ClashJob[]; clashes: Clash[]; }, onJobsReconciled: (toAdd: ClashJob[], toRemove: Set) => void): Promise; declare class _ClashesManager extends OBC.Component { static readonly uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f"; enabled: boolean; readonly onQueriesChanged: OBC.Event; readonly onMatricesChanged: OBC.Event; readonly onJobsChanged: OBC.Event; readonly onRunsChanged: OBC.Event; readonly onClashesChanged: OBC.Event; readonly onClashStatusChanged: OBC.Event; /** Dispara cuando empieza el debounce de guardado (pendiente de persistir). */ readonly onSaveStart: OBC.Event; /** Dispara al terminar el guardado. true = éxito, false = error. */ readonly onSaveComplete: OBC.Event; world?: OBC.World; /** Suprimir auto-save durante carga de datos (usar loadingData = true antes, false después). */ loadingData: boolean; /** Registrar desde la app host para recargar datos desde el storage al terminar una ejecución. */ reload?: () => Promise; /** Registrar desde la app host para consultar qué jobIds tienen ejecución activa en storage. */ checkExecutions?: () => Promise>; /** Registrar desde la app host para persistir queries y matrices al storage del proyecto. */ save?: () => Promise; /** Jobs con una ejecución cloud activa. Poblado por la app host al arrancar. */ readonly runningJobIds: Set; /** Mapa jobId → executionId para reconectar al WebSocket. Poblado por la app host al arrancar. */ readonly activeExecutions: Map; readonly onRunningJobsChanged: OBC.Event>; readonly onRunProgress: OBC.Event<{ message: string; progress: number; }>; readonly onRunComplete: OBC.Event<{ runId: string; clashCount: number; }>; readonly onRunError: OBC.Event<{ code?: string; message: string; }>; readonly onReloadingChanged: OBC.Event; isReloading: boolean; /** True once init(client) has been called — safe to call run(). */ get ready(): boolean; private _client?; private _projectId?; /** `clashes.frag`'s file ID, resolved once by `init()`/`reload()`'s * `loadClashData` call. Never changes once the file exists — passing it * into `buildClashBuffer` skips 3 of its 4 network round-trips. */ private _clashFragFileId?; private _reconnectingJobIds; private _queries; private _matrices; private _saveTimer?; private _savePromise?; private _jobs; private _runs; private _clashes; private _markers; private static _geo; get queries(): ClashQuery[]; set queries(value: ClashQuery[]); get matrices(): ClashMatrix[]; set matrices(value: ClashMatrix[]); private _scheduleSave; /** Chains onto any save already in flight instead of firing a second, * concurrent `_doSave()` — two overlapping calls would race on * `buildClashBuffer`'s read-diff-reconcile cycle (real network I/O; * `onJobsReconciled` mutating `this.jobs` from two stale reads at once) * and on the upload itself. It also keeps `flush()` correct: it just * awaits `_savePromise`, so if that got overwritten by a newer, unrelated * save instead of chained, flush() could resolve while an earlier save * was still genuinely in flight. */ private _queueSave; private _doSave; /** Cancela el debounce pendiente y ejecuta el save inmediatamente. Espera a que complete. */ flush(): Promise; /** * Builds the current `clashes.frag` buffer (diffed/reconciled against what's * persisted) WITHOUT uploading it. For consumers (e.g. `clashes-panel`) that * override `save` to persist via `projectStorageContext` instead of the * default direct-`client` path. */ buildClashBuffer(): Promise; get jobs(): ClashJob[]; set jobs(value: ClashJob[]); get runs(): ClashRun[]; set runs(value: ClashRun[]); get clashes(): Clash[]; set clashes(value: Clash[]); queryById(id: string): ClashQuery | undefined; private _clashStylesRegistered; /** Green — elementA's highlight color. Public so consumers (e.g. "create * topic from clash") can build a matching BCF viewpoint `componentColors` * entry without duplicating the hex value. */ readonly STYLE_A = "#22c55e"; /** Red — elementB's highlight color. Same reasoning as `STYLE_A`. */ readonly STYLE_B = "#ef4444"; private _clashStyle; highlightAllClashes(clashes: Clash[]): void; ghostClashes(clashes: Clash[]): Promise; ghostClash(clash: Clash): Promise; clearGhostClash(): Promise; highlightClash(clash: Clash): void; clearClashHighlight(): void; showMarkers(groups: MarkerGroup[]): void; hideMarkers(): void; toViewerPoint(point: [number, number, number]): THREE.Vector3; private _toViewer; private _renderMarkers; private _clearMarkers; cluster(clashes: Clash[], threshold: number): Clash[][]; private _setHighlighterEnabled; private _isolatedMaterials; runsForJob(jobId: string): ClashRun[]; clashesForRun(runId: string): Clash[]; updateClash(id: string, changes: { status?: ClashStatus; comments?: string; }): void; /** * Initializes the manager from cloud storage: loads clash data, wires save/reload, * reads in-flight executions, and resolves the viewer world (non-blocking). * Consumer apps call this once instead of wiring all the pieces manually. */ init(client: PlatformClient): Promise; /** Launches clash detection in a Web Worker. Fires onRunProgress/onRunComplete/onRunError. */ run(jobId: string): void; private _handleWorkerComplete; /** Reconnects to an in-flight execution when the user opens a job that was running before page load. */ reconnectIfRunning(jobId: string): void; private _listenToExecution; private _firstWorld; } export type ClashesManager = InstanceType; export const ClashesManager = { uuid: '2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f' } as typeof _ClashesManager & { uuid: '2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f' }; /** * Which action buttons to expose per file row. All default to `true`. */ export interface FileListActions { download?: boolean; rename?: boolean; delete?: boolean; } /** * Config passed to {@link FileList.create}. */ export interface FileListConfig { /** Services client used to list and mutate files. */ client: EngineServicesClient; /** Optional folder ID to scope the list. If omitted, lists root files. */ folderId?: string; /** Which action buttons to show per row. Defaults to all enabled. */ actions?: FileListActions; /** Called when a file row is clicked (not an action button). */ onFileClick?: (file: Item) => void; } /** * The result returned by {@link FileList.create}. */ export interface FileListInstance { /** The DOM element to mount somewhere in your layout. */ element: HTMLElement; /** Reloads the list from the services client. */ refresh: () => Promise; /** Changes the folder scope and reloads. Pass `undefined` for the root. */ setFolder: (folderId?: string) => Promise; /** Removes the element and forgets the instance. */ dispose: () => void; } /** * Built-in component that renders a file list backed by the services client, * with built-in download / rename / delete actions. * * The backing data comes from {@link EngineServicesClient.listFiles}, so the * list stays in sync with the storage service. Each call to {@link create} * returns an independent instance with its own DOM element. * * @example * ```ts * const fileList = components.get(FileList); * const { element, refresh } = fileList.create({ * client: app.client, * folderId: someFolderId, * }); * container.appendChild(element); * ``` */ declare class _FileList extends OBC.Component { static readonly uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c"; enabled: boolean; readonly name = "FileList"; private _instances; /** * Creates a new file-list instance. Returns the DOM element to mount plus a * `refresh` handle to reload the list, a `setFolder` to change scope, and a * `dispose` to remove it. */ create(config: FileListConfig): FileListInstance; /** * Removes every instance this manager has created. */ dispose(): void; } /** * Built-in component that renders a file list backed by the services client, * with built-in download / rename / delete actions. * * The backing data comes from {@link EngineServicesClient.listFiles}, so the * list stays in sync with the storage service. Each call to {@link create} * returns an independent instance with its own DOM element. * * @example * ```ts * const fileList = components.get(FileList); * const { element, refresh } = fileList.create({ * client: app.client, * folderId: someFolderId, * }); * container.appendChild(element); * ``` */ export type FileList = InstanceType; /** * Built-in component that renders a file list backed by the services client, * with built-in download / rename / delete actions. * * The backing data comes from {@link EngineServicesClient.listFiles}, so the * list stays in sync with the storage service. Each call to {@link create} * returns an independent instance with its own DOM element. * * @example * ```ts * const fileList = components.get(FileList); * const { element, refresh } = fileList.create({ * client: app.client, * folderId: someFolderId, * }); * container.appendChild(element); * ``` */ export const FileList = { uuid: 'b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c' } as typeof _FileList & { uuid: 'b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c' }; /** A point-layer vertex whose Z gives the surface height at that place. */ export interface HeightNode { lon: number; lat: number; z: number; } /** * One orthometric height per vertex, in the same nesting as the geometry's * coordinates: `number` for a Point, `number[]` for a LineString/MultiPoint/ * ring, `number[][]` for a MultiLineString/Polygon, and so on. */ export type HeightTree = number | HeightTree[]; /** * Which rule gave a line end its height (see `resolveLineEnds`): 1 = its own * property, 2 = node surface height minus depth, 3 = copied from the other end * (pipe drawn level), 4 = node surface height (no depth available). */ export type EndRule = 1 | 2 | 3 | 4; export interface FeatureHeights { /** * "placed": `heights` holds the per-vertex heights. "flat": draw this * feature with the legacy flat behaviour. "skipped": it cannot be placed * and must not be drawn. */ status: "placed" | "flat" | "skipped"; heights?: HeightTree; /** "attributes" lines only — the rule that resolved each end. */ startRule?: EndRule; endRule?: EndRule; } export interface LayerHeights { /** True when the whole layer must be drawn with the legacy flat behaviour. */ fallback: boolean; /** One entry per input feature, same order. Empty when `fallback`. */ features: FeatureHeights[]; /** Number of "skipped" features. */ skipped: number; /** How many line ends each rule resolved ("attributes" layers). */ ruleCounts: Record; } /** A value read from a property or Z is MISSING when it is not a finite number or is exactly 0. */ export declare function isMissingHeight(value: unknown): boolean; /** * Horizontal distance in metres between two lon/lat pairs — equirectangular * approximation, plenty for the sub-metre comparisons and line-length weights * it is used for here. */ export declare function horizontalDistance(lon1: number, lat1: number, lon2: number, lat2: number): number; /** * Spatial hash over nodes: cells are twice the snap distance wide, so any node * within the snap distance of a query lies in the 3×3 block of cells around * it — a lookup costs the same at 2,000 nodes as at 50,000. */ export declare class NodeIndex { private readonly _snapDistance; private readonly _cells; private readonly _cellSize; private readonly _lonScale; constructor(nodes: HeightNode[], _snapDistance: number); private _cell; private _key; /** The nearest node within the snap distance of (lon, lat), or null. */ nearest(lon: number, lat: number): HeightNode | null; } /** * Resolves the heights of a line's two ends (rules 1–4, see `EndRule`). * Both ends get rules 1–2 first, so rule 3 never copies a value that itself * came from rule 3/4. Returns null when an end ends up with no height at all. */ export declare function resolveLineEnds(properties: GeoJSON.GeoJsonProperties, start: [number, number], end: [number, number], config: VectorLayerHeightConfig, index: NodeIndex | null): { start: number; end: number; startRule: EndRule; endRule: EndRule; } | null; /** * Resolves the orthometric height of every vertex of every feature in a * layer, following the rules documented on `VectorLayerHeightConfig` ("geometry" * and "attributes"). Emits at most ONE `console.warn` per call (the fallback, * or the skipped-feature summary), never one per vertex/feature. */ export declare function resolveLayerHeights(features: GeoJSON.Feature[], config: VectorLayerHeightConfig, nodes?: HeightNode[], layerId?: string): LayerHeights; /** * Pixels either side of a fat line's own stroke (`Line2`) that still count as * a hit — the strokes are only a couple of pixels wide, so without it a click * has to land on the exact pixel row of the line. three adds * `raycaster.params.Line2.threshold` to the material's full `linewidth` and * then tests against HALF of the sum, hence the doubling in * `pickVectorFeature()`. */ export declare const VECTOR_PICK_TOLERANCE_PX = 6; /** What a pick found: which feature of which layer, and where along the ray. */ export interface VectorPickHit { layerId: string; /** Index in the layer's `geojson.features`. */ featureIndex: number; /** Distance from the ray origin (the camera, for a perspective camera). */ distance: number; point: THREE.Vector3; } /** * Nearest vector-layer feature under a pointer, or null. * * `objects` are the roots `VectorLayers` built (each, or one of its * descendants, carries `userData.{layerId, featureIndex}`) — raycast directly * rather than through a scene, since they may live in the world's scene or in * the private deferred-mode one. `ndc` is the pointer in normalised device * coordinates; `size` is the renderer's pixel size, which fat lines need both * to set their `LineMaterial.resolution` and to turn * {@link VECTOR_PICK_TOLERANCE_PX} into world units. */ export declare function pickVectorFeature(objects: THREE.Object3D[], camera: THREE.Camera, ndc: THREE.Vector2, size: THREE.Vector2): VectorPickHit | null; /** * Per-layer style — `simplestyle-spec` property names, see * docs/adrs/vector-layer-style-property-naming.md for why. Layer-level only * (applies to every feature in the layer), not per-feature. */ export interface VectorLayerStyle { stroke?: string; "stroke-width"?: number; fill?: string; "fill-opacity"?: number; } /** Per-layer placement options (not styling). */ export interface VectorLayerOptions { /** * Height of every feature relative to the origin, in metres (negative = * below ground, e.g. buried utilities). Default 0. */ elevation?: number; /** * Opt-in per-feature heights (see `VectorLayerHeightConfig`). When set and * resolvable, each vertex is placed at its own height + the project's geoid * undulation instead of flat at `elevation`. Absent = legacy flat drawing. */ height?: VectorLayerHeightConfig; /** "attributes" heights only — surface nodes (a line end snaps to the nearest one for its surface height). */ nodes?: HeightNode[]; } /** * One feature's geometry in scene coordinates, for 2D consumers (the * minimap). `rings` holds a single vertex for points, the vertices for * lines, and outer ring + holes for polygons (multi-geometries are split * into one feature per part). */ export interface VectorMapFeature { type: "point" | "line" | "polygon"; rings: THREE.Vector3[][]; /** Index in the layer's `geojson.features` — the same identity a 3D pick yields, shared by every part of a multi-geometry. */ featureIndex: number; } /** A loaded layer as seen by 2D consumers. */ export interface VectorMapLayer { id: string; style: { stroke: string; strokeWidth: number; fill?: string; fillOpacity: number; }; features: VectorMapFeature[]; } export declare const VECTOR_HOVER_COLOR = "#FFC107"; export declare const VECTOR_SELECTION_COLOR = "#00E5FF"; /** * Payload of `VectorLayers.onFeatureSelected`: the selected feature's identity * plus its attribute-table row. `properties` is the feature's own * `properties` object, untouched (keys keep whatever the source file has). */ export interface VectorFeatureSelection { layerId: string; layerName: string; /** Index in the layer's `geojson.features`. */ featureIndex: number; geometryType: string; properties: GeoJSON.GeoJsonProperties; } /** * Internal submodule of `GISManager` for vector GIS layers (shapefile/GeoJSON — * shapefiles are converted to GeoJSON at ingestion time, see docs/adrs). Kept as * a plain internal class rather than a separate `OBC.Component`: `GISManager` * already covers "everything GIS", not just the basemap, so this stays behind * `gisManager.vectorLayers` instead of its own public component with its own * `components.get(...)` entry point. * * Positions features using the same georeferencing math `ReorientationPlugin` * uses to align the 3D Tiles (`Ellipsoid.getObjectFrame()`, WGS84 lat/lon/ * height/azimuth -> a rigid ECEF<->scene-local transform), computed directly * from `GISManager`'s own origin params rather than read off the tileset's * `matrixWorld` — see `geoToWorld()` for why: that transform is a pure * function of the 4 origin parameters (confirmed by reading * `ReorientationPlugin.transformLatLonHeightToOrigin`, which touches nothing * tileset-specific besides which `group`/`ellipsoid` object to write into), * so vector layers don't need to wait for a tileset to exist or load, and * stay correct even when `GISManager.snapToGround()` changes the origin's * height independently of any tileset event. */ export declare class VectorLayers { world?: OBC.World; getOrigin?: () => { latitude: number; longitude: number; height: number; rotation: number; }; getGeoidUndulation?: () => number; private static readonly _POINT_RADIUS; private _occlusionScene; /** Called once the deferred scene exists, so the owner registers its pass. */ ensurePass?: () => void; /** Fires whenever layers are added, removed or rebuilt (e.g. origin change). */ readonly onLayersChanged: OBC.Event; /** * Fires with the newly selected feature, or null when the selection is * cleared. Not fired when the already-selected feature is selected again. */ readonly onFeatureSelected: OBC.Event; getLayerName?: (id: string) => string | undefined; private _selected; private _hovered; private readonly _highlighted; private readonly _layers; private readonly _mapLayers; /** Loaded layers' geometry for 2D consumers (see `VectorMapFeature`). */ get mapLayers(): VectorMapLayer[]; private readonly _layerSources; get hasLayers(): boolean; /** * Draws every loaded layer into the renderer's current target, with fat * lines sized for a `width`×`height` pixel target (their width is in * pixels of it). Used by `GISManager`'s deferred pass; also works in * composer mode (objects drawn one by one). The minimap doesn't use this — * it draws `mapLayers` as live 2D vectors instead. */ render(renderer: THREE.WebGLRenderer, camera: THREE.Camera, width: number, height: number): void; /** * @param id When given, tracks everything this call adds under that id so * `removeLayer(id)` can clean it up later — calling `addLayer` again with an * id already in use replaces it (removes the old one first), rather than * duplicating it. Without an id, nothing is tracked and there is nothing to * remove later (matches the previous, untracked behaviour). */ addLayer(geojson: GeoJSON.FeatureCollection, style?: VectorLayerStyle, id?: string, options?: VectorLayerOptions): void; /** Removes and disposes everything the given `id`'s `addLayer()` call added. No-op if unknown/already removed. */ removeLayer(id: string): void; private _dropLayer; /** * Nearest feature under a pointer (NDC), or null — see * `pickVectorFeature()`. Costs nothing when no layer is loaded. */ pickFeature(ndc: THREE.Vector2): VectorPickHit | null; /** Selects (and highlights) one feature, replacing any previous selection. No event if it is already the selected one. */ selectFeature(layerId: string, featureIndex: number): void; /** The current selection as the `onFeatureSelected` payload (null when nothing is selected) — for consumers created after the event fired. */ get selection(): VectorFeatureSelection | null; /** Drops the selection and its highlight. No-op (no event) when nothing is selected. */ clearSelection(): void; /** The currently selected / hovered feature (null = none) — read by the 2D map to draw the same states as 3D. */ get selectedFeature(): { layerId: string; featureIndex: number; } | null; get hoveredFeature(): { layerId: string; featureIndex: number; } | null; /** Scene-space box of everything built for one feature (null if it isn't loaded), at its real resolved heights. */ getFeatureBounds(layerId: string, featureIndex: number): THREE.Box3 | null; /** Hover-highlights one feature (null = none). Does not touch the selection and fires no event. */ setHoveredFeature(hit: { layerId: string; featureIndex: number; } | null): void; /** Top-level objects built for one feature (empty if the layer/feature isn't loaded). */ private _featureObjects; private _paint; isLayerLoaded(id: string): boolean; /** * Rebuilds every currently loaded layer's geometry from its cached * geojson/style, using the current `getOrigin()` — the fix for * loaded-layer-geometry-freezing-at-load-time: `addLayer()` only reads * `getOrigin()` once, at build time, so an origin change (gizmo drag, * lat/lon/height/rotation inputs, `snapToGround()`) otherwise never moves * already-loaded layers. Callers should debounce this — see * `GISManager.setPosition()` — since it rebuilds real geometry, not just * repositions existing objects. */ reprojectAll(): void; /** Scene-space bounding box of everything `id`'s `addLayer()` call added — `null` if the id is unknown or nothing was actually added. */ getLayerBounds(id: string): THREE.Box3 | null; private _disposeObject; private _resolveTargetScene; /** * WGS84 lat/lon/height (degrees, metres above the ellipsoid) -> scene-local * position, computed straight from `GISManager`'s origin params — the exact * same math `ReorientationPlugin.transformLatLonHeightToOrigin` runs against * `tiles.group.matrix` (`Ellipsoid.getObjectFrame()` for the origin's own * lat/lon/height/azimuth -> ECEF<->local transform, inverted), just without * needing a `TilesRenderer` to hold the intermediate result. No tileset * required, and always current — including immediately after * `GISManager.snapToGround()` changes the origin height, with nothing to * resync. */ geoToWorld(lat: number, lon: number, height?: number): THREE.Vector3; /** * lon/lat (GeoJSON coordinate order) -> scene position, X/Z only — Y is the * layer's `elevation` (relative to the origin). This is the legacy flat * path, used by every layer that doesn't opt in to per-feature heights: * `geoToWorld`'s real Y depends on the gap between the origin's height and * each vertex's own height, which produced large, confusing vertical * offsets for raw file Z values — so for these layers per-vertex heights * are ignored and the whole layer sits flat at its `elevation`. Layers with * a `height` config go through `_toScenePosition()` instead. */ private _toSceneVector; /** * One vertex's scene position: with a resolved orthometric `height`, the * full `geoToWorld()` result for `height + undulation` (all three * components, Y included); without one, the legacy flat `_toSceneVector()`. */ private _toScenePosition; /** Renderer's current pixel size — `LineMaterial` needs it to size `linewidth` correctly. */ private _resolution; private _buildFeatureObject; private _buildMapFeatures; private _buildPoint; private _buildLine; /** * Surface (`THREE.ShapeGeometry`, triangulated — handles non-convex rings) * when `fill` is set, plus the outline for every ring either way. Built in * local 2D (x, z) then rotated flat: `ShapeGeometry` lives in the XY plane, * and rotating +90° around X maps local (x, y, 0) -> scene (x, 0, y), which * lines up with `_toSceneVector`'s (x, 0, z) exactly; the layer's * `elevation` is re-applied afterwards as a plain vertical translation. * With per-vertex `heights` the outlines follow them, while the (planar) * surface sits at the average resolved height of the outer ring. */ private _buildPolygonSurface; } export interface GISManagerState { apiToken: string; assetId: string; latitude: number; longitude: number; height: number; rotation: number; tilesVisible: boolean; gizmoVisible: boolean; tilesOffsetEast: number; tilesOffsetNorth: number; tilesOffsetUp: number; /** See-through factor for the tiles (1 = opaque) — see `GISManager.setTilesOpacity`. */ tilesOpacity: number; } /** One entry in the persisted vector-layer manifest — metadata only, not the geometry itself. */ export interface GISVectorLayerConfig { id: string; name: string; fileId: string; /** * File format: `"shapefile"` (a zip with .shp/.dbf/.prj…) or `"geojson"`. When * missing or unrecognised the downloaded bytes decide (zip signature → * shapefile, leading `{` → GeoJSON). */ type: string; style: VectorLayerStyle; /** Opt-in per-feature heights (see `VectorLayerHeightConfig`); absent = flat. */ height?: VectorLayerHeightConfig; } /** How a layer's features get their height. Absent = legacy behaviour: the whole layer is drawn flat. */ export interface VectorLayerHeightConfig { /** * "geometry": each vertex uses its own Z (third GeoJSON coordinate). * "attributes": lines get their start/end heights from feature properties. */ source: "geometry" | "attributes"; /** "attributes" only — property holding the height of a line's first vertex. */ startProperty?: string; /** "attributes" only — property holding the height of a line's last vertex. */ endProperty?: string; /** "attributes" only — property holding the depth below the surface at the first vertex. */ startDepthProperty?: string; /** "attributes" only — property holding the depth below the surface at the last vertex. */ endDepthProperty?: string; /** "attributes" only — ids of point layers (in this same manifest) whose Z gives the surface height at a line end. */ nodeLayers?: string[]; /** "attributes" only — max horizontal distance (m) between a line end and a node for them to count as the same place. Default 0.5. */ nodeSnapDistance?: number; } /** * Shape of `{GISManager.uuid}.json`, the project-storage file * `GISManager.init()` reads. Origin lives in `ProjectManager`'s own record * instead (the platform's canonical project data) — this file is only the * vector-layer manifest. */ export interface GISPersistedConfig { layers: GISVectorLayerConfig[]; /** Small local East/North/Up fine-tune offset (metres) for Google 3D * Tiles — see `GISManager.setTilesOffset`'s own doc comment. Optional: * absent means "no offset saved yet", same as `{0,0,0}`. */ tilesOffset?: { east: number; north: number; up: number; }; } /** Calls `visit` with every [lon, lat, …] vertex of a GeoJSON geometry (all supported types, collections included). */ export declare function forEachVertex(geometry: GeoJSON.Geometry | null, visit: (coord: number[]) => void): void; /** * Horizontal (scene X/Z) bounding box of every vertex of every given feature * collection, each vertex taken through `project(lat, lon)` (the real * `geoToWorld`). Heights are irrelevant here and left at 0. Vertices with * non-finite coordinates are ignored; null when nothing usable is left. */ export declare function layersBoundsXZ(collections: GeoJSON.FeatureCollection[], project: (lat: number, lon: number) => THREE.Vector3): THREE.Box3 | null; /** The square, in scene X/Z, that a minimap capture covers. */ export interface MinimapExtent { centerX: number; centerZ: number; /** Half the side of the square, in metres. */ half: number; } /** * Extra room around the content's extent, as a FRACTION of its half-size (not * metres), so the outermost features don't sit exactly on the image edge. */ export declare const MINIMAP_EXTENT_MARGIN = 0.05; /** * The capture square for the vector layers' box (world space): centred on its * X/Z centre, with half the larger X/Z span as its half-size (the image stays * square), plus `margin`. With nothing usable — no box, an empty or non-finite * one, or content with no horizontal size at all — falls back to * `fallbackHalf` metres around the origin. */ export declare function computeMinimapExtent(box: THREE.Box3 | null | undefined, fallbackHalf: number, margin?: number): MinimapExtent; /** * What to do when the Highlighter's "select" style highlights something: * - "undo-bim": the highlight belongs to a click that a vector feature just * won (it fires inside that click's short window) — take the BIM highlight * back and keep the vector selection; * - "clear-vector": a genuine BIM selection (viewer, model tree, objects * panel, …) — the vector selection must go; * - "none": nothing to do (an empty highlight outside the window). */ export type BimHighlightAction = "undo-bim" | "clear-vector" | "none"; export declare function bimHighlightAction(insideVectorWinWindow: boolean, bimSelectionEmpty: boolean): BimHighlightAction; /** Whether a Highlighter selection map (`modelId → Set`) selects nothing. */ export declare function isModelIdMapEmpty(map: Record> | null | undefined): boolean; /** * What the minimap needs from `GISManager`, provided as a private hook object * (the minimap never reaches into `GISManager` itself). */ export interface MinimapSource { /** * Gets the Google GIS tiles ready to be drawn from `camera` (registers it * with the streaming renderer and waits until the content it sees has * loaded). */ prepare(camera: THREE.OrthographicCamera, resolution: number): Promise; /** Draws the tiles into the renderer's CURRENT render target (a fresh, transparent one). */ draw(renderer: THREE.WebGLRenderer, camera: THREE.OrthographicCamera): void; /** Undoes whatever `prepare` set up. Always called, even if `prepare` threw. */ cleanup(camera: THREE.OrthographicCamera): void; /** * Live opacity (0..1) the map applies when drawing the captured image — read * on every redraw, so it can change without recapturing. */ opacity(): number; /** Horizontal world box of ALL the project's vector layers (null when there is none). */ getVectorLayersBox(): Promise; } /** * Result of a capture: the image plus what's needed to map world ↔ image. */ export interface MinimapCapture { /** Top-down, north-up image of the GIS tiles (canvas pixels, sRGB, transparent elsewhere). */ image: HTMLCanvasElement; /** Live opacity (0..1) to draw `image` with. */ opacity: () => number; /** Side of the image, in pixels. */ size: number; /** Copy of the camera the image was taken with, for world ↔ map conversion. */ camera: THREE.OrthographicCamera; } /** * A marker drawn over the minimap (an HTML overlay on the panel's canvas, * following zoom and pan; hidden while there is no capture). */ export interface MinimapMarker { id: string; /** Scene coordinates. Read on every redraw, so a marker follows if this changes. */ position: THREE.Vector3; label?: string; /** * Builds the marker's element. A FACTORY, not an element: a panel can be * destroyed and recreated (the user switching layouts), and each one needs * its own DOM node. A marker with one owns its click behaviour; without it * the panel draws a default badge with the label and reports clicks through * `onMarkerClicked`. */ createElement?: () => HTMLElement; } /** What changed in the marker list — the panel just reconciles against `markers`. */ export interface MinimapMarkersChange { kind: "added" | "updated" | "removed" | "cleared"; /** The marker's id (absent for "cleared"). */ id?: string; } /** * Internal submodule of `GISManager` for the 2D minimap, same pattern as * `VectorLayers` (a plain internal class behind `gisManager.minimap`, not its * own component). Baked top-down image: renders the Google GIS tiles once, * from an orthographic camera looking straight down at the middle of the * project's vector layers, into an in-memory image (never persisted). The UI * (``) draws live overlays (vector layers, camera arrow, view * cone) on top of that static image, game-minimap style. * * North-up: scene axes follow the codebase's +X=West, +Y=Up, +Z=North * convention (origin rotation fixed at 0), so the camera's "up" is +Z. The * world ↔ map conversions go through the capture camera's own projection, so * they stay correct without hardcoding that convention anywhere else. */ export declare class Minimap { private readonly _source; world?: OBC.World; /** * Fallback only: half the side of the captured square, in metres, centred on * the origin — used when the project has no usable vector layers. Otherwise * the area is the box of all of them. */ halfExtent: number; /** * Side of the captured image, in pixels (clamped to the GPU's max texture * size). Fixed, so the map gets coarser as the site gets larger: the image * covers the whole data-driven extent. Scaling the image with the extent was * tried and was too slow to capture. The intended improvement is to recapture * only the visible area when the user zooms in on the map, so sharpness no * longer depends on the size of the site. */ resolution: number; readonly onCaptured: OBC.Event; /** Fires once per `addMarker` / `updateMarker` / `removeMarker` / `clearMarkers` that changed something. */ readonly onMarkersChanged: OBC.Event; /** Fires with the id when the panel's DEFAULT marker (one without `createElement`) is clicked. */ readonly onMarkerClicked: OBC.Event; private readonly _markers; private _capture; private _capturing; constructor(_source: MinimapSource); get capture(): MinimapCapture | null; get capturing(): boolean; /** Every marker, by id (read-only). */ get markers(): ReadonlyMap; getMarker(id: string): MinimapMarker | undefined; /** Adds a marker, or replaces the one with the same id. */ addMarker(marker: MinimapMarker): void; /** Changes some fields of a marker. Returns false (and fires nothing) if there is no such marker. */ updateMarker(id: string, partial: Partial>): boolean; /** Returns false (and fires nothing) if there is no such marker. */ removeMarker(id: string): boolean; clearMarkers(): void; /** * The area the next capture covers: the box of all the project's vector * layers (waits for them to be read as data), or `halfExtent` around the * origin without any. */ getExtent(): Promise; /** Renders the GIS tiles into a fresh image. */ captureMap(): Promise; /** World point → normalized image coords (0..1, origin top-left), or null without a capture. */ worldToMap(point: THREE.Vector3): { x: number; y: number; } | null; /** Normalized image coords → world point on the horizontal plane at `height`. */ mapToWorld(x: number, y: number, height?: number): THREE.Vector3 | null; private _render; dispose(): void; } /** The file formats a vector layer can come in (the manifest entry's `type`). */ export type VectorLayerFormat = "shapefile" | "geojson"; /** * Which parser a downloaded layer file needs. The manifest's `type` decides * when it is recognised; otherwise the bytes do: a zip signature (`PK\x03\x04`) * means a shapefile, a first non-whitespace `{` means GeoJSON. Anything else * throws, with a message meant for the user. */ export declare function detectLayerFormat(type: string | undefined, bytes: Uint8Array): VectorLayerFormat; type CrsKind = { kind: "lonlat"; } | { kind: "reproject"; from: string; } | { kind: "unsupported"; name: string; }; /** * Reads the legacy GeoJSON `crs` member's name. Understands the CRS84 URN, * EPSG URNs (with or without a version), `EPSG:` and the OpenGIS http * form. EPSG:4326 is taken as lon/lat as-is: GDAL/QGIS write lon/lat even when * they label it 4326. Reprojected: EPSG:3857 and the UTM families (326xx/327xx * WGS84, 258xx ETRS89, 269xx NAD83), their definition built from the code. */ export declare function parseCrsName(name: string): CrsKind; /** * Parses GeoJSON text into a `FeatureCollection` in WGS84 lon/lat (`z` kept). * The coordinate system comes from the legacy `crs` member; without one the * coordinates must already be lon/lat, which is checked. Throws a clear error * for an unsupported CRS, or projected coordinates that don't say which CRS * they are in. The legacy `crs` member is dropped from the result. */ export declare function parseGeoJSONLayer(text: string): Promise; /** * Streams Cesium Ion 3D Tiles (Google Photorealistic 3D Tiles by default) co-located * with the BIM model. * * Rendering path depends on `world.renderer.postproduction.mode`: * - DEFERRED: the deferred G-buffer capture pass only draws objects whose material * carries the engine's "capture-emission" marker (set on Fragments/BIM surface * materials only) — every other object, however opaque, is hidden for the * duration of the capture (confirmed directly from the engine's own * `SurfaceCapturePass` docs). So tiles are added to a private off-scene * `THREE.Scene` and drawn via `addOcclusionPass` (direct mode — opaque, * self-occluding, same as `PointCloudLoader`), which runs AFTER the deferred * composite and bypasses the G-buffer requirement entirely. * - COMPOSER: the EffectComposer path renders the real scene graph directly, no * special material marker needed, so tiles are added straight to * `world.scene.three` like any other mesh. * * The Cesium Ion API token is kept in memory only (no persistence yet) — see * docs/adrs for the pending decision on where project geo-location should live. */ declare class _GISManager extends OBC.Component { static readonly uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60"; enabled: boolean; readonly onStateChanged: OBC.Event; readonly onLoadError: OBC.Event; readonly onLayersLoaded: OBC.Event; readonly onVectorLayerError: OBC.Event<{ id: string; message: string; }>; readonly onOffsetDirtyChange: OBC.Event; readonly onOffsetSaveComplete: OBC.Event; world?: OBC.World; vectorLayersConfig: GISVectorLayerConfig[]; private _client?; private _projectId?; private _appDataStore?; private _offsetDirty; get offsetDirty(): boolean; readonly vectorLayers: VectorLayers; /** * Fires when a click selects a vector feature (payload: its layer, index and * attribute row) and with null when the selection is cleared — re-exposed * from `vectorLayers` for consumers (the future properties panel). */ readonly onFeatureSelected: OBC.Event; /** * Fires on every `selectVectorFeature(..., { focus: true })`, including a * re-select of the already-selected feature (which fires no * `onFeatureSelected`) — carries the scene-space sphere the 3D camera frames, * so other views (the 2D map) can focus the same neighbourhood. */ readonly onFocusRequested: OBC.Event<{ layerId: string; featureIndex: number; sphere: THREE.Sphere; }>; private _apiToken; private _assetId; private _latitude; private _longitude; private _height; private _rotation; private _tilesVisible; private _gizmoVisible; private _tilesOffsetEast; private _tilesOffsetNorth; private _tilesOffsetUp; private _tiles; private _reorientation; private _draco; private _occlusionScene; private _usingOcclusionPass; private _locationControls; private _controlPoint; private _dragStartMatrix; private _tilesOpacity; private _fadeTarget; private _fadeQuad; private _horizonTarget; private _horizonQuad; /** * Fraction (0–1) of the camera's far distance over which the 3D tiles dissolve * into what is behind them, instead of ending in a hard edge at the far plane: * the tiles are fully visible up to `far * (1 - horizonFade)` and fully * transparent at `far`. Default 0.8. `0` turns it off (opaque tiles are drawn * straight into the frame at opacity 1, as before). Combines with * `setTilesOpacity`: final alpha = opacity × fade. Deferred hosts only — where * the tiles are added to the scene directly there is no fade. Vector layers * are not faded. */ horizonFade: number; private readonly _far; private _farCameras; /** * Far plane (distance) the world's cameras get while the 3D tiles are loaded, so * the map reaches the horizon. Default `10000`. Changing it while the map is * loaded takes effect immediately. `horizonFade` is a fraction of this far while * the map is loaded (with `0.8`, the map fades from 2 km to 10 km). * * The camera's own far plane (e.g. the Settings panel's "Far plane") is * overridden while the map is loaded: it is remembered, not applied, and comes * back when the map is unloaded. Code that grows the far plane itself while the * map is loaded still works: a larger far than `mapFar` is left alone, and is * kept on unload. */ get mapFar(): number; set mapFar(far: number); /** True while the map owns the cameras' far plane (the 3D tiles are loaded). */ get farOverridden(): boolean; /** The far plane the user asked for, remembered while `farOverridden` (otherwise the cameras hold it). */ get userCameraFar(): number; /** Records the far plane the user wants; not applied until the map is unloaded. Only meaningful while `farOverridden`. */ setUserCameraFar(far: number): void; private _resolveFarCameras; /** * Shows a sky gradient behind everything while the 3D tiles are loaded: the * empty background (pixels nothing has drawn to) goes from `skyHorizonColor` at * the horizon to `skyZenithColor` straight up, so the tiles, dissolving with * `horizonFade`, melt into the horizon colour. Below the horizon it is the * horizon colour; an orthographic camera sees one flat colour. Default `true`; * `false` leaves the background untouched. Deferred hosts only — elsewhere * there is no sky. Drawn behind the vector layers and the tiles. */ sky: boolean; private readonly _skyHorizon; private readonly _skyZenith; private _skyHorizonColor; private _skyZenithColor; private _skyPass; private static _setSkyRgb; /** Sky colour at the horizon (any CSS colour string, hex number or `THREE.Color`). Default `"#d7e3ee"`, a light hazy blue. */ get skyHorizonColor(): THREE.ColorRepresentation; set skyHorizonColor(color: THREE.ColorRepresentation); /** Sky colour straight up. Default `"#6a9bd1"`, a deeper blue. */ get skyZenithColor(): THREE.ColorRepresentation; set skyZenithColor(color: THREE.ColorRepresentation); private _passRegistered; private _ensureOcclusionPass; private readonly _occlusion; private _ensureFadeTarget; private _disposeFade; /** Freezes the reference frame for the upcoming gesture — see `_onControlPointMoved`. */ private readonly _onDragStart; /** * Fires on every pointer move during the drag (live relocation). Always * converts the TOTAL offset since the drag began (that's what * `_controlPoint.position` holds throughout) through the FROZEN * start-of-gesture matrix, never the live `tiles.group.matrixWorld` — * otherwise every event would re-apply the same growing total against a frame * already shifted by all earlier events, compounding into runaway motion. * * Immediately resets `_controlPoint.position` back to (0,0,0) afterwards, so * the gizmo reads as a joystick fixed at the origin — only the terrain visibly * moves. This is safe precisely because of the point above: TransformControls * computes each event's position from its own frozen drag-start reference plus * the raw mouse offset, never incrementally from the object's last value, so * it doesn't notice or care that we reset it out from under it. */ private readonly _onControlPointMoved; /** Gesture is over — nothing left to commit (every event already did), just clear the frozen reference. */ private readonly _onDragEnd; private readonly _minimapSource; /** The 2D minimap (a baked top-down image of the GIS tiles over the project's vector layers) — see `Minimap`. */ readonly minimap: Minimap; private readonly _onBeforeUpdate; private readonly _onOriginChange; private readonly _onCrsChange; private static readonly _CLICK_MAX_MOVE_PX; private static readonly _BIM_CLEAR_WINDOW_MS; private _pickDown?; private _clearBimUntil; private _bimClearHandler?; /** * Wires the click and hover handling on the viewer canvas. Window-level * CAPTURE listeners filtered to the canvas, so they run before the * Highlighter's own canvas listeners for the same event (it selects BIM * elements on mouse up). The canvas lives inside `top-viewer`'s shadow root, * where an event observed at `window` is retargeted to the shadow host — so * the filter compares `composedPath()[0]` (the real origin), never * `event.target`. The canvas itself is looked up per event rather than * cached: the world can resolve before its renderer exists. * * "Nearest wins" between a vector feature and a BIM element: on mouse DOWN, * only if the raycast hits a vector feature, the BIM element under the same * pixel is picked with `FastModelPickers` (`getItemAt` + `getPointAt`, the * same GPU pick the Highlighter selects with) and the two camera distances * are compared; the camera doesn't move during a click, so the answer is * ready by mouse up. On mouse up, if the vector feature won it is selected * and the BIM selection that same click makes is undone (the Highlighter * can't be told to skip a click — disabling it for one event leaves its * internal pointer state stuck — so its highlight is cleared the moment it * fires). Otherwise the vector selection is cleared and the Highlighter * proceeds as always. Gaussian-splat and Google 3D tiles are not considered. */ private _setupFeaturePicking; private readonly _onHighlighterSetup; private get _pickCanvas(); /** True when the event really originated on the viewer canvas (see `_setupFeaturePicking`). */ private _isOnCanvas; private _hoverPoint?; private _hoverFrame; private readonly _onHoverMove; private readonly _runHover; private readonly _clearHover; /** Vector layers loaded and the viewer in plain select mode (no modal tool). */ private _canPick; private _ensureBimClearHandler; private _ndc; private _isPickable; private readonly _onPickDown; private readonly _onPickUp; /** * Horizontal scene-space box of ALL the project's vector layers (every * manifest entry, displayed or not), for the minimap extent — the only thing * that defines it. Layers are read as data through the shared per-layer * cache (so nothing downloads twice and nothing is added to the scene), then * projected with the CURRENT origin on every call, so an origin change never * leaves a stale box. A layer that fails to load is skipped with one warning. */ private _vectorLayersBox; constructor(components: OBC.Components); /** * Reads `{GISManager.uuid}.json` from project storage (same pattern as * `ClashesManager`/`TopicsManager`'s own `init(client)` — a plain method * call, not `@lit/context`). * Restores the origin (lat/lon/height/rotation) by composition from * `ProjectManager` — the platform's canonical project record — instead of * duplicating it into GIS's own persisted file, plus the vector-layer * manifest (metadata only — id/name/fileId/type/style, NOT the geometry * itself) from GIS's own `{GISManager.uuid}.json`. If that layers file * doesn't exist yet in the project, leaves the layer list empty and does * NOT create one — that only happens later, on an explicit save. * * Assumes `ProjectManager.init(client)` has already run by the time this is * called — the caller must chain `GISManager.init()` after * the `ProjectManager.init()` promise resolves. If `GISManager` can ever be * initialized in a different order/context, `ProjectManager.origin.get()` * below would just read stale/undefined data silently — revisit this if * that assumption stops holding (e.g. by awaiting `ProjectManager.init` * here directly, if `GISManager` can no longer rely on caller ordering). * * No-op (never throws) if there's no project context, no matching file, or * the read fails for any reason — the app should always be usable with * defaults, storage is a progressive enhancement here, not a hard * dependency. */ init(client: PlatformClient): Promise; /** Whether loading a vector layer also frames the camera on it. Off for now. */ fitCameraOnLayerLoad: boolean; /** * Downloads the given layer's shapefile `.zip` from project storage * (`vectorLayersConfig` entry's `fileId`), parses it with `shpjs.parseZip` * (dynamic import — same heavy-dependency convention as the rest of this * component), and renders it via `vectorLayers.addLayer(geojson, style, * id)`. The single entry point for "the user checked this layer's box" — * callers don't need to touch storage/shpjs/`VectorLayers` directly, and * don't need their own try/catch: failures are reported via * `onVectorLayerError`, mirroring `enableTiles()`/`onLoadError`. */ loadVectorLayer(id: string): Promise; private readonly _layerGeoJSON; private _getLayerGeoJSON; /** * Surface nodes for a layer whose heights come from attributes: every * Point/MultiPoint coordinate with a finite Z in the layers named by * `height.nodeLayers`. Those layers are only read as data here — nothing is * added to the scene and the panel's checkboxes are untouched. An unknown id * is warned about and skipped. */ private _loadHeightNodes; private _downloadAndParseLayer; /** * Real-world vector data can easily sit tens of km from the origin (a whole * shapefile's extent, not just small hand-built test shapes) — * far outside the default camera framing (~87 units from origin). Frames * the camera on the layer's actual bounding box right after it loads, same * `CameraControls.fitToBox()` the point-cloud loader already uses for the * same reason, so newly loaded data doesn't just silently look like nothing * rendered. */ private _fitCameraToLayer; private static readonly _FOCUS_MIN_RADIUS; /** * The single entry point for selecting a vector feature — the 3D click and * the 2D map's click both come through here, so they share one selection * state, one `onFeatureSelected` event and one camera travel. With `focus`, * the camera flies to the feature: `CameraControls.fitToSphere()` (animated) * on the bounding sphere of what `VectorLayers` built for it, at its real * resolved heights; the viewing direction is kept, only the target and the * distance change. Selecting the already-selected feature fires no event but * still focuses. Clearing stays `vectorLayers.clearSelection()`. */ selectVectorFeature(layerId: string, featureIndex: number, options?: { focus?: boolean; }): void; private _focusVectorFeature; /** Removes a layer loaded via `loadVectorLayer` — the "user unchecked the box" counterpart. */ unloadVectorLayer(id: string): void; private _firstWorld; get apiToken(): string; set apiToken(value: string); get assetId(): string; set assetId(value: string); get latitude(): number; get longitude(): number; get height(): number; get rotation(): number; get tilesVisible(): boolean; get gizmoVisible(): boolean; get tilesOffsetEast(): number; get tilesOffsetNorth(): number; get tilesOffsetUp(): number; get tilesOpacity(): number; /** * See-through factor for the tiles (0..1, 1 = opaque), mirrored by the * minimap's terrain image. In-memory only. Applies in DEFERRED mode (the * viewer's default); the composer path keeps the tiles opaque. */ setTilesOpacity(opacity: number): void; toggleGizmo(): void; /** Manual geo-location input (sliders) — no IFC georeferencing read yet, see docs/adrs. */ setPosition(latitude: number, longitude: number, height?: number, rotation?: number): void; /** * Small local fine-tune offset (metres, East/North/Up) layered ON TOP of * the origin-derived tiles position — a manual calibration knob for Google * Photorealistic 3D Tiles' own (independently known) absolute-positioning * inaccuracy, NOT a change to `ProjectManager.origin`/real georeferencing. * Re-derives the tiles position from the CURRENT origin fields + this * offset on every call (via `_reorientation`), so repeated calls replace * rather than accumulate. * * NOT auto-saved — marks `offsetDirty`/fires `onOffsetDirtyChange` instead, * same pattern `ProjectManager.origin` uses, so a caller driving this * continuously (the fine-tune sliders) doesn't write to the network on * every tick. `saveTilesOffset()` persists explicitly. */ setTilesOffset(east: number, north: number, up: number): void; /** * Persists the current tiles fine-tune offset to `{GISManager.uuid}.json` * (loose in `__project_data`, alongside `ProjectManager`'s own file — see * `_appDataStore`), preserving whatever `layers` are already in there. * `save()` itself is fire-and-forget/debounced — `offsetDirty` only clears * (and `onOffsetSaveComplete` fires) once `_appDataStore.onSaveComplete` * confirms the write actually succeeded (wired in `init()`), not * optimistically here. */ saveTilesOffset(): void; private _applyTilesOffset; private _reprojectDebounce?; private _scheduleReprojectLayers; /** * Casts a ray straight down from high above the recentered origin against the * currently loaded tile geometry to find the real ground elevation at * (latitude, longitude), then re-applies the reorientation using that as * `height` so the visible terrain/rooftop lands at world (0,0,0) instead of * wherever `height=0` (the bare WGS84 ellipsoid, which can be hundreds of * meters away from the real surface at elevated locations) happened to put it. * * Relies on the ENU tangent-plane guarantee `transformLatLonHeightToOrigin` * gives at the origin: after recentering at some height, "up" from that lat/lon * is exactly world +Y, and world Y directly corresponds to metres of height — so * a hit at world Y = `dy` means the real surface is `dy` metres higher than the * height currently used, and re-running the transform with * `height + dy` should bring it to Y ≈ 0. Only accurate near the origin (a few * km), which is exactly the regime this is used in. * * Tries straight down first, then straight up (content can end up above OR below * the origin depending on how far off `height=0` was from the real surface). * * Uses `TilesRenderer.raycast()` — 3d-tiles-renderer's own documented raycasting * entry point — instead of a generic `THREE.Raycaster.intersectObject(tiles.group)`. * The library keeps its own tile-activity bookkeeping (`activeTiles`, * `tile.traversal.used`, per-tile bounding volumes) separate from the plain * Object3D tree, and only that entry point knows how to walk it; a generic * scene-graph raycast against `tiles.group` silently finds nothing. * * Tile traversal (`markUsedTiles` in the engine's own source) bails out * immediately — without even descending into children — for any tile whose * bounding volume isn't in the frustum of AT LEAST ONE registered camera: * `if (!tile.traversal.inFrustum) return;`. That branch is never visited, let * alone loaded or marked active, regardless of `displayActiveTiles` (which only * affects the final visibility toggle of tiles that already got marked active — * a narrower case). So if the real viewport camera isn't looking anywhere near * the target point, nothing here ever loads and the raycast finds nothing no * matter what. * * `TilesRenderer` supports multiple simultaneously-registered cameras * (`cameras: Camera[]`), and a tile counts as "in frustum" if ANY of them sees * it. So we register a throwaway camera positioned high above the origin, * looking straight down — wide FOV and far plane so its frustum (a cone * widening downward, centred on the target column) covers a generous height * range around the origin regardless of whether the real surface turns out to * be above or below it — force one `update()` traversal with it registered, * then remove it again. The real viewport camera's own registration and * behaviour are untouched throughout. * * Returns false if no tile geometry was found (nothing to snap to) — caller * should retry once more of the tileset streams in. The first call after * moving to a new area may land approximately rather than exactly, since the * newly-forced-into-frustum content is still streaming in asynchronously in * the background — calling it again shortly after tends to refine it further. */ snapToGround(): boolean; /** * `CesiumIonAuth.fetch()`/`refreshToken()` (see `3d-tiles-renderer/core/plugins/auth/CesiumIonAuth.js`) * only ever throws `"CesiumIonAuthPlugin: Failed to load data with error code {status}"` * on a non-OK HTTP response — no further detail. Map the common statuses to * something a user can actually act on; fall back to the raw message otherwise. */ private _toFriendlyLoadError; /** * Sets everything up and resolves only once the FIRST real outcome is known — * either actual content loaded ("load-tileset") or the initial fetch (auth * against the token/asset) failed ("load-error") — instead of resolving the * instant the TilesRenderer is constructed, before any network activity has * even started. `tilesVisible`/state only flips to enabled on success; on * failure everything set up here is torn down again and the promise rejects, * so the caller (the panel) never has to un-render a half-enabled state. */ enableTiles(): Promise; disableTiles(): void; /** Tears down everything `enableTiles()` set up, without touching `_tilesVisible`. */ private _teardownTiles; dispose(): void; private _trigger; } /** * Streams Cesium Ion 3D Tiles (Google Photorealistic 3D Tiles by default) co-located * with the BIM model. * * Rendering path depends on `world.renderer.postproduction.mode`: * - DEFERRED: the deferred G-buffer capture pass only draws objects whose material * carries the engine's "capture-emission" marker (set on Fragments/BIM surface * materials only) — every other object, however opaque, is hidden for the * duration of the capture (confirmed directly from the engine's own * `SurfaceCapturePass` docs). So tiles are added to a private off-scene * `THREE.Scene` and drawn via `addOcclusionPass` (direct mode — opaque, * self-occluding, same as `PointCloudLoader`), which runs AFTER the deferred * composite and bypasses the G-buffer requirement entirely. * - COMPOSER: the EffectComposer path renders the real scene graph directly, no * special material marker needed, so tiles are added straight to * `world.scene.three` like any other mesh. * * The Cesium Ion API token is kept in memory only (no persistence yet) — see * docs/adrs for the pending decision on where project geo-location should live. */ export type GISManager = InstanceType; /** * Streams Cesium Ion 3D Tiles (Google Photorealistic 3D Tiles by default) co-located * with the BIM model. * * Rendering path depends on `world.renderer.postproduction.mode`: * - DEFERRED: the deferred G-buffer capture pass only draws objects whose material * carries the engine's "capture-emission" marker (set on Fragments/BIM surface * materials only) — every other object, however opaque, is hidden for the * duration of the capture (confirmed directly from the engine's own * `SurfaceCapturePass` docs). So tiles are added to a private off-scene * `THREE.Scene` and drawn via `addOcclusionPass` (direct mode — opaque, * self-occluding, same as `PointCloudLoader`), which runs AFTER the deferred * composite and bypasses the G-buffer requirement entirely. * - COMPOSER: the EffectComposer path renders the real scene graph directly, no * special material marker needed, so tiles are added straight to * `world.scene.three` like any other mesh. * * The Cesium Ion API token is kept in memory only (no persistence yet) — see * docs/adrs for the pending decision on where project geo-location should live. */ export const GISManager = { uuid: 'd8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60' } as typeof _GISManager & { uuid: 'd8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60' }; /** One element mutation inside a revit-flow commit. */ export interface RevitFlowChange { /** create → element added, update → geometry/data changed, delete → removed. */ type: "create" | "update" | "delete" | string; /** Revit UniqueId (GUID). Resolves to a fragments localId via getLocalIdsByGuids. */ uniqueId: string; } /** Per-commit change tallies, mirrored from the add-in's `counts` block. */ export interface RevitFlowCounts { added: number; modified: number; removed: number; } /** * A revit-flow commit — one push of changes from the Revit add-in. `id` is a * monotonic integer; `parent` points at the previous commit (null for the * root). The first commit is the baseline: its geometry IS the visible model * file. Later commits carry only their delta geometry, in a HIDDEN .frag whose * id is `deltaId`. */ export interface RevitFlowCommit { /** * WHAT this commit is. Identity, minted by whoever wrote it, meaningful outside the model it * belongs to — which the old integer was not: that was the platform's storage version, a number * the CDE handed out. An application that does not push through a Revit central has no such * number, and an integer sequence asserts one line of history, which Revit's central enforces and * nothing else has to. */ guid: string; /** * The commits this one was built on. Absent on a root. * * A LIST, because a history that can only ever be a line is a different thing from a graph. A * fork was already expressible with a single parent — two commits naming the same one — but a * MERGE means naming both lines, and that needs this. The first entry is the line the commit * continues, which is what lets the panel lay out lanes without guessing which side is the trunk. * * Revit never writes more than one: its central IS a single line and it merges inside itself * rather than in this graph. The list is for the applications that are not Revit. */ parents?: string[] | null; /** * WHERE this landed in the CDE, when there is such a place. Data, never identity, and never shown * as the commit's name. Absent for any application with no version counter. */ version?: number; /** * Position in this model's history, computed from the parent chain when the commits are read. * * Order questions — "is this commit before the one on screen?" — used to be asked of the integer * id, which meant every application had to produce a sequence to be understood. They are asked of * this instead: derived from the graph, so an application that has no numbers still answers them. */ ordinal: number; /** * What the author said this commit was for, in their own words. Absent when nobody said * anything, which is most commits. * * In Revit it comes from the Comment box in its own Synchronize with Central dialog, which * people have been typing into for years while it went nowhere. Free text: never parsed, never * relied on for structure. */ message?: string; author: string; source: string; timestamp: string; changes: RevitFlowChange[]; counts: RevitFlowCounts; /** * Hidden-file id of this commit's delta .frag (created+modified geometry). * Absent on the baseline/first commit and on geometry-less commits. The * platform's hidden-file API has no queryable name, so the delta is loaded by * this id, never by filename. */ deltaId?: string; /** * Platform user id of the committer, recorded by the add-in from its API key. Lets the * UI resolve the author to a real project member (avatar + name) via getProjectData, * instead of deriving initials from the raw Revit username. Absent on history written * before this was recorded, or when the key isn't a readable JWT. */ userId?: string; /** * Which loaded model this commit belongs to (the model file's id == the viewer's * modelId). Tagged in by the manager when it reads the history: commit ids are * per-model version numbers, so they repeat across models and can't identify a commit * on their own. */ modelId?: string; /** The model's name AS SHOWN IN PROJECT FILES, for the cards and the model filter. */ modelName?: string; /** * This commit re-exported the WHOLE model, so the project's visible .frag shows the * model as of here — what anyone opening it from Project Files gets, without the * history panel. True for the initial capture and for the periodic full exports the * team publishes; ordinary commits ship only their delta. */ full?: boolean; /** * Interoperability operations this commit materialised. Present only when somebody in * Revit pulled a deferred edit: the commit is the native half of it, and this is the * link back to the operation that asked for it. Ordinary hand-authored commits, which * are nearly all of them, carry no such key at all. */ appliedOps?: string[]; /** * Set when this entry is NOT a commit but a deferred edit still waiting to be applied. * * Pending operations are surfaced commit-SHAPED rather than as a parallel kind of thing, so * they inherit search, the user and model filters, the change-kind chips and the * filter-by-selection behaviour instead of needing all of it reimplemented. It also means * one of them can be clicked and previewed: a `modify` or `delete` names elements that * already exist, which is exactly what the outline machinery consumes, so you can see what * a change will touch before anybody applies it. A `create` has nothing to show yet, which * is honest rather than missing. * * Everything that treats an entry as history must check this first: it has not happened. */ pendingOp?: RevitFlowOp; } /** Shape of `revitflow_history.json`. */ export interface RevitFlowHistory { model: string; commits: RevitFlowCommit[]; } /** * One deferred edit waiting to be applied to a model. * * Operations are NOT commits and do not live in the graph: a commit is immutable past, an * operation is optional future. They sit above the model's HEAD until somebody opens the * model in Revit and applies one, at which point they become a commit and stop being * pending. Mirrors the add-in's `revitflow_ops.json`. */ export interface RevitFlowOp { opId: string; /** Groups the operations one authored action produced across several models. */ batchId?: string; /** Hidden-file id of the operation's .frag payload. */ fragId?: string; title?: string; /** add | set | remove | mixed. Older queues say modify | create | delete. */ verb?: string; author?: string; /** * Platform user id of whoever authored it. Resolved to a real project member exactly as a * commit's is, so the same person does not appear as "Antonio That Open" on their commits * and as their raw OS username on their operations. */ userId?: string; createdAt?: string; /** The commit this operation was authored against. */ /** The commit this was authored against, by guid. What a proposal actually refers to. */ baseCommitGuid?: string; /** The platform version that commit landed in. Data, for reconciling with the CDE. */ baseCommit?: number; /** How many elements it targets. */ targets?: number; state?: "pending" | "applied" | "discarded" | string; /** The native commit that materialised it, once applied. */ appliedInCommit?: number | null; /** * Native ids the operation actually touched or created, written by the add-in when it applied. * A FLAT list: it does not say which source object produced which result, because nothing in * this system ties an element to an element in another application. * * It is what lets an APPLIED proposal be selected and previewed like a commit, with no payload * fetch at all. Note which halves that leaves blind, because they are opposite ends: * * add pending → nothing exists yet · applied → these are what it made * set pending → its targets · applied → the same targets * remove pending → its targets · applied → nothing, they are gone * * So the only case still needing the payload is a PENDING set or remove, whose target ids live * in the operation's .frag rather than in this index. */ affectedIds?: string[]; /** Tagged in by the manager, exactly as commits are: which model this queue belongs to. */ modelId?: string; modelName?: string; } /** Shape of `revitflow_ops.json`. */ export interface RevitFlowOpsIndex { schema?: string; ops: RevitFlowOp[]; } /** Dominant change type of a commit, used to color its timeline node. */ export type DominantChange = "create" | "update" | "delete"; /** What to do with elements outside the selected commit. */ export type ContextMode = "default" | "hidden"; /** The three kinds of change a commit can carry. */ export type ChangeKind = "create" | "update" | "delete"; /** * Stable id for a commit across models — which is now just its guid. * * It used to have to be `${model}:${id}`, because the id was a per-model version number and every * model had a commit 3. A guid needs no help being unique, and that is exactly what it was for. */ export declare const commitKey: (c: { guid?: string; pendingOp?: { opId: string; }; }) => string; /** How the commit is shown in 3D: review colours, or the model as it ended up. */ export type HighlightMode = "colored" | "plain"; /** Dominant change type of a commit: delete → create → update. */ export declare function dominantChange(commit: RevitFlowCommit): DominantChange; /** * GitHistoryManager — headless engine for the revit-flow git-history built-in. * * Owns ALL viewer mutation for the change outlines. It does NOT load the model — * the user opens a model from the Project Files panel, and this manager reacts to * that load: it reads the model's hidden `revitflow_history.json` (if any) and * publishes the commit list. Showing a commit outlines its changed elements * (create → green, update → blue, delete → red) via three independently-colored * `OBF.Outliner` groups — a cheap post-process outline that never recolors the * fragment geometry. The Lit panel (`top-git-history`) is intent-only: it calls * these methods and subscribes to the events below. * * Data model, per loaded model (fileId == modelId), all HIDDEN children of it: * - revitflow_history.json — { model, commits: [{ id, parent, author, source, * timestamp, changes:[{type,uniqueId}], counts }] }. The first commit is the * INITIAL full-model capture (its geometry == the visible baseline file). * - revitflow_frag_.frag — delta fragments for commit N (its created+modified * geometry), loaded on demand so created elements can be colored. */ declare class _GitHistoryManager extends OBC.Component { static readonly uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81"; enabled: boolean; readonly onCommitsChanged: OBC.Event; /** {@link commitKey} of the highlighted commit, or null when cleared. */ readonly onCommitChanged: OBC.Event; readonly onLoadingChanged: OBC.Event; readonly onError: OBC.Event; /** The GUID currently selected in the 3D view (null when the selection is cleared). */ readonly onSelectedGuidChanged: OBC.Event; /** A source icon was added or replaced. */ readonly onSourceIconsChanged: OBC.Event; /** * Which mark to draw on a commit, by the application that wrote it. * * Every commit already says who made it, in `source`. The panel used to draw the Revit logo on * all of them regardless, which was true while Revit was the only thing that could write one and * became a lie the moment anything else did: a commit from another tool would claim to be a * Revit commit, on the one part of the row whose whole job is to say where a change came from. * * The format is deliberately open about who writes history, so the icons have to be too. This is * the registry. Only `revit` is built in; an application adds its own: * * const history = components.get(GitHistoryManager); * history.setSourceIcon("rhino", "https://…/rhino.svg"); // a URL, or a data: URI * history.setSourceIcon("tekla", "…"); // or the markup * * A source with no icon gets a neutral one rather than somebody else's. */ readonly sourceIcons: Map; /** * @param source the commit's own `source` value, matched case-insensitively. * @param icon a URL, a `data:` URI, or inline `` markup. */ setSourceIcon(source: string, icon: string): void; world?: OBC.World; /** * What happens to elements that are NOT part of the selected commit: * "default" — left as they are (the change outlines sit on the full model) * "hidden" — hidden entirely, isolating the commit's elements * * A dimmed ("ghost") middle ground was dropped: the fragments x-ray writes depth * from the pixels its screen door keeps, so dimmed geometry still occluded the very * elements under review — worse the denser the model in front. Fixing that properly * belongs in the renderer, not here, so this offers the two states that are exact. */ contextMode: ContextMode; /** * Which change kinds to outline. All three by default; the panel's filter buttons * narrow it (e.g. only deletions) without reloading anything. */ typeFilter: Set; /** * How many commits either side of the selected one to keep pre-loaded, so stepping * through the timeline is instant instead of fetching on every click. The window * slides with the selection and everything outside it is disposed, which bounds * memory no matter how long the history gets. */ prefetchRadius: number; /** * How a commit is presented in 3D: * "colored" — outline created/edited/deleted in their colours (the review lens) * "plain" — no outlines: the model simply as it stood AFTER the commit, so the * deleted elements are hidden rather than painted red */ highlightMode: HighlightMode; /** @deprecated kept so older callers still compile — maps onto contextMode. */ get isolateChanges(): boolean; /** Green — created elements. */ readonly COLOR_CREATED = "#22c55e"; /** Golden yellow — modified elements. */ readonly COLOR_MODIFIED = "#e3b341"; /** Red — deleted elements. */ readonly COLOR_DELETED = "#ef4444"; readonly GROUP_CREATED = "revitflow-created"; readonly GROUP_MODIFIED = "revitflow-modified"; readonly GROUP_DELETED = "revitflow-deleted"; private _client?; private _projectId?; /** * One entry per loaded revit-flow model. Commit ids are per-model version numbers, so * they collide across models — every commit is tagged with its modelId and a commit is * addressed by {@link commitKey}, never by id alone. */ private _models; /** Which models the timeline shows. Empty = all of them. */ private _selectedModels; /** `${modelId}:${id}` of the commit currently highlighted, or null. */ private _currentKey; /** modelIds already probed for a sibling history (avoids re-probing). */ private _probed; /** hiddenIds of delta frags this manager has loaded into the viewer. */ private _loadedDeltas; /** Ghosted localIds per modelId, so isolate can be cleared/re-applied. */ private _contextApplied; /** localIds hidden because the shown commit deleted them (plain mode). */ private _hiddenDeleted; /** localIds hidden because a newer visible source supplies the same element. */ private _hiddenSuperseded; /** True once the three named Outliner groups have been created. */ private _groupsReady; private _loading; private _wired; constructor(components: OBC.Components); get ready(): boolean; get loading(): boolean; /** * Commits of the selected models, newest last, interleaved by time so a multi-model * timeline reads chronologically rather than model-by-model. */ get commits(): RevitFlowCommit[]; /** True when this entry is a proposal rather than something that happened. */ isProposal(commit: RevitFlowCommit | null | undefined): boolean; /** * The entry a proposal/commit links to, in whichever direction applies: a commit points at * the proposal it materialised, a proposal at the commit that did it. Returns null when * there is no counterpart, which is the normal case for hand-authored work. */ counterpart(commit: RevitFlowCommit): RevitFlowCommit | null; /** * Deferred edits still waiting to be applied, across the selected models, oldest first. * * Kept separate from {@link commits} on purpose. A commit is something that happened; a * pending operation is something that might. Merging them into one list would force every * consumer to keep asking which kind it was holding. */ get pendingOps(): RevitFlowOp[]; /** The loaded revit-flow models, for the panel's model filter. */ get models(): Array<{ modelId: string; name: string; commits: number; }>; get selectedModels(): Set; get currentKey(): string | null; /** Name of the single loaded model, or "" when there are none/several. */ get modelName(): string; /** The commit behind {@link currentKey}, or undefined when nothing is highlighted. */ private _currentCommit; /** Restrict the timeline to these models (empty set = show all of them). */ setSelectedModels(modelIds: Iterable): Promise; /** True when `commit` is its model's baseline (the full-model capture). */ isBaseline(commit: RevitFlowCommit): boolean; /** True if `commit` has a hidden delta .frag to load. */ hasFrag(commit: RevitFlowCommit): boolean; /** * Wire the platform client and subscribe to model loads. Does NOT load any * geometry: the manager only attaches to models the user opens from the Files * panel. Consumer panels call this once on connect. */ init(client: PlatformClient): Promise; /** * Follow the viewer's selection so the element view tracks whatever the user clicks in * 3D — no "trace this" button to press. The Highlighter's events appear asynchronously * (they're registered when the viewer sets it up), so retry briefly until they exist. */ private _watchSelection; private _onModelSet; private _onModelDeleted; /** * Probe a loaded model for a sibling visible `revitflow_history.json` in its * folder. If present, adopt it as the active model and publish its commits. * Silent for non-revit models and for our own delta frags — only genuine * fetch/parse failures raise onError. */ private _probeModel; /** * Read the model's deferred-edit queue, if it has one. * * Best effort by design: a model that has never been the target of an operation simply has * no queue, and that is the normal case rather than an error. A failure here must never * cost the user their history, which is why it cannot throw out of the probe. */ private _readOps; /** * Re-scan every currently-loaded model for a hidden revit-flow history (the * panel's Refresh button). Clears the probe cache so models load-order edge * cases re-resolve. */ loadHistory(): Promise; /** * Show `commit`. The baseline geometry is the visible model the user already loaded, so * the baseline view just clears outlines. Any other commit pulls its hidden delta frag * in (so created elements exist) and outlines its changed elements. Fires * onCommitChanged. Takes the commit itself, not an id: ids repeat across models. */ showCommit(commit: RevitFlowCommit): Promise; /** * Keep the deltas of the commits around `centerId` loaded and drop the rest, so * stepping through the timeline never stalls and memory stays bounded: moving from * commit 10 to 11 fetches one delta and disposes one, instead of reloading a window. */ private _slidePrefetchWindow; /** * Show the model as it stood AT `commit`: the visible baseline is the model at its * INITIAL commit, and everything created later lives in per-commit delta .frags loaded * as separate models. Those deltas stay loaded (the prefetch window keeps neighbours * warm), so stepping BACK has to hide the ones from later commits — otherwise a wall * added in commit 3 was still sitting there while you were looking at commit 2. * Only touches deltas of the commit's own model; other models keep their own state. */ private _applyFutureVisibility; /** Which commit a loaded delta belongs to (deltas are keyed by their hidden id). */ private _commitOfDelta; /** Make every loaded delta visible again (the model as of its latest commit). */ private _showAllDeltas; /** Remove all revit-flow outlines + ghosting and reset the selection. */ clear(): Promise; /** Set what happens to non-commit elements; re-applies to the current commit. */ setContextMode(mode: ContextMode): Promise; /** * Every commit that touched `uniqueId`, oldest first, with what happened to it there. * The element's life story: created here, edited there, finally deleted. */ elementHistory(uniqueId: string): Array<{ commit: RevitFlowCommit; type: string; }>; /** Per-author totals across the (optionally date-filtered) history. */ userActivity(since?: Date): Array<{ author: string; userId?: string; commits: number; added: number; modified: number; removed: number; last: string; }>; /** * The GUID of whatever is currently selected in the viewer, so the element view can * follow the user's selection. Returns null when nothing (or something unresolvable) * is selected. */ /** GUIDs of everything currently selected in the viewer (empty when nothing is). */ selectedGuids(): Promise; selectedGuid(): Promise; /** * Select every element the commit touched, in the viewer's own selection — so the * usual tools (properties, isolate, zoom) work on it like any hand-made selection. * Honours the current type filter, so "only deletions" selects only those. * @returns how many elements ended up selected. */ selectCommitElements(commit: RevitFlowCommit, zoom?: boolean): Promise; /** Show/hide one kind of change; re-applies to the current commit. */ setTypeVisible(kind: ChangeKind, on: boolean): Promise; /** @deprecated use setContextMode. */ setIsolateChanges(on: boolean): Promise; /** The shared Outliner component (created on first access by the viewer). */ private _outliner; /** * Create the three independently-colored outline groups once. The viewer * owns the Outliner's DEFAULT group (selection) — we only add our own named * groups and never touch "default". */ private _ensureGroups; /** Clear our three outline groups only — leaves the viewer's default group. */ private _clearOutlines; /** * Resolve each change bucket's GUIDs to localIds across every loaded model * and route them to the matching outline group. */ private _outlineCommit; /** * Remove every localId that `_applySupersededVisibility` has hidden from a change map. * Returns a copy: the input maps come from `_buildMap` and are used elsewhere. */ private _dropSuperseded; /** * Hide (or restore) the elements a commit deleted. Tracked separately from the context * modes so switching Colored↔Plain doesn't disturb ghosting or the rest of the model. */ private _applyDeletedVisibility; /** * Show each element ONCE: from the newest source that supplies it. * * THE BUG THIS EXISTS FOR. The baseline .frag holds the whole model as of the first * commit, and every later commit ships a delta .frag with the geometry it created AND * the geometry it modified. Both stay in the scene. For a CREATED element that is * right — it exists in exactly one place. For a MODIFIED one it is not: the element is * in the baseline at its old shape and in the delta at its new one, and the viewer drew * both. Measured 2026-08-05 on a wall whose height Quim raised: the new wall stood * proud of the old one, with the coincident faces z-fighting into a dotted band. * * The rule is the obvious one once stated: for any element, only the newest VISIBLE * source may draw it. Deltas are walked newest-first, each guid is claimed by the first * source that has it, and every older copy — in an older delta or in the baseline — is * hidden. Deltas newer than the commit being shown are already hidden wholesale by * `_applyFutureVisibility`, so they never get to claim anything. * * Restores before it hides, like `_applyDeletedVisibility`, so stepping backwards * through the timeline brings the old geometry back rather than accumulating hidden * elements until the model is empty. */ private _applySupersededVisibility; /** Switch between review colours and the plain post-commit model. */ setHighlightMode(mode: HighlightMode): Promise; /** * Make sure the geometry of `deleted` GUIDs is loaded. Anything already resolvable in * a loaded model (the usual case: the element shipped in the baseline) needs nothing; * for the rest, walk back through the history to the commit that CREATED each one and * load that commit's delta, which is the last place its geometry existed. */ private _ensureDeletedGeometry; /** GUIDs → { modelId: Set } across the given models. */ private _buildMap; private _mergeMaps; /** * Dim ("ghost") or hide every element that is NOT part of the shown commit, per the * chosen context mode. Best-effort per model: a model that doesn't support the call is * simply left alone — the outlines still convey the change. */ private _applyContext; /** Undo whatever the context mode did: drop the ghost overlay and restore visibility. */ private _clearContext; /** * Kept for the panel's connect hook. Prefetching is now driven by the SELECTION (see * _slidePrefetchWindow): nothing is downloaded until a commit is opened, and only its * neighbourhood is kept. Warming the newest N up front, as this used to do, spent * bandwidth on commits nobody had asked for and grew without bound. */ warmDeltas(): void; /** Load a commit's hidden delta .frag (by its hidden id) into the viewer (modelId == hiddenId). */ private _ensureDeltaLoaded; private _setLoading; private _firstWorld; } /** * GitHistoryManager — headless engine for the revit-flow git-history built-in. * * Owns ALL viewer mutation for the change outlines. It does NOT load the model — * the user opens a model from the Project Files panel, and this manager reacts to * that load: it reads the model's hidden `revitflow_history.json` (if any) and * publishes the commit list. Showing a commit outlines its changed elements * (create → green, update → blue, delete → red) via three independently-colored * `OBF.Outliner` groups — a cheap post-process outline that never recolors the * fragment geometry. The Lit panel (`top-git-history`) is intent-only: it calls * these methods and subscribes to the events below. * * Data model, per loaded model (fileId == modelId), all HIDDEN children of it: * - revitflow_history.json — { model, commits: [{ id, parent, author, source, * timestamp, changes:[{type,uniqueId}], counts }] }. The first commit is the * INITIAL full-model capture (its geometry == the visible baseline file). * - revitflow_frag_.frag — delta fragments for commit N (its created+modified * geometry), loaded on demand so created elements can be colored. */ export type GitHistoryManager = InstanceType; /** * GitHistoryManager — headless engine for the revit-flow git-history built-in. * * Owns ALL viewer mutation for the change outlines. It does NOT load the model — * the user opens a model from the Project Files panel, and this manager reacts to * that load: it reads the model's hidden `revitflow_history.json` (if any) and * publishes the commit list. Showing a commit outlines its changed elements * (create → green, update → blue, delete → red) via three independently-colored * `OBF.Outliner` groups — a cheap post-process outline that never recolors the * fragment geometry. The Lit panel (`top-git-history`) is intent-only: it calls * these methods and subscribes to the events below. * * Data model, per loaded model (fileId == modelId), all HIDDEN children of it: * - revitflow_history.json — { model, commits: [{ id, parent, author, source, * timestamp, changes:[{type,uniqueId}], counts }] }. The first commit is the * INITIAL full-model capture (its geometry == the visible baseline file). * - revitflow_frag_.frag — delta fragments for commit N (its created+modified * geometry), loaded on demand so created elements can be colored. */ export const GitHistoryManager = { uuid: '3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81' } as typeof _GitHistoryManager & { uuid: '3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81' }; /** * A simple test component to validate the built-in component pipeline. * Replace this with real components once the infrastructure is verified. */ declare class _HelloWorld extends OBC.Component { static readonly uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96"; enabled: boolean; readonly name = "HelloWorld"; constructor(components: OBC.Components); /** * Returns a greeting message and logs it to the console. * @param who - The name to greet. Defaults to `"World"`. */ greet(who?: string): string; } /** * PlatformComponents.import() expects a `main` variable in scope with * a `componentDefinition` property pointing to the OBC.Component class. * The IIFE build (name: 'main') assigns this to `var main = ...`. */ /** * A simple test component to validate the built-in component pipeline. * Replace this with real components once the infrastructure is verified. */ export type HelloWorld = InstanceType; /** * A simple test component to validate the built-in component pipeline. * Replace this with real components once the infrastructure is verified. */ export const HelloWorld = { uuid: '2c4ae432-fc24-43e9-9783-0c960c674e96' } as typeof _HelloWorld & { uuid: '2c4ae432-fc24-43e9-9783-0c960c674e96' }; export type ProjectNamespaceKey = "origin" | "georeferencing" | "appSettings"; export interface ProjectNamespace { label: string; description?: string; } export interface ProjectEntity { namespaceId: ProjectNamespaceKey; label: string; description?: string; data: T; } /** GIS origin point that fixes the scene's (0,0,0) to a real-world coordinate. */ export interface OriginData { lat: number; lon: number; height: number; rotation: number; } /** Project-wide coordinate reference system + vertical datum config, shared by * every asset type that needs to decode raw projected coordinates (point * clouds, BIM) — see automatic-file-derived-georeferencing.md * (VisorUnificadoAqualia/docs/adrs). One value per project, not per asset: * every file at the same real-world site shares the same CRS/geoid. */ export interface CrsData { /** EPSG code of the project's projected CRS (e.g. 25830 for ETRS89/UTM 30N). * EPSG is a global registry, not region-specific — every project has an * applicable code, most commonly a standard UTM zone. */ epsgCode: number; /** Geoid undulation in meters at the project's origin (orthometric -> * ellipsoidal height correction). Sampled once from a geoid model * (client-supplied, or a global EGM2008 fallback) — varies negligibly * across a single project's extent, so one scalar per project suffices. */ geoidUndulation: number; } export type AssetCoordinateType = "splat" | "ifc" | "point-cloud" | (string & {}); export interface AssetCoordinate { fileId: string; type: AssetCoordinateType; lat: number; lon: number; height: number; rotation: number; } export interface GraphicsSettingsData { stylePreset: string; postproduction: boolean; edges: { enabled: boolean; color: string; opacity: number; }; ambientOcclusion: { enabled: boolean; value: number; }; tonalShading: { enabled: boolean; value: number; }; surfaceColor: { enabled: boolean; }; transparentBackground: { enabled: boolean; color: string; }; grid: { enabled: boolean; color: string; }; gridHeight: { auto: boolean; value: number; }; antiAliasing: boolean; nativeResolution: boolean; adaptiveResolution: { enabled: boolean; value: number; }; minResolution: number; renderScale: number; } export interface ProjectManagerData { schemaVersion: 1; namespaces: Record; entities: { origin: ProjectEntity; crs: ProjectEntity; assetCoordinates: ProjectEntity; graphicsSettings: ProjectEntity; }; } export interface SingletonEntity { get(): T | undefined; set(data: T): Promise; update(partial: Partial): Promise; } /** * A singleton entity that also announces its own changes — for values other * code needs to react to live (recompute/reposition something) rather than * just read on demand. `onChange` fires with the new value on every * `set`/`update`, regardless of whether that change has been persisted yet * (see `ProjectManager.dirty`/`onDirtyChange`). */ export interface ReactiveSingletonEntity extends SingletonEntity { onChange: import("@thatopen/components").Event; } export interface AssetCoordinatesEntity { getAll(): AssetCoordinate[]; get(fileId: string): AssetCoordinate | undefined; getByType(type: AssetCoordinateType): AssetCoordinate[]; set(fileId: string, data: Omit): Promise; remove(fileId: string): Promise; } /** * ProjectManager is the platform's canonical store for project-level * configuration and data — origin/georeferencing/app-settings today, with * room to grow. It persists a single JSON file (`${ProjectManager.uuid}.json`) * loose directly inside `__project_data` (same folder convention `GISManager` * already used) — NOT in a per-app subfolder like `collider`/`cde`, which are * for secondary, per-builtin data. Sharing that root folder with other * builtins doesn't change its role: it's still the one canonical project * record, meant to stop each builtin from inventing its own ad-hoc * project-persistence pattern. * * Schema shape (see `src/types.ts` for the full rationale): * - `namespaces`/`entities` are maps keyed by a fixed, readable slug — a * closed set this code defines, never created at runtime. * - `origin`/`crs`/`graphicsSettings` are singletons; `assetCoordinates` is * a collection. * - `entities[id]` is a uniform envelope: `namespaceId`, mandatory `label`, * optional `description` (omitted, not stored empty), free-form `data`. */ declare class _ProjectManager extends OBC.Component { static readonly uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f"; enabled: boolean; /** True once init(client) has been called — safe to use the entity accessors. */ get ready(): boolean; /** Suppress auto-save while bulk-loading data. */ private _loadingData; readonly onSaveStart: OBC.Event; readonly onSaveComplete: OBC.Event; /** * Entity ids (e.g. `"origin"`) with changes not yet persisted. Most entities * auto-save (see `_scheduleSave`) so they're only ever dirty for the instant * before their debounce fires — `origin` is the exception: its `set`/`update` * mark it dirty WITHOUT scheduling a save (see `origin` below), so a caller * driving it continuously (e.g. a drag gizmo) can update it every frame * without spamming the network, and a UI can surface "unsaved changes" + * call `flush()` once the user explicitly confirms. * * KNOWN GAP: `_doSave()` persists the whole `_data` blob (one JSON file for * every entity), so an auto-saving entity's save will also flush out * whatever `origin` currently holds in memory, even if the user hasn't * confirmed it yet — there's no separate "committed vs. draft" copy of * `origin`'s data. Accepted for now as a v1 gap (same spirit as this * package's other documented v1 gaps, see the ProjectManager ADR); revisit * if that coincidence turns out to matter in practice. */ private _dirtyEntities; /** True while any entity has unsaved changes. */ get dirty(): boolean; /** Ids of entities with unsaved changes right now. */ get dirtyEntities(): string[]; /** Fires with the current `dirtyEntities` list every time it changes. */ readonly onDirtyChange: OBC.Event; private _markDirty; private _client?; private _fileId?; private _data; private _saveTimer?; private _savePromise?; private _scheduleSave; private _queueSave; private _doSave; /** * Cancels the pending debounce (if any) and runs the save immediately. * Also the only way to persist an entity that marks itself dirty WITHOUT * auto-scheduling (currently just `origin`) — call this once the user * explicitly confirms. Awaits completion. */ flush(): Promise; init(client: PlatformClient): Promise; /** * NOT auto-saving, unlike every other entity below — `set`/`update` mark it * dirty and fire `onChange` immediately, but leave persisting up to an * explicit `flush()` call. This is what lets a continuous interaction (e.g. * a drag gizmo) update `origin` every frame — live for anyone listening to * `onChange` — without writing to the network on every tick, while still * surfacing "there's an unconfirmed change" via `dirty`/`onDirtyChange` for * a UI to gate behind an explicit save action. */ origin: ReactiveSingletonEntity; crs: ReactiveSingletonEntity; graphicsSettings: SingletonEntity; assetCoordinates: AssetCoordinatesEntity; getNamespaces(): Record; getNamespace(key: ProjectNamespaceKey): Record; } /** * ProjectManager is the platform's canonical store for project-level * configuration and data — origin/georeferencing/app-settings today, with * room to grow. It persists a single JSON file (`${ProjectManager.uuid}.json`) * loose directly inside `__project_data` (same folder convention `GISManager` * already used) — NOT in a per-app subfolder like `collider`/`cde`, which are * for secondary, per-builtin data. Sharing that root folder with other * builtins doesn't change its role: it's still the one canonical project * record, meant to stop each builtin from inventing its own ad-hoc * project-persistence pattern. * * Schema shape (see `src/types.ts` for the full rationale): * - `namespaces`/`entities` are maps keyed by a fixed, readable slug — a * closed set this code defines, never created at runtime. * - `origin`/`crs`/`graphicsSettings` are singletons; `assetCoordinates` is * a collection. * - `entities[id]` is a uniform envelope: `namespaceId`, mandatory `label`, * optional `description` (omitted, not stored empty), free-form `data`. */ export type ProjectManager = InstanceType; /** * ProjectManager is the platform's canonical store for project-level * configuration and data — origin/georeferencing/app-settings today, with * room to grow. It persists a single JSON file (`${ProjectManager.uuid}.json`) * loose directly inside `__project_data` (same folder convention `GISManager` * already used) — NOT in a per-app subfolder like `collider`/`cde`, which are * for secondary, per-builtin data. Sharing that root folder with other * builtins doesn't change its role: it's still the one canonical project * record, meant to stop each builtin from inventing its own ad-hoc * project-persistence pattern. * * Schema shape (see `src/types.ts` for the full rationale): * - `namespaces`/`entities` are maps keyed by a fixed, readable slug — a * closed set this code defines, never created at runtime. * - `origin`/`crs`/`graphicsSettings` are singletons; `assetCoordinates` is * a collection. * - `entities[id]` is a uniform envelope: `namespaceId`, mandatory `label`, * optional `description` (omitted, not stored empty), free-form `data`. */ export const ProjectManager = { uuid: '6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f' } as typeof _ProjectManager & { uuid: '6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f' }; /** `main.bcf`'s path relative to `__project_data/` — shared with * `requestBcfSave` (`UIManager/src/utils/bcf-storage.ts`) so both sides of * the save/load round-trip agree on where the file lives. */ export declare const BCF_DATA_PATH = "topics/main.bcf"; /** Downloads `__project_data/topics/main.bcf` and loads it into `BCFTopics`, * if it already has content. A freshly-created file is empty (0 bytes) — * not a valid BCF zip — so there's nothing to load yet in that case. */ export declare function loadBcfTopics(client: PlatformClient, projectId: string, components: OBC.Components): Promise; /** * Wires up everything `top-topics-panel` (and `clashes-panel`'s "create * topic from clash" feature) needs to work out of the box: `BCFTopics` * configuration (version, author, assignable users — all from real project * data), loading whatever BCF was previously saved for this project, and * resolving `Viewpoints.world` — including backfilling it onto viewpoints * restored from a saved BCF before the 3D world existed yet (`top-viewer` * only creates its `World` once `top-app` finishes mounting, which is later * than `init()` typically runs). */ declare class _TopicsManager extends OBC.Component { static readonly uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76"; enabled: boolean; /** * Consumer apps call this once — same pattern as `ClashesManager.init(client)` * — instead of wiring `BCFTopics.setup()`, loading the saved BCF, and * backfilling viewpoint worlds by hand. */ init(client: PlatformClient): Promise; private _firstWorld; } /** * Wires up everything `top-topics-panel` (and `clashes-panel`'s "create * topic from clash" feature) needs to work out of the box: `BCFTopics` * configuration (version, author, assignable users — all from real project * data), loading whatever BCF was previously saved for this project, and * resolving `Viewpoints.world` — including backfilling it onto viewpoints * restored from a saved BCF before the 3D world existed yet (`top-viewer` * only creates its `World` once `top-app` finishes mounting, which is later * than `init()` typically runs). */ export type TopicsManager = InstanceType; /** * Wires up everything `top-topics-panel` (and `clashes-panel`'s "create * topic from clash" feature) needs to work out of the box: `BCFTopics` * configuration (version, author, assignable users — all from real project * data), loading whatever BCF was previously saved for this project, and * resolving `Viewpoints.world` — including backfilling it onto viewpoints * restored from a saved BCF before the 3D world existed yet (`top-viewer` * only creates its `World` once `top-app` finishes mounting, which is later * than `init()` typically runs). */ export const TopicsManager = { uuid: '69af63aa-19ba-4fc7-b17b-75647bac1d76' } as typeof _TopicsManager & { uuid: '69af63aa-19ba-4fc7-b17b-75647bac1d76' }; declare class _UIManager extends OBC.Component { #private; static readonly uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb"; enabled: boolean; readonly name = "UIManager"; init(): void; } export type UIManager = InstanceType; export const UIManager = { uuid: '234f1416-528d-452a-9cc9-a16c5239b2eb' } as typeof _UIManager & { uuid: '234f1416-528d-452a-9cc9-a16c5239b2eb' };