import { BaseGcpTransformer } from './BaseGcpTransformer.js'; import { BaseTransformation } from '../transformation-types/BaseTransformation.js'; import type { Gcp, Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, Geometry, TypedLineString, TypedPolygon, TypedMultiPoint, TypedMultiLineString, TypedMultiPolygon, TypedGeometry, GeojsonGeometry, GeojsonFeatureCollection, SvgGeometry, SvgCircle, SvgLine, SvgPolyLine, SvgRect, SvgPolygon, GeojsonPoint, GeojsonLineString, GeojsonPolygon, Bbox } from '@allmaps/types'; import type { GcpAndDistortions, TransformationType, GcpTransformerOptions, GcpTransformOptions, TransformationTypeInputs } from '../shared/types.js'; import type { GeoreferencedMap } from '@allmaps/annotation'; /** * Class for Ground Control Point Transformers. * * A GCP Transformer can transform input geometries between 'resource' and 'geo' spaces. * * It does this using a transformation (of a certain type) built from * a set of Ground Control Points (with coordinates in * resource and geo space) and a transformation type. * * It has a method to transform 'toGeo' (from resource to geo space) * and 'toResource' (from geo to resource space), * * This class differs from the GeneralGcpTransformer class in that * it specifically handles the typical Allmaps case where: * - We read in Ground Control Points using the Gcp type, with `resource` and `geo` fields. * - We use the terms 'toGeo' for the 'forward' transformation and 'toResource' for the 'backward' transformation. * - The `differentHandedness` setting is `true` by default, since we expect the resource coordinates to identify pixels on an image, with origin in the top left and the y-axis pointing down. * */ export declare class GcpTransformer extends BaseGcpTransformer { /** * Create a GcpTransformer * * @param gcps - An array of Ground Control Points (GCPs) * @param type - The transformation type * @param partialGcpTransformerOptions - GCP Transformer options */ constructor(gcps: Gcp[], type?: TransformationType, partialGcpTransformerOptions?: Partial); get gcps(): Gcp[]; /** * Get the forward transformation. Create if it doesn't exist yet. */ getToGeoTransformation(): BaseTransformation; /** * Get the backward transformation. Create if it doesn't exist yet. */ getToResourceTransformation(): BaseTransformation; /** * Get the resolution of the toGeo transformation in resource space, within a given bbox. * * This informs you in how fine the warping is, in resource space. * It can be useful e.g. to create a triangulation in resource space * that is fine enough for this warping. * * It is obtained by transforming toGeo two linestring, * namely the horizontal and vertical midlines of the given bbox. * The toGeo transformation will refine these lines: * it will break them in small enough pieces to obtain a near continuous result. * Returned in the length of the shortest piece, measured in resource coordinates. * * @param resourceBbox - BBox in resource space where the resolution is requested * @param partialGcpTransformOptions - GCP Transform options to consider during the transformation * @returns Resolution of the toGeo transformation in resource space */ getToGeoTransformationResolution(resourceBbox: Bbox, partialGcpTransformOptions?: Partial): number | undefined; /** * Get the resolution of the toResource transformation in geo space, within a given bbox. * * This informs you in how fine the warping is, in geo space. * It can be useful e.g. to create a triangulation in geo space * that is fine enough for this warping. * * It is obtained by transforming toResource two linestring, * namely the horizontal and vertical midlines of the given bbox. * The toResource transformation will refine these lines: * it will break them in small enough pieces to obtain a near continuous result. * Returned in the length of the shortest piece, measured in geo coordinates. * * @param geoBbox - BBox in geo space where the resolution is requested * @param partialGcpTransformOptions - GCP Transform options to consider during the transformation * @returns Resolution of the toResource transformation in geo space */ getToResourceTransformationResolution(geoBbox: Bbox, partialGcpTransformOptions: Partial): number | undefined; /** * Get the transformer options. */ getTransformerOptions(): import("../index.js").GeneralGcpTransformerOptions; /** * Set the transformer options. * * Use with caution, especially for options that have effects in the constructor. */ protected setTransformerOptionsInternal(partialGcpTransformerOptions: Partial): void; transformToGeo

(point: Point, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): P; transformToGeo

(lineString: LineString, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedLineString

; transformToGeo

(polygon: Polygon, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedPolygon

; transformToGeo

(multiPoint: MultiPoint, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedMultiPoint

; transformToGeo

(multiLineString: MultiLineString, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedMultiLineString

; transformToGeo

(multiPoint: MultiPolygon, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedMultiPolygon

; transformToGeo

(geometry: Geometry, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedGeometry

; transformToResource

(point: Point, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): P; transformToResource

(lineString: LineString, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedLineString

; transformToResource

(polygon: Polygon, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedPolygon

; transformToResource

(multiPoint: MultiPoint, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedMultiPoint

; transformToResource

(multiLineString: MultiLineString, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedMultiLineString

; transformToResource

(multiPolygon: MultiPolygon, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedMultiPolygon

; transformToResource

(geometry: Geometry, partialGcpTransformOptions?: Partial, gcpToP?: (gcp: GcpAndDistortions) => P): TypedGeometry

; static transformSvgToGeojson(transformer: GcpTransformer, svgCircle: SvgCircle, partialGcpTransformOptions?: Partial): GeojsonPoint; static transformSvgToGeojson(transformer: GcpTransformer, svgLine: SvgLine, partialGcpTransformOptions?: Partial): GeojsonLineString; static transformSvgToGeojson(transformer: GcpTransformer, svgPolyLine: SvgPolyLine, partialGcpTransformOptions?: Partial): GeojsonLineString; static transformSvgToGeojson(transformer: GcpTransformer, svgRect: SvgRect, partialGcpTransformOptions?: Partial): GeojsonPolygon; static transformSvgToGeojson(transformer: GcpTransformer, svgPolygon: SvgPolygon, partialGcpTransformOptions?: Partial): GeojsonPolygon; static transformSvgToGeojson(transformer: GcpTransformer, svgGeometry: SvgGeometry, partialGcpTransformOptions?: Partial): GeojsonGeometry; /** * Transform an SVG string to geo space to a GeoJSON FeatureCollection * * This is a shortcut method, available as static method in order not to overpopulate intellisense suggestions * Note: since this converts to GeoJSON we assume geo-space is in lon-lat WGS84 and automatically set `destinationIsGeographic` to use geographically computed midpoints. * Note: Multi-geometries are not supported * * @param transformer - A GCP Transformer defining the transformation * @param svg - An SVG string to transform * @param partialGcpTransformOptions - GCP Transform options * @returns Input SVG string transformed to geo space, as a GeoJSON FeatureCollection */ static transformSvgStringToGeojsonFeatureCollection(transformer: GcpTransformer, svg: string, partialGcpTransformOptions?: Partial): GeojsonFeatureCollection; /** * Transform a GeoJSON Geometry to resource space to a SVG geometry * * This is a shortcut method, available as static method in order not to overpopulate intellisense suggestions * Note: since this converts from GeoJSON we assume geo-space is in lon-lat WGS84 and automatically set `destinationIsGeographic` to use geographically computed midpoints. * Note: Multi-geometries are not supported * * @param transformer - A GCP Transformer defining the transformation * @param geojsonGeometry - GeoJSON Geometry to transform * @param partialGcpTransformOptions - GCP Transform options * @returns Input GeoJSON Geometry transform to resource space, as SVG geometry */ static transformGeojsonToSvg(transformer: GcpTransformer, geojsonGeometry: GeojsonGeometry, partialGcpTransformOptions?: Partial): SvgGeometry; /** * Transform a GeoJSON FeatureCollection to resource space to a SVG string * * This is a shortcut method, available as static method in order not to overpopulate intellisense suggestions * Note: since this converts from GeoJSON we assume geo-space is in lon-lat WGS84 and automatically set `destinationIsGeographic` to use geographically computed midpoints. * Note: Multi-geometries are not supported * * @param transformer - A GCP Transformer defining the transformation * @param geojson - GeoJSON FeatureCollection to transform * @param partialGcpTransformOptions - GCP Transform options * @returns Input GeoJSON FeaturesCollection transformed to resource space, as SVG string */ static transformGeojsonFeatureCollectionToSvgString(transformer: GcpTransformer, geojson: GeojsonFeatureCollection, partialGcpTransformOptions?: Partial): string; /** * Create a Projected GCP Transformer from a Georeferenced Map * * @param georeferencedMap - A Georeferenced Map * @param options - Options, including GCP Transformer Options, and a transformation type to overrule the type defined in the Georeferenced Map * @returns A Projected GCP Transformer */ static fromGeoreferencedMap(georeferencedMap: GeoreferencedMap, options?: Partial): GcpTransformer; }