import { FloorplanTool } from '../../components/viewers/bim/src/FloorplanTool'; import type { PlanOverlayOptions, PlanOverlayShape, PlanPoint, SketchKind } from '../../components/viewers/bim/src/FloorplanTool'; import type { PlanFootprint } from '../../components/viewers/bim/src/FloorplanTool/src/spaceFootprints'; import type { ModelIdMap } from '../../components/viewers/bim/src/lib/bimTree'; import type * as OBC from '@thatopen/components'; export interface FloorplanStorey { /** Stable for the session: `${modelId}::${storeyName}`. */ id: string; name: string; /** World height of the storey, in metres. */ elevation: number; modelId: string; } /** The BIM floorplan as a plugin sees it. Coordinates are world metres on the horizontal plane. */ export interface PluginFloorplan { /** False in a viewer without floorplans; every method is then a no-op. */ available: boolean; storeys: FloorplanStorey[]; active: FloorplanStorey | null; isDrawing: boolean; /** True while `editShape` is waiting for the user to finish reshaping an outline. */ isEditingShape: boolean; /** True once the open storey's vector lines exist; sketches snap to their corners. */ hasLines: boolean; activate: (storeyId: string) => Promise; deactivate: () => Promise; /** Projects the open storey's vector lines. Slow on large models, so it is a separate step. */ generateLines: () => Promise; /** Fits the open plan's view to an outline, such as a space's, with some margin around it. */ frame: (points: readonly PlanPoint[]) => Promise; /** Resolves with the drawn outline, or null when cancelled or no plan is open. */ drawShape: (kind: SketchKind) => Promise; /** * Lets the user drag the outline's corners and edges; Ctrl+click adds a corner, Delete removes one. * Resolves with the new outline on Enter or `finishEditingShape`, or null when cancelled. */ editShape: (points: readonly PlanPoint[]) => Promise; finishEditingShape: () => void; /** Cancels a drawing or a shape edit in progress. */ cancelDrawing: () => void; /** Replaces this plugin's shapes on the open plan. They follow whichever storey is open. */ setOverlay: (shapes: readonly PlanOverlayShape[], options?: PlanOverlayOptions) => void; clearOverlay: () => void; /** Floor outlines of elements such as IFCSPACEs, for drawing them with `setOverlay`. */ getSpaceFootprints: (items: ModelIdMap) => Promise; } interface FloorplanSnapshot { storeys: FloorplanStorey[]; active: FloorplanStorey | null; isDrawing: boolean; isEditingShape: boolean; hasLines: boolean; } /** Live floorplan state plus the tool, for binding to a plugin with {@link bindPluginFloorplan}. */ export declare function useFloorplanSource(components: OBC.Components | null): { tool: FloorplanTool; components: OBC.Components; state: FloorplanSnapshot; }; export type FloorplanSource = ReturnType; /** The floorplan surface for one plugin; overlays are kept per `pluginId`. */ export declare function bindPluginFloorplan(source: FloorplanSource, pluginId: string): PluginFloorplan; export type { PlanFootprint, PlanOverlayOptions, PlanOverlayShape, PlanPoint, SketchKind }; //# sourceMappingURL=floorplan.d.ts.map