/** * Units (spec: issue #20 "Measure widget"). The shared length/area unit system * for the measure widget AND the scale-bar (which refactors onto this module * and gains a `units` attribute — it was metric-only with a hardcoded steps * table). Adopts GL's shared scale-units precedent: the exact metric constants * (0.3048 m/ft, 1609.344 m/mi, 1852 m/nmi), denomination crossover (m→km at * 1000, ft→mi at 5280 ft), and the log10-based 1/2/3/5/10 "nice number" — NOT * MapLibre's digit-count trick, which mis-rounds sub-unit spans. */ export type UnitSystem = "metric" | "imperial" | "nautical"; export declare const UNIT_SYSTEMS: readonly UnitSystem[]; export declare const M_PER_FT = 0.3048; export declare const M_PER_MI = 1609.344; export declare const M_PER_NMI = 1852; /** Validate a unit-system string; `null` for anything not in {@link UNIT_SYSTEMS}. */ export declare function parseUnitSystem(raw: string | null | undefined): UnitSystem | null; /** Format a length (meters) for a unit system, with denomination crossover. */ export declare function formatLength(meters: number, system?: UnitSystem): string; /** * Format an area (m²), with denomination crossover. Metric: m²/ha/km². * Imperial: ft²/acres/mi². Nautical falls back to metric for area (open * question 1 — nmi² is not a denomination users read). */ export declare function formatArea(m2: number, system?: UnitSystem): string; /** * Format a volume (m³, spec: "Cut/fill volume measurement"), with denomination * crossover. Metric: m³, crossing to "×10³ m³" past 1000 m³ (the km² crossover * shape). Imperial: cubic yards — the real-world earthworks unit, not ft³ — with * the same ×10³ crossover. Nautical falls back to metric (formatArea's own * documented fallback: nmi³ is not a denomination anyone reads). */ export declare function formatVolume(m3: number, system?: UnitSystem): string; /** * Format a mass (kg, spec item D — "tonnage"), with denomination crossover. * Metric: tonnes ("t"), crossing to "×10³ t" past 1000 t (matching * {@link formatVolume}'s own crossover shape). Imperial: US short tons * ("ton", 2000 lb) — the earthworks-industry convention, not the UK long * ton. Nautical falls back to metric (formatArea/formatVolume's own * documented fallback). */ export declare function formatMass(kg: number, system?: UnitSystem): string; /** * Convert an author-provided density (spec item D — `density` attribute) to * canonical kg/m³, interpreted per the ACTIVE unit system at the moment it's * set: metric authors give t/m³ (tonnes per cubic meter — the earthworks * convention, e.g. 1.6-1.8 for common soil), imperial authors give lb/yd³. * Nautical falls back to the metric (t/m³) reading. Canonicalizing once here * means a later unit-system TOGGLE (the widget's own units buttons) doesn't * need to re-interpret an already-set density — kg/m³ is unit-system-agnostic. */ export declare function densityToKgM3(raw: number, system: UnitSystem): number; /** * The largest 1/2/3/5 ×10ⁿ value ≤ `value` (GL's log10 "nice number"). Used by * the scale bar to snap its bar to a round distance. log10-based, so it is * correct for sub-unit spans (`value < 1`) where a digit-count rule breaks. */ export declare function niceNumber(value: number): number; /** * Scale-bar helper: given the max distance (meters) that fits the bar's pixel * budget, return the nice round distance to actually draw and its label, in the * chosen unit system. Metric snaps in meters/km, imperial in ft/mi, nautical in * nmi — the crossover handled by {@link formatLength}. */ export declare function scaleBarStep(maxMeters: number, system?: UnitSystem): { meters: number; label: string; };