@wufengteam/wform
Version:
@wufengteam/wform
299 lines (298 loc) • 9.05 kB
TypeScript
import type { BPoi } from './BMap';
export declare function loadAMap(renderType?: string, customEngineApi?: any): Promise<any>;
export interface PlaceSearchOptions {
/**
* 兴趣点城市
* 可选值:城市名(中文或中文全拼)、citycode、adcode
* 默认值:“全国”
*/
city?: string;
/**
* 兴趣点类别,多个类别用“|”分割,如“餐饮|酒店|电影院”
* POI搜索类型共分为以下20种:
* 汽车服务|汽车销售|汽车维修|摩托车服务|餐饮服务|购物服务|生活服务|体育休闲服务|
* 医疗保健服务|住宿服务|风景名胜|商务住宅|政府机构及社会团体|科教文化服务|
* 交通设施服务|金融保险服务|公司企业|道路附属设施|地名地址信息|公共设施
* 默认值:餐饮服务、商务住宅、生活服务
*/
type?: string;
/**
* 此项默认值:base,返回基本地址信息
* 取值:all,返回基本+详细信息
*/
extensions?: string;
}
export interface LngLat {
lng: number;
lat: number;
}
export interface Poi extends BPoi {
id: string;
name: string;
type?: string;
location: LngLat;
address: string;
distance?: number;
pname?: string;
cityname?: string;
adname?: string;
}
export interface PoiList {
pois: Poi[];
}
export interface SearchResult {
info: string;
poiList: PoiList;
}
export interface PlaceSearch {
search: (keyword: string, callback: (status: 'complete' | 'error' | 'no_data', result: string | SearchResult) => void) => void;
searchNearBy: (keyword: string, center?: [number, number], radius?: number, callback?: (status: 'complete' | 'error' | 'no_data', result: string | SearchResult) => void) => void;
setCity: (city: string) => void;
setType: (type?: string) => void;
}
export declare function loadPlaceSearch(options?: PlaceSearchOptions): Promise<PlaceSearch>;
export declare function loadMarker(): Promise<any>;
export declare function searchPlace(keyword: string, city?: string): Promise<Poi[]>;
export declare function searchPlaceNearBy(keyword: string, center: [number, number], city?: string, radius?: number): Promise<Poi[]>;
export interface City {
city: string;
citycode: string;
district: string;
province: string;
}
/**
* 获取地图当前城市
* @param map 地图实例
* @returns
*/
export declare function getCity(map: any): Promise<City>;
/**
* 往地图添加标记
* @param map 地图实例
* @param poi 兴趣点
*/
export declare function addMarker(map: any, poi: Poi): Promise<any>;
/**
* 清除标记
* @param marker 标记实例
*/
export declare function clearMarker(marker: any): Promise<void>;
/**
* 获取当前Bounds的中心点经纬度坐标。
* @param map 地图实例
* @returns
*/
export declare function getCenter(map: any): Promise<any>;
/**
* 设置地图中心点
* @param map 地图实例
* @param center 中心点位置
*/
export declare function setCenter(map: any, center: [number, number]): Promise<void>;
export interface GeolocationOptions {
/**
* 是否使用高精度
* 默认值:true
*/
enableHighAccuracy?: boolean;
/**
* 超时毫秒数,若在指定时间内未定位成功,返回超时错误信息“TIMEOUT”
* 默认值:无穷大
*/
timeout?: number;
/**
* 是否禁止使用IP定位,默认值为0,可选值0-3
* 0: 可以使用IP定位
* 1: 手机设备禁止使用IP定位
* 2: PC上禁止使用IP定位
* 3: 所有终端禁止使用IP定位
*/
noIpLocate?: number;
/**
* 是否禁止使用浏览器Geolocation定位,默认值为0,可选值0-3
* 0: 可以使用浏览器定位
* 1: 手机设备禁止使用浏览器定位
* 2: PC上禁止使用浏览器定位
* 3: 所有终端禁止使用浏览器定位
*/
noGeoLocation?: number;
/**
* 默认为false,设置为true的时候可以调整PC端为优先使用浏览器定位,失败后使用IP定位
*/
GeoLocationFirst?: boolean;
/**
* 缓存毫秒数。定位成功后,定位结果的保留时间
* 默认值:0
*/
maximumAge?: number;
/**
* 是否使用坐标偏移,取值true:为高德地图坐标,取值false:为浏览器定位坐标
* 默认值:true
*/
convert?: boolean;
/**
* 是否显示定位按钮
* 默认值:true
*/
showButton?: boolean;
/**
* 定位按钮可停靠的位置
* “LT”:左上角
* “LB”:左下角
* “RT”:右上角
* “RB”:右下角
* 默认值:“LB”
*/
buttonPosition?: 'RB' | 'LB' | 'LT' | 'RT';
/**
* 按钮距离停靠位置的偏移量
* 默认值:Pixel(10,20)
*/
buttonOffset?: any;
/**
* 定位成功时是否在定位位置显示一个Marker
* 默认值:true
*/
showMarker?: boolean;
/**
* 定位成功并且有精度信息时,是否用一个圆圈circle表示精度范围
* 默认值:true
*/
showCircle?: boolean;
/**
* 定位成功后,是否把定位得到的坐标设置为地图中心点坐标
* 默认值:true
*/
panToLocation?: boolean;
/**
* 定位成功且显示精度范围时,是否把地图视野调整到正好显示精度范围
* 默认值:false
*/
zoomToAccuracy?: boolean;
/**
* SAPI在定位成功的时候会将得到的经纬度进行逆地理编码后获取地址信息,以方便开发者的进一步使用;
* extensions用来设定是否需要周边POI、道路交叉口等信息,可选值'base'、'all'。
* 默认为'base',只返回地址信息;
* 设定为'all'的时候将返回周边POI、道路交叉口等信息。
*/
extensions?: string;
}
export declare function loadGeolocation(options?: GeolocationOptions): Promise<any>;
/**
* 在 map 上添加 control 控件
* @param map 地图实例
* @param control control 实例
*/
export declare function addControl(map: any, control: any): Promise<void>;
export interface GeolocationResult {
/**
* 定位结果
*/
position: LngLat;
/**
* 精度范围,单位:米
*/
accuracy: number;
/**
* 定位结果的来源,可能的值有:'html5'、'ip'、'sdk'
*/
location_type: string;
/**
* 形成当前定位结果的一些信息
*/
message: string;
/**
* 是否经过坐标纠偏
*/
isConverted: boolean;
/**
* 状态信息 "SUCCESS"
*/
info: string;
/**
* 地址
*/
formattedAddress: string;
/**
* 定位点附近的POI信息,extensions等于'base'的时候为空
*/
pois: Poi[];
}
/**
* 获取当前位置
* @param geolocation 定位实例
* @returns
*/
export declare function getCurrentPosition(geolocation: any): Promise<GeolocationResult>;
export interface GeocoderOptions {
/**
* 城市,地理编码时,设置地址描述所在城市
* 可选值:城市名(中文或中文全拼)、citycode、adcode
* 默认值:“全国”
*/
city?: string;
/**
* 逆地理编码时,以给定坐标为中心点,单位:米
* 取值范围:0 - 3000
* 默认值:1000
*/
radius?: number;
/**
* 逆地理编码时,返回信息的详略
* 默认值:base,返回基本地址信息
* 取值为:all,返回地址信息及附近poi、道路、道路交叉口等信息
*/
extensions?: string;
}
export declare function loadGeocoder(options: GeocoderOptions): Promise<any>;
export interface GeocoderGetAddressResult {
/**
* 地址名字
*/
formattedAddress: string;
/**
* 地址元素
*/
addressComponent?: {
/**
* 坐标点所在省名称 例如:北京市
*/
province: string;
/**
* 坐标点所在城市名称
* 请注意:当城市是省直辖县时返回为空,以及城市为北京、上海、天津、重庆四个直辖市时,该字段返回为空;省直辖县列表
*/
city: string;
/**
* 城市编码
*/
citycode: string;
/**
* 坐标点所在区
* 例如:海淀区
*/
district: string;
/**
* 行政区编码
* 例如:110108
*/
adcode: string;
/**
* 坐标点所在乡镇/街道(此街道为社区街道,不是道路信息)
*/
township: string;
/**
* 街道名称
*/
street: string;
/**
* 门牌号
*/
streetNumber: string;
};
/**
* poi信息列表
*/
pois?: Poi[];
}
export declare function getAddress(geocoder: any, position: [number, number]): Promise<GeocoderGetAddressResult>;