/*
 * Copyright (c) 2016 Swift Navigation Inc.
 * Contact: engineering@swiftnav.com
 *
 * This source is subject to the license found in the file 'LICENSE' which must
 * be be distributed together with this source. All other rights reserved.
 *
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
 */

// Hopelessly ripped off from:
// https://github.com/TrackMan/LatLon/blob/8318714e8018da522d18078689dba91c433f78fe/dist/geodesy.d.ts

declare module "geodesy" {

  interface ILatLon {
    lat: number;
    lon: number;
  }
  const earthRadius: number;

 /** Latitude/longitude points may be represented as decimal degrees, or
  * subdivided into sexagesimal minutes and seconds.
  */
  export class Dms {
    constructor();

    /**
     * Parses string representing degrees/minutes/seconds into numeric degrees.
     *
     * @param {string|number} dmsStr - Degrees or deg/min/sec in variety of
     *                                 formats.
     * @returns {number} Degrees as decimal number.
     *
     * @example
     *     var lat = Dms.parseDMS('51° 28′ 40.12″ N');
     *     var lon = Dms.parseDMS('000° 00′ 05.31″ W');
     *     var p1 = new LatLon(lat, lon); // 51.4778°N, 000.0015°W
     */
    static parseDMS(dmsStr: string): number;

  }

  export class LatLonEllipsoidal implements ILatLon {
    lat: number;
    lon: number;

    constructor(lat: number, lon: number);
    distanceTo: (point: ILatLon, radius?: number) => number;
    bearingTo: (point: ILatLon) => number;
    finalBearingTo: (point: ILatLon) => number;
    midpointTo: (point: ILatLon) => ILatLon;
    destinationPoint: (distance: number, bearing: number, radius?: number) => ILatLon;
    intersection: (p1: ILatLon, brng1: number | ILatLon, p2: ILatLon, brng2: number | ILatLon) => ILatLon;
    crossTrackDistanceTo: (pathStart: ILatLon, pathEnd: ILatLon, radius?: number) => number;
  }
}
