import type { BuildingUse, Ring, Vec2 } from '../source'; import type { FacadeChoice } from './facade'; import type { LinearRgb } from './facade'; import type { OrientedBox } from './poly'; import type { StraightSkeleton } from './skeleton'; export type RoofKind = 'flat' | 'gabled' | 'hipped' | 'pyramidal' | 'skillion' | 'dome'; export interface RoofSpec { kind: RoofKind; /** The source's roof shape when the generator drew something else, and why. */ fallback?: string; /** Height of the roof above the eave in metres (0 for a flat roof). */ riseM: number; /** Skillion: compass bearing the slope descends toward (OSM `roof:direction`), degrees. */ directionDeg?: number; /** Hip, gable or pyramid on a polygon: the straight skeleton. */ skeleton?: StraightSkeleton; colour?: LinearRgb; } export type Representation = 'box' | 'poly'; export interface PartPlan { /** Cleaned footprint, wound counter-clockwise from above; holes clockwise. */ outer: Ring; holes: Ring[]; box: OrientedBox; iou: number; /** What the NEAR level draws: the box when it already matches the footprint, otherwise the extruded footprint. */ rep: Representation; /** Underside of the part (`baseY` for a ground part, higher for a raised one). */ bottomY: number; eaveY: number; topY: number; roof: RoofSpec; areaM2: number; } export interface BuildingPlan { id: string; cell: [number, number]; centroid: Vec2; use: BuildingUse; levels: number; /** The seat: the lowest ground under the footprint. */ baseY: number; heightM: number; parts: PartPlan[]; facade: FacadeChoice; /** A mesh building keeps its model; the generator draws only the box (LOD1 and the far layer). */ mesh: { kind: string; ref: string; } | null; /** The source marked the ground floor as a storefront. */ storefront: boolean; notes: string[]; } export interface BuildingsStats { buildings: number; parts: number; meshBuildings: number; refused: Record; notes: Record; nearBox: number; nearPoly: number; roofs: Record; }