@allmaps/render
Version:
Render functions for WebGL and image buffers
131 lines (129 loc) • 7.08 kB
TypeScript
import { GeoreferencedMap } from '@allmaps/annotation';
import { WarpedMap } from './WarpedMap.js';
import { SpecificTriangulatedWarpedMapOptions, TriangulatedWarpedMapOptions, WarpedMapListOptions, 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 const DEFAULT_SPECIFIC_TRIANGULATED_WARPED_MAP_OPTIONS: SpecificTriangulatedWarpedMapOptions;
export declare function createTriangulatedWarpedMapFactory(): (mapId: string, georeferencedMap: GeoreferencedMap, listOptions?: Partial<WarpedMapListOptions>, mapOptions?: 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 projectedGeoPreviousTriangulationAppliableMask - The resource appliable mask refined by the previous triangulation, in projected geospatial coordinates
* @param projectedGeoTriangulationAppliableMask - The resource appliable mask refined by the triangulation, in projected geospatial coordinates
* @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 {
mapOptions: Partial<TriangulatedWarpedMapOptions>;
listOptions: Partial<TriangulatedWarpedMapOptions>;
georeferencedMapOptions: Partial<TriangulatedWarpedMapOptions>;
defaultOptions: TriangulatedWarpedMapOptions;
options: TriangulatedWarpedMapOptions;
previousResourceResolution: number | undefined;
resourceResolution: number | undefined;
triangulateErrorCount: number;
projectedGcpPreviousTriangulation?: GcpTriangulation;
projectedGcpTriangulation?: GcpTriangulation;
protected resourceTriangulationCache: Map<number, Map<string, TriangulationToUnique>>;
protected projectedGcpTriangulationCache: Map<number, Map<string, Map<TransformationType, Map<string, GcpTriangulation>>>>;
resourceTrianglePoints: Point[];
projectedGeoPreviousTrianglePoints: Point[];
projectedGeoTrianglePoints: Point[];
previousTrianglePointsDistortion: number[];
trianglePointsDistortion: number[];
projectedGeoPreviousTriangulationAppliableMask: Ring;
projectedGeoTriangulationAppliableMask: Ring;
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, listOptions?: Partial<WarpedMapListOptions>, mapOptions?: Partial<WarpedMapOptions>);
/**
* Get default options
*/
static getDefaultOptions(): TriangulatedWarpedMapOptions;
/** Set default options */
setDefaultOptions(): void;
/**
* Update the ground control points loaded from a georeferenced map to new ground control points.
*
* @param gcps - the new ground control points
*/
protected setGcps(gcps: Gcp[]): void;
/**
* Update the resource mask loaded from a georeferenced map to a new mask.
*
* @param resourceMask - the new mask
*/
protected setResourceMask(resourceFullMask: Ring, resourceAppliableMask: Ring, resourceMask: Ring): void;
/**
* Set the distortionMeasure
*
* @param distortionMeasure - the disortion measure
*/
protected setDistortionMeasure(distortionMeasure?: DistortionMeasure): void;
/**
* Set the internal projection
*
* @param projection - the internal projection
*/
protected setInternalProjection(projection: Projection): void;
/**
* Set the projection
*
* @param projection - the projection
*/
protected setProjection(projection: Projection): void;
/**
* Reset previous transform properties to new ones (when completing an animation).
*/
resetPrevious(): void;
/**
* Mix previous transform properties with new ones (when changing an ongoing animation).
*
* @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 {};