import type { CityBuilding, CitySource, Vec2 } from '../source'; export interface StreetHit { point: Vec2; distance: number; } export declare function pointToSegment(p: Vec2, a: Vec2, b: Vec2): { point: Vec2; distance: number; }; export declare class StreetIndex { readonly cell: number; readonly reach: number; private readonly buckets; constructor(source: CitySource, cell?: number, reach?: number); /** The nearest street centreline point within `reach`, or null. */ nearest(p: Vec2): StreetHit | null; } interface Band { a: Vec2; b: Vec2; hw: number; sidewalk: number; deck: boolean; } export interface RoadwayHit { point: Vec2; distance: number; band: Band; offset: number; } export interface SettleResult { position: Vec2; moved: boolean; } export type SettleRefusal = 'deck' | 'roadway'; /** * The drivable carriageways of a source as bands (centreline segment, half width, sidewalk), so a prop can be moved off the * asphalt. A POI that OpenStreetMap puts on a junction node or on the centreline (every traffic signal, many bus stops and * hydrants) is moved to the kerb: the corner of the junction for a node, the nearest kerb for a point on a leg. A prop already * on the sidewalk or beyond it stays where it was mapped. A POI on a bridge deck is refused (the terrain is not under it). */ export declare class Roadways { private readonly cell; private readonly reach; private readonly buckets; private readonly legs; constructor(source: CitySource, cell?: number, reach?: number); private addBand; private addLeg; private candidates; /** The nearest carriageway centreline point, by distance to the centreline minus the half width (negative inside the asphalt). */ nearest(p: Vec2): RoadwayHit | null; /** The most violated band at `p`: the one whose kerb plus `clearance` the point is deepest inside, or null when it is clear of all. */ private violation; /** True when `p` is on a bridge deck's asphalt and on no ground-level carriageway. */ private onDeck; /** A junction corner: the point `clearance` outside the kerbs of two adjacent legs, picked among the corners by the POI id. */ private corner; /** * Moves `p` off the roadway if it is in it: `clearance` is how far outside the kerb the prop's origin must stand. Returns null * when the POI is on a deck or cannot be settled in a few pushes (it is then not placed). */ settle(p: Vec2, clearance: number, id: string): ({ position: Vec2; moved: boolean; } | { refusal: SettleRefusal; }); } /** * Where a building stands on the ground, so a prop mapped inside one (an indoor bench, a lobby bin, a platform stop mapped on the * station building) is not placed inside its walls. A part raised off the ground (`min_height` over 3 m: a bridge building, an * overhang) leaves the street under it free. */ export declare class Footprints { private readonly cell; private readonly buckets; constructor(buildings: ReadonlyArray | undefined, cell?: number); contains(p: Vec2): boolean; } export {};