@sports-alliance/sports-lib
Version:
A Library to for importing / exporting and processing GPX, TCX, FIT and JSON files from services such as Strava, Movescount, Garmin, Polar etc
42 lines (41 loc) • 2.65 kB
TypeScript
import { RouteFileInterface } from './route-file.interface';
import { RoutePreviewBoundsInterface, RoutePreviewCoordinateInterface, RoutePreviewRouteFileSourceInterface, RoutePreviewJSONInterface, RoutePreviewOptions } from './route-preview.interface';
export declare const ROUTE_PREVIEW_VERSION: 1;
export declare const ROUTE_PREVIEW_ENCODING: "polyline5";
export declare const ROUTE_PREVIEW_POLYLINE_PRECISION: 5;
export declare const ROUTE_PREVIEW_DEFAULT_MAX_POINTS_PER_SEGMENT = 300;
export declare const ROUTE_PREVIEW_DEFAULT_MAX_POINTS_PER_ROUTE = 1200;
export interface CoordinatePairSimplificationOptions {
keepRatio?: number;
maxPoints?: number;
minInputPoints?: number;
minPointsToKeep?: number;
}
export interface CoordinatePairSimplificationResult {
coordinates: number[][];
inputPointCount: number;
outputPointCount: number;
simplified: boolean;
}
export declare class RoutePreviewUtilities {
static buildRouteFilePreview(routeFile: RouteFileInterface | RoutePreviewRouteFileSourceInterface | null | undefined, options?: RoutePreviewOptions): RoutePreviewJSONInterface | null;
static normalizeCoordinates(coordinates: readonly RoutePreviewCoordinateInterface[] | null | undefined): RoutePreviewCoordinateInterface[];
static simplifyPolyline(coordinates: readonly RoutePreviewCoordinateInterface[] | null | undefined, options?: {
maxPoints?: number;
keepRatio?: number;
minPointsToKeep?: number;
}): RoutePreviewCoordinateInterface[];
private static resolveRouteSources;
private static routeClassToSource;
private static routeJsonToSource;
private static allocateSegmentTargetCounts;
private static resolveSimplificationTarget;
private static runVisvalingamWhyatt;
private static normalizePointLimit;
private static removeUndefined;
}
export declare function simplifyCoordinatePairsVisvalingamWhyatt(coordinates: readonly (readonly number[])[] | null | undefined, options?: CoordinatePairSimplificationOptions): CoordinatePairSimplificationResult;
export declare function encodeRoutePolyline5(points: readonly RoutePreviewCoordinateInterface[] | null | undefined): string;
export declare function decodeRoutePolyline5(encodedPolyline: string | null | undefined): RoutePreviewCoordinateInterface[];
export declare function buildRoutePreviewBounds(points: readonly RoutePreviewCoordinateInterface[] | null | undefined): RoutePreviewBoundsInterface | undefined;
export declare function mergeRoutePreviewBounds(boundsList: readonly (RoutePreviewBoundsInterface | undefined)[] | null | undefined): RoutePreviewBoundsInterface | undefined;