UNPKG

@allmaps/render

Version:

Render functions for WebGL and image buffers

115 lines (113 loc) 5.83 kB
import { GeoreferencedMap } from '@allmaps/annotation'; import { WarpedMap } from './WarpedMap.js'; import { WarpedMapOptions } from '../shared/types.js'; import { GcpAndDistortions, DistortionMeasure, TransformationType } from '@allmaps/transform'; import { Gcp, Point, Ring, TypedPolygon } from '@allmaps/types'; import { TriangulationToUnique } from '@allmaps/triangulate'; import { Projection } from '@allmaps/project'; export declare function createTriangulatedWarpedMapFactory(): (mapId: string, georeferencedMap: GeoreferencedMap, options?: Partial<WarpedMapOptions>) => TriangulatedWarpedMap; type GcpTriangulation = { resourceResolution: number | undefined; gcpUniquePoints: GcpAndDistortions[]; uniquePointIndices: number[]; uniquePointIndexInterpolatedPolygon: TypedPolygon<number>; }; /** * Class for triangulated WarpedMaps. * * @param resourcePreviousResolution - Resolution (or 'distance') used during the previous triangulation of the resource mask * @param resourceResolution - Resolution (or 'distance') used during the triangulation of the resource mask, computed as the finest resource segment resulting from a resource-to-geo transformation of the horizontal and vertical midline of the resource bbox using the current transformation type * @param triangulateErrorCount - Number of time the triangulation has resulted in an error * @param projectedGcpPreviousTriangulation - Previous triangulation of the resource mask * @param projectedGcpTriangulation - Triangulation of the resource mask of a specific resource resolution, with unique points in resource and projected geospatial coordinates with distortions, and indices pointing to the triangles points and indices pointing to the triangulation-refined resource mask * @param resourceTrianglePoints - Triangle points of the triangles the triangulated resourceMask * @param projectedGeoPreviousTrianglePoints - The projectedGeoTrianglePoints of the previous transformation type, used during transformation transitions * @param projectedGeoTrianglePoints - The resourceTrianglePoints in projected geospatial coordinates * @param previousTrianglePointsDistortion - The trianglePointsDistortion of the previous transformation type, used during transformation transitions * @param trianglePointsDistortion - Distortion amount of the distortionMeasure at the projectedGeoTrianglePoints * @param projectedGeoPreviousTriangulationMask - The resource mask refined by the previous triangulation, in projected geospatial coordinates * @param projectedGeoTriangulationMask - The resource mask refined by the triangulation, in projected geospatial coordinates */ export declare class TriangulatedWarpedMap extends WarpedMap { previousResourceResolution: number | undefined; resourceResolution: number | undefined; triangulateErrorCount: number; projectedGcpPreviousTriangulation?: GcpTriangulation; projectedGcpTriangulation?: GcpTriangulation; protected resourceTriangulationCache: Map<number, TriangulationToUnique>; protected projectedGcpTriangulationCache: Map<number, Map<TransformationType, Map<Projection, GcpTriangulation>>>; resourceTrianglePoints: Point[]; projectedGeoPreviousTrianglePoints: Point[]; projectedGeoTrianglePoints: Point[]; previousTrianglePointsDistortion: number[]; trianglePointsDistortion: number[]; projectedGeoPreviousTriangulationMask: Ring; projectedGeoTriangulationMask: Ring; /** * Creates an instance of a TriangulatedWarpedMap. * * @param mapId - ID of the map * @param georeferencedMap - Georeferenced map used to construct the WarpedMap * @param options - Options */ constructor(mapId: string, georeferencedMap: GeoreferencedMap, options?: Partial<WarpedMapOptions>); /** * Update the ground control points loaded from a georeferenced map to new ground control points. * * @param gcps - the new ground control points */ setGcps(gcps: Gcp[]): void; /** * Update the resource mask loaded from a georeferenced map to a new mask. * * @param resourceMask - the new mask */ setResourceMask(resourceMask: Ring): void; /** * Set the distortionMeasure * * @param distortionMeasure - the disortion measure */ setDistortionMeasure(distortionMeasure?: DistortionMeasure): void; /** * Set the internal projection * * @param projection - the internal projection */ setInternalProjection(projection: Projection): void; /** * Set the projection * * @param projection - the projection */ setProjection(projection: Projection): void; /** * Reset previous transform properties to new ones (when completing a transformer transitions). */ resetPrevious(): void; /** * Mix previous transform properties with new ones (when changing an ongoing transformer transition). * * @param t - animation progress */ mixPreviousAndNew(t: number): void; /** * Update the (previous and new) triangulation of the resourceMask. Use cache if available. */ private updateTriangulation; /** * Derive the (previous and new) resource and projectedGeo points from their corresponding triangulations. * * Also derive the (previous and new) triangulation-refined resource and projectedGeo mask */ private updateTrianglePoints; /** * Derive the (previous and new) distortions from their corresponding triangulations. */ private updateTrianglePointsDistortion; protected updateProjectedTransformerProperties(): void; protected clearProjectedTransformerCaches(): void; protected clearResourceTriangulationCaches(): void; protected clearProjectedTriangulationCaches(): void; } export {};