import { Geometry } from '@arcgis/core/geometry'; import SpatialReference from '@arcgis/core/geometry/SpatialReference'; import { Items } from './CoordinateTransformer.js'; import '@arcgis/core/geometry/Extent'; import '@arcgis/core/geometry/Geometry'; /** * A transformer strategy is an interface used by the CoordinateTransformer * to forward the transformation to a specific implementation. * * @example Register custom strategy * * In your manifest.json: * * ```json * "components": [{ * "name": "MyCustomTransformerStrategy", * "provides": "coordinatetransformer.CustomTransformerStrategy" * }] * ``` * * In your code (MyCustomTransformerStrategy.ts): * * ```ts * export default class MyCustomTransformerStrategy implements TransformerStrategy { * transform( * geometry: Items, * sourceSRS: SpatialReference, * targetSRS: SpatialReference * ): Items | Promise> { * // pseudo code * return transformation(sourceSRS, targetSRS).transform(geometry); * } * } * ``` */ interface TransformerStrategy { /** * Transforms a geometry. * * @param geometry input geometry * @param sourceSRS source spatial reference system * @param targetSRS target spatial reference system * @returns * The transformed geometry (if input was an array, output will be an array of * transformed geometries). * The types of the geometries must stay the same. */ transform(geometry: Items, sourceSRS: SpatialReference, targetSRS: SpatialReference): Items | Promise>; } export type { TransformerStrategy };