import type { CoordinateSystem } from '@deck.gl/core'; import { Position } from "../utils/geojson-types.js"; /** * Abstraction layer for coordinate system math used by edit modes. * * Allows edit modes to be used with geographic (WGS84) or Cartesian (screen/local) * coordinate systems without changing the mode logic. * * Naming note: this interface is intentionally distinct from deck.gl's own * `CoordinateSystem` type (a numeric enum from `@deck.gl/core`), which describes how * positions are projected for *rendering*. `EditModeCoordinateSystem` describes how edit * modes should perform *geometric math* on those positions. * * - GeoCoordinateSystem: wraps turf.js — uses geodesic math, assumes WGS84 lon/lat. * - CartesianCoordinateSystem: uses Euclidean math — suitable for OrthographicView or pixel space. */ export interface EditModeCoordinateSystem { /** * Returns the distance between two positions. * For GeoCoordinateSystem the unit is kilometers; for CartesianCoordinateSystem it is the * native coordinate unit (consistent with destination()). */ distance(a: Position, b: Position): number; /** * Returns the bearing from position `a` to position `b`. * Uses compass convention: 0° = north, clockwise, range [-180, 180]. */ bearing(a: Position, b: Position): number; /** * Returns a new position reached by traveling `distance` units in the given `bearing` * direction from `origin`. */ destination(origin: Position, distance: number, bearing: number): Position; /** * Returns the midpoint between two positions. */ midpoint(a: Position, b: Position): Position; } /** * Geographic coordinate system using turf.js (WGS84 lon/lat, geodesic math). * This is the default and preserves the existing behavior of all edit modes. */ export declare class GeoCoordinateSystem implements EditModeCoordinateSystem { distance(a: Position, b: Position): number; bearing(a: Position, b: Position): number; destination(origin: Position, distance: number, bearing: number): Position; midpoint(a: Position, b: Position): Position; } /** * Cartesian (Euclidean) coordinate system for non-geographic use cases such as * OrthographicView or pixel/local coordinates. * * Bearing follows the same compass convention as the geographic system so that * destination() and bearing() are consistent with each other: * 0° = +Y axis, 90° = +X axis (clockwise from north/up). */ export declare class CartesianCoordinateSystem implements EditModeCoordinateSystem { distance(a: Position, b: Position): number; bearing(a: Position, b: Position): number; destination(origin: Position, distance: number, bearing: number): Position; midpoint(a: Position, b: Position): Position; } /** * Default geographic coordinate system instance. * Used by edit modes when no coordinate system is provided. */ export declare const geoCoordinateSystem: GeoCoordinateSystem; /** * Default Cartesian coordinate system instance. * Use this with OrthographicView or any non-geographic coordinate system. */ export declare const cartesianCoordinateSystem: CartesianCoordinateSystem; /** * Returns the provided coordinate system, or `geoCoordinateSystem` as the default. * Use this helper inside edit modes to avoid null checks scattered throughout the code. */ export declare function getEditModeCoordinateSystem(coordinateSystem?: EditModeCoordinateSystem): EditModeCoordinateSystem; /** * Maps a deck.gl `COORDINATE_SYSTEM` constant to the appropriate `EditModeCoordinateSystem` * implementation for edit-mode geometric math. * * This allows the `EditableGeoJsonLayer` to automatically derive the correct math from * its own `coordinateSystem` prop without requiring consumers to configure it separately. * * | deck.gl constant | Math used | * |------------------------------------|-----------------------| * | `COORDINATE_SYSTEM.LNGLAT` | GeoCoordinateSystem | * | `COORDINATE_SYSTEM.DEFAULT` | GeoCoordinateSystem | * | `COORDINATE_SYSTEM.CARTESIAN` | CartesianCoordinateSystem | * | `COORDINATE_SYSTEM.METER_OFFSETS` | CartesianCoordinateSystem | * | `COORDINATE_SYSTEM.LNGLAT_OFFSETS` | GeoCoordinateSystem | */ export declare function fromDeckCoordinateSystem(deckCoordSystem: CoordinateSystem | undefined): EditModeCoordinateSystem; //# sourceMappingURL=coordinate-system.d.ts.map