UNPKG

1.93 kBTypeScriptView Raw
1import L from "leaflet";
2import { GeodesicOptions } from "./geodesic-core";
3import { GeodesicGeometry, Statistics } from "./geodesic-geom";
4/**
5 * Draw geodesic lines based on L.Polyline
6 */
7export declare class GeodesicLine extends L.Polyline {
8 /** these should be good for most use-cases */
9 defaultOptions: GeodesicOptions;
10 /** does the actual geometry calculations */
11 readonly geom: GeodesicGeometry;
12 /** use this if you need some detailled info about the current geometry */
13 statistics: Statistics;
14 /** stores all positions that are used to create the geodesic line */
15 points: L.LatLng[][];
16 constructor(latlngs?: L.LatLngExpression[] | L.LatLngExpression[][], options?: GeodesicOptions);
17 /** calculates the geodesics and update the polyline-object accordingly */
18 private updateGeometry;
19 /**
20 * overwrites the original function with additional functionality to create a geodesic line
21 * @param latlngs an array (or 2d-array) of positions
22 */
23 setLatLngs(latlngs: L.LatLngExpression[] | L.LatLngExpression[][]): this;
24 /**
25 * add a given point to the geodesic line object
26 * @param latlng point to add. The point will always be added to the last linestring of a multiline
27 * @param latlngs define a linestring to add the new point to. Read from points-property before (e.g. `line.addLatLng(Beijing, line.points[0]);`)
28 */
29 addLatLng(latlng: L.LatLngExpression, latlngs?: L.LatLng[]): this;
30 /**
31 * Creates geodesic lines from a given GeoJSON-Object.
32 * @param input GeoJSON-Object
33 */
34 fromGeoJson(input: GeoJSON.GeoJSON): this;
35 /**
36 * Calculates the distance between two geo-positions
37 * @param start 1st position
38 * @param dest 2nd position
39 * @return the distance in meters
40 */
41 distance(start: L.LatLngExpression, dest: L.LatLngExpression): number;
42}