DefinitelyTyped/types/amap-js-api-arrival-range/index.d.ts
breeze9527 bdd066eeb8 Add type definition of non npm package amap-js-api-arrival-range (#35290)
* [amap-js-api] update to v1.4.14

* Add definition for non npm package: amap-js-api-district-search

* Add type definition for non npm-package amap-js-api-line-search

* Add type definition of non npm package amap-js-api-arrival-range
2019-05-13 10:37:33 -07:00

67 lines
2.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Type definitions for non-npm package amap-js-api-arrival-range 1.4
// Project: https://lbs.amap.com/api/javascript-api/reference/route-search#m_AMap.ArrivalRange
// Definitions by: breeze9527 <https://github.com/breeze9527>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/// <reference types="amap-js-api" />
declare namespace AMap {
namespace ArrivalRange {
interface EventMap {
error: Event<'error', { info: string; }>;
}
interface SearchOptions {
/**
* 公交出行策略,可选为地铁SUBWAY 公交BUS多策略使用逗号分隔
*/
policy?: string; // 'BUS' | 'SUBWAY' | 'BUS,SUBWAY' | 'SUBWAY,BUS';
/**
* 结果返回样式polygon返回多边形边界值coverage判断设定的终点坐标是否在到达圈范围内
*/
resultType?: 'polygon' | 'coverage'; // useless
/**
* 选择一个想到达的目的地坐标最多支持5个目的地坐标
*/
destination?: LocationValue | LocationValue[];
}
interface SearchResult {
/**
* 查询状态说明
*/
info: string;
/**
* 到达圈边界坐标点
*/
bounds: string[][][][];
/**
* 提供的终点坐标是否在到达圈内
*/
inRange?: boolean[];
// internal
infocode: string;
}
type SearchStatus = 'complete' | 'error' | 'no_data';
}
/**
* 公交到达圈展示
*/
class ArrivalRange extends EventEmitter {
/**
* 计算某个时间段内用户通过公交出行可到达的距离范围
* @param origin 起始点
* @param time 时间
* @param callback 回调
* @param opts 选项
*/
search(
origin: LocationValue,
time: number,
callback: (status: ArrivalRange.SearchStatus, result: string | ArrivalRange.SearchResult) => void,
opts?: ArrivalRange.SearchOptions
): void;
}
}