UNPKG

leaflet-polydraw

Version:

Advanced Leaflet plugin for freehand polygon drawing, with smart merging and powerful editing tools. Compatible with both Leaflet v1.x and v2.x.

26 lines 1.67 kB
/** * Math and conversion helpers for transform mode. * All transforms happen in pixel space and then convert back to lat/lng. */ import * as L from 'leaflet'; import type { PixelPoint, PixelBBox } from './transform-types'; export declare function latLngToPixel(map: L.Map, ll: L.LatLngLiteral): PixelPoint; export declare function pixelToLatLng(map: L.Map, p: PixelPoint): L.LatLngLiteral; export declare function getPixelBBox(rings: PixelPoint[][][]): PixelBBox; export declare function getPixelCentroid(bbox: PixelBBox): PixelPoint; /** * Converts a bounding box to a square, centering the original content. */ export declare function squareBBox(bbox: PixelBBox): PixelBBox; export declare function rotatePointAround(p: PixelPoint, pivot: PixelPoint, radians: number): PixelPoint; export declare function scalePointAround(p: PixelPoint, pivot: PixelPoint, scaleX: number, scaleY: number): PixelPoint; export declare function applyTransform(rings: PixelPoint[][][], pivot: PixelPoint, scaleX: number, scaleY: number, rotation: number): PixelPoint[][][]; export declare function ensureClosedLatLngRing(ll: L.LatLngLiteral[]): L.LatLngLiteral[]; export declare function normalizeLatLngs(input: L.LatLng[] | L.LatLng[][] | L.LatLng[][][]): L.LatLng[][][]; export declare function projectLatLngs(map: L.Map, latLngs: L.LatLng[][][]): { rings: PixelPoint[][][]; ringLengths: number[][]; }; export declare function unprojectToLatLngs(map: L.Map, rings: PixelPoint[][][], templateLatLngs: L.LatLng[][][]): L.LatLngLiteral[][][]; export declare function snapAngleRadians(angle: number, stepDeg?: number): number; //# sourceMappingURL=transform-utils.d.ts.map