import type { OsmPbfWay } from "@osmix/pbf"; import type { ContentHasher } from "@osmix/shared/content-hasher"; import type { GeoBbox2D, LonLat, OsmTags, OsmWay } from "@osmix/types"; import Flatbush from "flatbush"; import { Entities, type EntitiesTransferables } from "./entities.ts"; import { type IdOrIndex } from "./ids.ts"; import type { Nodes } from "./nodes.ts"; import type StringTable from "./stringtable.ts"; import { type BufferType } from "./typed-arrays.ts"; export interface WaysTransferables extends EntitiesTransferables { refStart: T; refCount: T; refs: T; bbox: T; /** Optional - can be rebuilt via buildSpatialIndex() */ spatialIndex?: T; } export declare class Ways extends Entities { private spatialIndex; private spatialIndexBuilt; private refStart; private refCount; private refs; private bbox; private nodes; private getNodeLonLat; /** * Create a new Ways index. */ constructor(stringTable: StringTable, nodes: Nodes, transferables?: WaysTransferables); /** * Add a single way to the index. */ addWay(way: OsmWay): number; /** * Bulk add ways directly from a PBF PrimitiveBlock. */ addWays(ways: OsmPbfWay[], blockStringIndexMap: Uint32Array, filter?: (way: OsmWay) => OsmWay | null): number; /** * Compact the internal arrays to free up memory. */ buildEntityIndex(): void; /** * Build the spatial index for ways. * If bbox data already exists (e.g., loaded from storage), reuses it. */ buildSpatialIndex(): Flatbush; /** * Check if the spatial index has been built. */ hasSpatialIndex(): boolean; /** * Get the full way entity. */ getFullEntity(index: number, id: number, tags?: OsmTags): OsmWay; /** * Get the node IDs referenced by a way. */ getRefIds(index: number): number[]; /** * Get the bounding box of a way. */ getEntityBbox(idOrIndex: IdOrIndex): GeoBbox2D; /** * Get the coordinates of a way as a flat array. */ getLine(index: number): Float64Array; /** * Get the coordinates of a way as an array of [lon, lat] pairs. */ getCoordinates(index: number): LonLat[]; /** * Find way indexes that intersect a bounding box. */ intersects(bbox: GeoBbox2D, filterFn?: (index: number) => boolean): number[]; /** * Find way indexes near a point using great-circle distance. * @param lon - Longitude in degrees. * @param lat - Latitude in degrees. * @param maxResults - Maximum number of results to return. * @param maxDistanceKm - Maximum distance in kilometers. * @returns Array of way indexes sorted by distance. */ neighbors(lon: number, lat: number, maxResults?: number, maxDistanceKm?: number): number[]; /** * Get ways within a bounding box. */ withinBbox(bbox: GeoBbox2D, include?: (index: number) => boolean): { ids: Float64Array; positions: Float64Array; startIndices: Uint32Array; }; /** * Get transferable objects for passing to another thread. * Only includes spatialIndex if it has been built. */ transferables(): WaysTransferables; /** * Get the approximate memory requirements for a given number of ways in bytes. */ static getBytesRequired(count: number): number; /** * Update a ContentHasher with way-specific data (node references). */ updateHash(hasher: ContentHasher): ContentHasher; } //# sourceMappingURL=ways.d.ts.map