UNPKG

2.36 kBTypeScriptView Raw
1import L from "leaflet";
2import { GeodesicCore, GeodesicOptions } from "./geodesic-core";
3/** detailled information of the current geometry */
4export interface Statistics {
5 /** Stores the distance for each individual geodesic line */
6 distanceArray: number[];
7 /** overall distance of all lines */
8 totalDistance: number;
9 /** number of positions that the geodesic lines are created from */
10 points: number;
11 /** number vertices that were created during geometry calculation */
12 vertices: number;
13}
14export declare class GeodesicGeometry {
15 readonly geodesic: GeodesicCore;
16 readonly options: GeodesicOptions;
17 steps: number;
18 constructor(options?: GeodesicOptions);
19 recursiveMidpoint(start: L.LatLng, dest: L.LatLng, iterations: number): L.LatLng[];
20 line(start: L.LatLng, dest: L.LatLng): L.LatLng[];
21 circle(center: L.LatLng, radius: number): L.LatLng[];
22 multiLineString(latlngs: L.LatLng[][]): L.LatLng[][];
23 lineString(latlngs: L.LatLng[]): L.LatLng[];
24 /**
25 *
26 * Is much (10x) faster than the previous implementation:
27 *
28 * ```
29 * Benchmark (no split): splitLine x 459,044 ops/sec ±0.53% (95 runs sampled)
30 * Benchmark (split): splitLine x 42,999 ops/sec ±0.51% (97 runs sampled)
31 * ```
32 *
33 * @param startPosition
34 * @param destPosition
35 */
36 splitLine(startPosition: L.LatLng, destPosition: L.LatLng): L.LatLng[][];
37 /**
38 * Linestrings of a given multilinestring that cross the antimeridian will be split in two separate linestrings.
39 * This function is used to wrap lines around when they cross the antimeridian
40 * It iterates over all linestrings and reconstructs the step-by-step if no split is needed.
41 * In case the line was split, the linestring ends at the antimeridian and a new linestring is created for the
42 * remaining points of the original linestring.
43 *
44 * @param multilinestring
45 * @return another multilinestring where segments crossing the antimeridian are split
46 */
47 splitMultiLineString(multilinestring: L.LatLng[][]): L.LatLng[][];
48 distance(start: L.LatLng, dest: L.LatLng): number;
49 multilineDistance(multilinestring: L.LatLng[][]): number[];
50 updateStatistics(points: L.LatLng[][], vertices: L.LatLng[][]): Statistics;
51}