import { BMapInstance, BMapPoint } from '../../types'; /** * 路径规划类型 * @category 类型 */ export type RoutePlanType = 'driving' | 'transit' | 'riding' | 'walking'; /** * 驾车策略常量 * @category 类型 */ export declare enum DrivingPolicy { /** 默认(最短时间或距离) */ DEFAULT = 0, /** 距离最短 */ LEAST_DISTANCE = 2, /** 避开高速 */ AVOID_HIGHWAYS = 3, /** 优先高速 */ FIRST_HIGHWAYS = 4, /** 避开拥堵 */ AVOID_CONGESTION = 5, /** 少收费 */ AVOID_PAY = 6, /** 高速优先+躲避拥堵 */ HIGHWAYS_AVOID_CONGESTION = 7, /** 不走高速+躲避拥堵 */ AVOID_HIGHWAYS_CONGESTION = 8, /** 躲避拥堵+少收费 */ AVOID_CONGESTION_PAY = 9, /** 不走高速+躲避拥堵+少收费 */ AVOID_HIGHWAYS_CONGESTION_PAY = 10, /** 不走高速+少收费 */ AVOID_HIGHWAYS_PAY = 11 } /** * 公交策略常量 * @internal * @category 类型 */ export declare enum TransitPolicy { /** 推荐方案 */ RECOMMEND = 0, /** 最少换乘 */ LEAST_TRANSFER = 1, /** 最少步行 */ LEAST_WALKING = 2, /** 不乘地铁 */ AVOID_SUBWAYS = 3, /** 最少时间 */ LEAST_TIME = 4, /** 地铁优先 */ FIRST_SUBWAYS = 5 } /** * 跨城公交策略 * @internal * @category 类型 */ export declare enum IntercityPolicy { /** 时间短 */ LEAST_TIME = 0, /** 出发早 */ EARLY_START = 1, /** 价格低 */ CHEAP_PRICE = 2 } /** * 跨城交通方式 * @internal * @category 类型 */ export declare enum TransitTypePolicy { /** 火车 */ TRAIN = 0, /** 飞机 */ AIRPLANE = 1, /** 大巴 */ COACH = 2 } /** * 公交线路类型 * @internal * @category 类型 */ export declare enum LineType { /** 公交 */ BUS = 0, /** 地铁 */ SUBWAY = 1, /** 渡轮 */ FERRY = 2, /** 火车 */ TRAIN = 3, /** 飞机 */ AIRPLANE = 4, /** 大巴 */ COACH = 5 } /** * 路段类型 * @category 类型 */ export type SegmentType = 'drive' | 'walk' | 'transit' | 'riding'; /** * 位置信息 * @category 类型 */ export interface NormalizedLocation { /** 经度 */ lng: number; /** 纬度 */ lat: number; } /** * 点信息 * @category 类型 */ export interface NormalizedPoint { /** 地点名称 */ title: string; /** 坐标位置 */ location: NormalizedLocation; /** 所属城市(可选) */ city?: string; /** UID(可选) */ uid?: string; } /** * 基础路段信息 * @category 类型 */ export interface BaseSegment { /** 路段类型 */ type: SegmentType; /** 距离(米) */ distance: number; /** 距离文本 */ distanceText: string; /** 路径坐标点(可选) */ path?: NormalizedLocation[]; } /** * 驾车路段 * @category 类型 */ export interface DriveSegment extends BaseSegment { type: 'drive'; /** 路段描述 */ description: string; /** 起点位置 */ location: NormalizedLocation; /** 道路名称(可选) */ roadName?: string; /** 行驶时长(秒,可选) */ duration?: number; } /** * 步行路段 * @category 类型 */ export interface WalkSegment extends BaseSegment { type: 'walk'; /** 路段描述(可选) */ description?: string; /** 行驶时长(秒,可选) */ duration?: number; } /** * 公交路段 * @category 类型 */ export interface TransitSegment extends BaseSegment { type: 'transit'; /** 交通工具类型 */ subType: 'bus' | 'subway' | 'ferry' | 'train' | 'airplane' | 'coach'; /** 线路名称 */ lineName: string; /** 上车站 */ onStop: string; /** 下车站 */ offStop: string; /** 途经站数 */ stopCount: number; /** 行驶时长(秒,可选) */ duration?: number; } /** * 骑行路段 * @category 类型 */ export interface RidingSegment extends BaseSegment { type: 'riding'; /** 路段描述(可选) */ description?: string; /** 行驶时长(秒,可选) */ duration?: number; } /** * 路段分段类型 * @category 类型 */ export type Segment = DriveSegment | WalkSegment | TransitSegment | RidingSegment; /** * 路径规划方案 * @category 类型 */ export interface NormalizedPlan { /** 总距离(米) */ distance: number; /** 距离文本 */ distanceText: string; /** 总时长(秒) */ duration: number; /** 时长文本 */ durationText: string; /** 路段数组 */ segments: Segment[]; /** 过路费(元) */ toll?: number; /** 收费路段距离(米) */ tollDistance?: number; /** 红绿灯个数(驾车) */ trafficLights?: number; /** 路况/方案特点摘要文案,如「一路畅通|时间少」 */ tag?: string; /** 途经点数组 */ waypoints?: string[]; /** 出行类型(0=同城, 1=跨城) */ transitType?: number; /** 步行距离文本 */ walkDistance?: string; /** 完整路径坐标点 */ path?: NormalizedLocation[]; } /** * 归一化的路径规划结果 * @category 类型 */ export interface NormalizedRouteResult { /** 路径规划类型 */ routeType: RoutePlanType; /** 起点信息 */ start: NormalizedPoint; /** 终点信息 */ end: NormalizedPoint; /** 方案数组 */ plans: NormalizedPlan[]; } /** * 路径规划搜索参数 * @category 类型 */ export interface RoutePlanSearchOptions { /** 起点(支持坐标点、地点名称、POI UID) */ start: BMapPoint | string; /** 终点(支持坐标点、地点名称、POI UID) */ end: BMapPoint | string; /** 起点名称(可选,用于外部导航展示) */ startName?: string; /** 终点名称(可选,用于外部导航展示) */ endName?: string; /** 起点 UID(可选,优先级高于 start) */ startUid?: string; /** 终点 UID(可选,优先级高于 end) */ endUid?: string; /** 途经点数组(仅驾车支持,最多10个) */ waypoints?: BMapPoint[]; } /** * 驾车路径规划选项 * @category 类型 */ export interface DrivingOptions { /** 驾车策略,默认 DEFAULT */ policy?: DrivingPolicy; /** 备选方案数量,默认 1 */ alternatives?: number; } /** * 公交路径规划选项 * @internal * @category 类型 */ export interface TransitOptions { /** 市内公交策略,默认 RECOMMEND */ policy?: TransitPolicy; /** 跨城公交策略,默认 LEAST_TIME */ intercityPolicy?: IntercityPolicy; /** 跨城交通方式,默认 TRAIN */ transitTypePolicy?: TransitTypePolicy; /** 最多返回方案数,默认 5 */ pageCapacity?: number; } /** * 路径规划组件配置项 * @category 类型 */ export interface RoutePlanOptions { /** 地图实例,必传 */ map: BMapInstance; /** 驾车配置 */ drivingOptions?: DrivingOptions; } /** * 路径规划事件数据 * @category 类型 */ export interface RoutePlanEventData { /** 路径规划类型 */ type: RoutePlanType; /** 起点信息 */ start: NormalizedPoint; /** 终点信息 */ end: NormalizedPoint; /** 方案数组 */ plans: NormalizedPlan[]; }