@yandex/ymaps3-types
Version:
Types for ymaps3 maps library
77 lines (76 loc) • 2.34 kB
TypeScript
import type { GenericFeature, LineStringGeometry, LngLat, LngLatBounds } from "../../common/types";
export interface RawStep {
length: number;
duration: number;
mode: string;
feature_class?: string;
polyline: {
points: LngLat[];
};
}
export interface RawLeg {
status: string;
steps: RawStep[];
}
export interface RawRoute {
traffic: string;
route: {
legs: RawLeg[];
flags?: {
hasTolls?: boolean;
hasNonTransactionalTolls?: boolean;
};
};
}
export interface RouteFeature extends GenericFeature<LngLat> {
geometry: LineStringGeometry;
properties: {
length?: number;
duration?: number;
mode?: string;
bounds?: LngLatBounds;
featureClass?: string;
flags?: {
hasTolls?: boolean;
hasNonTransactionalTolls?: boolean;
};
};
}
export interface BaseRouteResponse {
/** Return requested route as {@link RouteFeature RouteFeature}. */
toRoute(): RouteFeature;
/** Returns requested route, divided into steps, as {@link RouteFeature RouteFeature}[]. */
toSteps(): RouteFeature[];
}
export interface TruckParameters {
/** Vehicle weight in tons */
weight?: number;
/** Actual vehicle axle load in tons */
axleWeight?: number;
/** Maximum allowed vehicle weight in tons */
maxWeight?: number;
/** Maximum vehicle load capacity in tons */
payload?: number;
/** Vehicle height in meters */
height?: number;
/** Vehicle width in meters */
width?: number;
/** Vehicle length in meters */
length?: number;
/** Vehicle emission standard (number from 1 to 6, for example, 1 corresponds to Euro-1 class) */
ecoClass?: number;
/** Has a truck trailer */
hasTrailer?: boolean;
}
export interface RouteOptions {
/** Route points represented by {@link LngLat LngLat} coordinates. */
points: LngLat[];
/** Route type. */
type: 'driving' | 'truck' | 'walking' | 'transit';
/** If specified, bounding box of the route will be returned in properties. Default is `false`. */
bounds?: boolean;
/** Avoid roads with tolls. Default is `false`. */
avoidTolls?: boolean;
/** Parameters for a truck (only for `type=truck`). */
truck?: TruckParameters;
}