mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Merge pull request #33339 from breeze9527/master
Adding types for amap-js-api
This commit is contained in:
File diff suppressed because it is too large
Load Diff
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
declare namespace AMap {
|
||||
class ArrayBounds {
|
||||
constructor(bounds: LocationValue[]);
|
||||
bounds: LngLat[];
|
||||
contains(point: LocationValue): boolean;
|
||||
// internal
|
||||
toBounds(): Bounds;
|
||||
getCenter(): LngLat;
|
||||
}
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
declare namespace AMap {
|
||||
class Bounds {
|
||||
constructor(southWest: LngLat, northEast: LngLat);
|
||||
contains(point: LocationValue): boolean;
|
||||
getCenter(): LngLat;
|
||||
getSouthWest(): LngLat;
|
||||
getSouthEast(): LngLat;
|
||||
getNorthEast(): LngLat;
|
||||
getNorthWest(): LngLat;
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
declare namespace AMap {
|
||||
namespace Browser {
|
||||
const ua: string;
|
||||
const mobile: boolean;
|
||||
const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other';
|
||||
const mac: boolean;
|
||||
const windows: boolean;
|
||||
const ios: boolean;
|
||||
const iPad: boolean;
|
||||
const iPhone: boolean;
|
||||
const android: boolean;
|
||||
const android23: boolean;
|
||||
const chrome: boolean;
|
||||
const firefox: boolean;
|
||||
const safari: boolean;
|
||||
const wechat: boolean;
|
||||
const uc: boolean;
|
||||
const qq: boolean;
|
||||
const ie: boolean;
|
||||
const ie6: boolean;
|
||||
const ie7: boolean;
|
||||
const ie8: boolean;
|
||||
const ie9: boolean;
|
||||
const ie10: boolean;
|
||||
const ie11: boolean;
|
||||
const edge: boolean;
|
||||
const ielt9: boolean;
|
||||
const baidu: boolean;
|
||||
const isLocalStorage: boolean;
|
||||
const isGeolocation: boolean;
|
||||
const mobileWebkit: boolean;
|
||||
const mobileWebkit3d: boolean;
|
||||
const mobileOpera: boolean;
|
||||
const retina: boolean;
|
||||
const touch: boolean;
|
||||
const msPointer: boolean;
|
||||
const pointer: boolean;
|
||||
const webkit: boolean;
|
||||
const ie3d: boolean;
|
||||
const webkit3d: boolean;
|
||||
const gecko3d: boolean;
|
||||
const opera3d: boolean;
|
||||
const any3d: boolean;
|
||||
const isCanvas: boolean;
|
||||
const isSvg: boolean;
|
||||
const isVML: boolean;
|
||||
const isWorker: boolean;
|
||||
const isWebsocket: boolean;
|
||||
function isWebGL(): boolean;
|
||||
}
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
declare namespace AMap {
|
||||
type SizeValue = Size | [number, number];
|
||||
type LocationValue = LngLat | [number, number];
|
||||
type Lang = 'zh_cn' | 'en' | 'zh_en';
|
||||
|
||||
type Event<N extends string = string, V = undefined> = { type: N } &
|
||||
(V extends HTMLElement ? { value: V }
|
||||
: V extends object ? V
|
||||
: V extends undefined ? {}
|
||||
: { value: V });
|
||||
type MapsEvent<N extends string, I> = Event<N, {
|
||||
lnglat: LngLat;
|
||||
pixel: Pixel;
|
||||
target: I
|
||||
}>;
|
||||
|
||||
type StrokeLineJoin = 'miter' | 'round' | 'bevel';
|
||||
type StrokeLineCap = 'butt' | 'round' | 'square';
|
||||
type StrokeStyle = 'dashed' | 'solid';
|
||||
|
||||
type AnimationName = 'AMAP_ANIMATION_NONE' | 'AMAP_ANIMATION_DROP' | 'AMAP_ANIMATION_BOUNCE';
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
declare namespace AMap {
|
||||
namespace convertFrom {
|
||||
interface Result {
|
||||
info: string; // 'ok'
|
||||
locations: LngLat[];
|
||||
}
|
||||
type Type = 'gps' | 'baidu' | 'mapbar';
|
||||
type SearchStatus = 'complete' | 'error';
|
||||
}
|
||||
function convertFrom(
|
||||
lnglat: LocationValue | LocationValue[],
|
||||
type: convertFrom.Type | null,
|
||||
callback: (status: convertFrom.SearchStatus, result: string | convertFrom.Result) => void
|
||||
): void;
|
||||
}
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
declare namespace AMap {
|
||||
namespace DomUtil {
|
||||
function getViewport(dom: HTMLElement): Size;
|
||||
|
||||
function getViewportOffset(dom: HTMLElement): Pixel;
|
||||
|
||||
function create<K extends keyof HTMLElementTagNameMap>(
|
||||
tagName: K,
|
||||
parent?: HTMLElement,
|
||||
className?: string
|
||||
): HTMLElementTagNameMap[K];
|
||||
|
||||
function setClass(dom: HTMLElement, className?: string): void;
|
||||
|
||||
function hasClass(dom: HTMLElement, className: string): boolean;
|
||||
|
||||
function addClass(dom: HTMLElement, className: string): void;
|
||||
|
||||
function removeClass(dom: HTMLElement, className: string): void;
|
||||
|
||||
function setOpacity(dom: HTMLElement, opacity: number): void;
|
||||
|
||||
function rotate(dom: HTMLElement, deg: number, origin?: { x: number, y: number }): void;
|
||||
|
||||
function setCss(dom: HTMLElement | HTMLElement[], style: Partial<CSSStyleDeclaration>): typeof DomUtil; // this
|
||||
|
||||
function empty(dom: HTMLElement): void;
|
||||
|
||||
function remove(dom: HTMLElement): void;
|
||||
}
|
||||
}
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
declare namespace AMap {
|
||||
abstract class EventEmitter {
|
||||
on<E extends Event, C = this>(
|
||||
eventName: string,
|
||||
// tslint:disable-next-line:no-unnecessary-generics
|
||||
handler: (this: C, event: E) => void,
|
||||
context?: C,
|
||||
once?: boolean,
|
||||
unshift?: boolean
|
||||
): this;
|
||||
|
||||
off<E extends Event, C = this>(
|
||||
eventName: string,
|
||||
// tslint:disable-next-line
|
||||
handler: ((this: C, event: E) => void) | 'mv',
|
||||
context?: C
|
||||
): this;
|
||||
|
||||
emit(eventName: string, data?: any): this;
|
||||
}
|
||||
|
||||
namespace event {
|
||||
interface EventListener<T extends 0 | 1> {
|
||||
type: T;
|
||||
}
|
||||
|
||||
function addDomListener<N extends keyof HTMLElementTagNameMap, E extends keyof HTMLElementEventMap, C = HTMLElementTagNameMap[N]>(
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
instance: HTMLElementTagNameMap[N],
|
||||
eventName: E,
|
||||
handler: (this: C, event: HTMLElementEventMap[E]) => void,
|
||||
context?: C
|
||||
): EventListener<0>;
|
||||
|
||||
function addListener<I extends EventEmitter, E extends Event, C = I>(
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
instance: I,
|
||||
eventName: string,
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
handler: (this: C, event: E) => void,
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
context?: C
|
||||
): EventListener<1>;
|
||||
|
||||
function addListenerOnce<I extends EventEmitter, E extends Event, C = I>(
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
instance: I,
|
||||
eventName: string,
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
handler: (this: C, event: E) => void,
|
||||
// tslint:disable-next-line: no-unnecessary-generics
|
||||
context?: C
|
||||
): EventListener<1>;
|
||||
|
||||
function removeListener(listener: EventListener<0 | 1>): void;
|
||||
|
||||
function trigger(instance: EventEmitter, eventName: string, data?: any): void;
|
||||
}
|
||||
}
|
||||
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
declare namespace AMap {
|
||||
namespace GeometryUtil {
|
||||
function distance(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue | LocationValue[]
|
||||
): number;
|
||||
|
||||
function ringArea(ring: LocationValue[]): number;
|
||||
|
||||
function isClockwise(path: LocationValue[]): boolean;
|
||||
|
||||
function distanceOfLine(line: LocationValue[]): number;
|
||||
|
||||
function ringRingClip(
|
||||
ring1: LocationValue[],
|
||||
ring2: LocationValue[]
|
||||
): Array<[number, number]>;
|
||||
|
||||
function doesRingRingIntersect(
|
||||
ring1: LocationValue[],
|
||||
ring2: LocationValue[]
|
||||
): boolean;
|
||||
|
||||
function doesLineRingIntersect(
|
||||
line: LocationValue[],
|
||||
ring: LocationValue[]
|
||||
): boolean;
|
||||
|
||||
function doesLineLineIntersect(
|
||||
line1: LocationValue[],
|
||||
line2: LocationValue[]
|
||||
): boolean;
|
||||
|
||||
function doesSegmentPolygonIntersect(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
polygon: LocationValue[][]
|
||||
): boolean;
|
||||
|
||||
function doesSegmentRingIntersect(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
ring: LocationValue[]
|
||||
): boolean;
|
||||
|
||||
function doesSegmentLineIntersect(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
line: LocationValue[]
|
||||
): boolean;
|
||||
|
||||
function doesSegmentsIntersect(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
point3: LocationValue,
|
||||
point4: LocationValue
|
||||
): boolean;
|
||||
|
||||
function isPointInRing(point: LocationValue, ring: LocationValue[]): boolean;
|
||||
|
||||
function isRingInRing(ring1: LocationValue[], ring2: LocationValue[]): boolean;
|
||||
|
||||
function isPointInPolygon(point: LocationValue, polygon: LocationValue[][]): boolean;
|
||||
|
||||
function makesureClockwise(path: Array<[number, number]>): Array<[number, number]>;
|
||||
|
||||
function makesureAntiClockwise(path: Array<[number, number]>): Array<[number, number]>;
|
||||
|
||||
function closestOnSegment(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
point3: LocationValue
|
||||
): [number, number];
|
||||
|
||||
function closestOnLine(point: LocationValue, line: LocationValue[]): [number, number];
|
||||
|
||||
function distanceToSegment(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
point3: LocationValue
|
||||
): number;
|
||||
|
||||
function distanceToLine(point: LocationValue, line: LocationValue[]): number;
|
||||
|
||||
function isPointOnSegment(
|
||||
point1: LocationValue,
|
||||
point2: LocationValue,
|
||||
point3: LocationValue,
|
||||
tolerance?: number
|
||||
): boolean;
|
||||
|
||||
function isPointOnLine(
|
||||
point: LocationValue,
|
||||
line: LocationValue[],
|
||||
tolerance?: number
|
||||
): boolean;
|
||||
|
||||
function isPointOnRing(
|
||||
point: LocationValue,
|
||||
ring: LocationValue[],
|
||||
tolerance?: number
|
||||
): boolean;
|
||||
|
||||
function isPointOnPolygon(
|
||||
point: LocationValue,
|
||||
polygon: LocationValue[][],
|
||||
tolerance?: number
|
||||
): boolean;
|
||||
|
||||
function doesPolygonPolygonIntersect(
|
||||
polygon1: LocationValue[],
|
||||
polygon2: LocationValue[]
|
||||
): boolean;
|
||||
|
||||
function distanceToPolygon(point: LocationValue, polygon: LocationValue[]): number;
|
||||
|
||||
function triangulateShape(
|
||||
shape1: LngLat[] | Pixel[] | [number, number],
|
||||
shape2: LngLat[] | Pixel[] | [number, number]
|
||||
): number[];
|
||||
}
|
||||
}
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
// Type definitions for non-npm package amap-js-api 1.4
|
||||
// Project: https://lbs.amap.com/api/javascript-api/summary
|
||||
// Definitions by: breeze9527 <https://github.com/breeze9527>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference path="array-bounds.d.ts" />
|
||||
/// <reference path="bounds.d.ts" />
|
||||
/// <reference path="browser.d.ts" />
|
||||
/// <reference path="common.d.ts" />
|
||||
/// <reference path="convert-from.d.ts" />
|
||||
/// <reference path="dom-util.d.ts" />
|
||||
/// <reference path="event.d.ts" />
|
||||
/// <reference path="geometry-util.d.ts" />
|
||||
/// <reference path="lngLat.d.ts" />
|
||||
/// <reference path="map.d.ts" />
|
||||
/// <reference path="pixel.d.ts" />
|
||||
/// <reference path="size.d.ts" />
|
||||
/// <reference path="type-util.d.ts" />
|
||||
/// <reference path="util.d.ts" />
|
||||
/// <reference path="view2D.d.ts" />
|
||||
/// <reference path="layer/building.d.ts" />
|
||||
/// <reference path="layer/flexible.d.ts" />
|
||||
/// <reference path="layer/layer.d.ts" />
|
||||
/// <reference path="layer/layerGroup.d.ts" />
|
||||
/// <reference path="layer/massMarks.d.ts" />
|
||||
/// <reference path="layer/mediaLayer.d.ts" />
|
||||
/// <reference path="layer/tileLayer.d.ts" />
|
||||
/// <reference path="layer/wms.d.ts" />
|
||||
/// <reference path="layer/wmts.d.ts" />
|
||||
/// <reference path="overlay/bezierCurve.d.ts" />
|
||||
/// <reference path="overlay/circle.d.ts" />
|
||||
/// <reference path="overlay/circleMarker.d.ts" />
|
||||
/// <reference path="overlay/contextMenu.d.ts" />
|
||||
/// <reference path="overlay/ellipse.d.ts" />
|
||||
/// <reference path="overlay/geoJSON.d.ts" />
|
||||
/// <reference path="overlay/icon.d.ts" />
|
||||
/// <reference path="overlay/infoWindow.d.ts" />
|
||||
/// <reference path="overlay/marker.d.ts" />
|
||||
/// <reference path="overlay/markerShape.d.ts" />
|
||||
/// <reference path="overlay/overlay.d.ts" />
|
||||
/// <reference path="overlay/overlayGroup.d.ts" />
|
||||
/// <reference path="overlay/pathOverlay.d.ts" />
|
||||
/// <reference path="overlay/polygon.d.ts" />
|
||||
/// <reference path="overlay/polyline.d.ts" />
|
||||
/// <reference path="overlay/rectangle.d.ts" />
|
||||
/// <reference path="overlay/shapeOverlay.d.ts" />
|
||||
/// <reference path="overlay/text.d.ts" />
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
declare namespace AMap {
|
||||
namespace Buildings {
|
||||
interface Options extends Layer.Options {
|
||||
zooms?: [number, number];
|
||||
opacity?: number;
|
||||
heightFactor?: number;
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
// inner
|
||||
merge?: boolean;
|
||||
sort?: boolean;
|
||||
}
|
||||
interface AreaStyle {
|
||||
color1: string;
|
||||
path: LocationValue[];
|
||||
color2?: string;
|
||||
visible?: boolean;
|
||||
rejectTexture?: boolean;
|
||||
}
|
||||
interface Style {
|
||||
hideWithoutStyle?: boolean;
|
||||
areas: AreaStyle[];
|
||||
}
|
||||
}
|
||||
|
||||
class Buildings extends Layer {
|
||||
constructor(opts?: Buildings.Options);
|
||||
setStyle(style: Buildings.Style): void;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
declare namespace AMap {
|
||||
namespace TileLayer {
|
||||
namespace Flexible {
|
||||
interface Options extends TileLayer.Options {
|
||||
createTile?(
|
||||
x: number,
|
||||
y: number,
|
||||
z: number,
|
||||
success: (tile: HTMLImageElement | HTMLCanvasElement) => void,
|
||||
fail: () => void
|
||||
): void;
|
||||
cacheSize?: number;
|
||||
visible?: boolean;
|
||||
}
|
||||
}
|
||||
class Flexible extends TileLayer {
|
||||
constructor(options?: Flexible.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
declare namespace AMap {
|
||||
namespace Layer {
|
||||
interface Options {
|
||||
map?: Map;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Layer extends EventEmitter {
|
||||
getContainer(): HTMLDivElement | undefined;
|
||||
getZooms(): [number, number];
|
||||
setOpacity(alpha: number): void;
|
||||
getOpacity(): number;
|
||||
show(): void;
|
||||
hide(): void;
|
||||
setMap(map?: Map | null): void;
|
||||
getMap(): Map | null | undefined;
|
||||
setzIndex(index: number): void;
|
||||
getzIndex(): number;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
declare namespace AMap {
|
||||
class LayerGroup<L = any> extends Layer {
|
||||
constructor(layers: L | L[]);
|
||||
addLayer(layer: L | L[]): this;
|
||||
addLayers(layers: L | L[]): this;
|
||||
getLayers(): L[];
|
||||
getLayer(finder: (this: null, item: L, index: number, list: L[]) => boolean): L | null;
|
||||
hasLayer(layer: L | ((this: null, item: L, index: number, list: L[]) => boolean)): boolean;
|
||||
removeLayer(layer: L | L[]): this;
|
||||
removeLayers(layer: L | L[]): this;
|
||||
clearLayers(): this;
|
||||
eachLayer<C = L>(iterator: (this: C, layer: L, index: number, list: L[]) => void, context?: C): void;
|
||||
|
||||
// overwrite
|
||||
setMap(map?: Map): this;
|
||||
hide(): this;
|
||||
show(): this;
|
||||
reload(): this;
|
||||
setOptions(options: any): this;
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
declare namespace AMap {
|
||||
namespace MassMarks {
|
||||
interface EventMap<I = MassMarks> {
|
||||
click: UIEvent<'click', I>;
|
||||
dblclick: UIEvent<'dblclick', I>;
|
||||
mousedown: UIEvent<'mousedown', I>;
|
||||
mouseup: UIEvent<'mouseup', I>;
|
||||
mouseover: UIEvent<'mouseover', I>;
|
||||
mouseout: UIEvent<'mouseout', I>;
|
||||
touchstart: UIEvent<'touchstart', I>;
|
||||
touchend: UIEvent<'touchend', I>;
|
||||
}
|
||||
|
||||
interface Style {
|
||||
anchor: Pixel;
|
||||
url: string;
|
||||
size: Size;
|
||||
rotation?: number;
|
||||
}
|
||||
|
||||
type UIEvent<N extends string, I> = Event<N, {
|
||||
target: I;
|
||||
data: I extends MassMarks<infer D> ? D : Data;
|
||||
}>;
|
||||
|
||||
interface Options extends Layer.Options {
|
||||
zIndex?: number;
|
||||
cursor?: string;
|
||||
alwayRender?: boolean;
|
||||
style: Style | Style[];
|
||||
// rejectMapMask
|
||||
}
|
||||
interface Data {
|
||||
lnglat: LocationValue;
|
||||
style?: number;
|
||||
}
|
||||
}
|
||||
|
||||
class MassMarks<D extends MassMarks.Data = MassMarks.Data> extends Layer {
|
||||
constructor(data: D[] | string, opts: MassMarks.Options);
|
||||
setStyle(style: MassMarks.Style | MassMarks.Style[]): void;
|
||||
getStyle(): MassMarks.Style | MassMarks.Style[];
|
||||
setData(data: D[] | string): void;
|
||||
getData(): Array<Pick<D, Exclude<keyof D, 'lnglat'>> & { lnglat: LngLat }>;
|
||||
clear(): void;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
declare namespace AMap {
|
||||
namespace MediaLayer {
|
||||
interface Options extends Layer.Options {
|
||||
bounds?: Bounds;
|
||||
visible?: boolean;
|
||||
zooms?: [number, number];
|
||||
opacity?: number;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MediaLayer<E extends HTMLElement> extends Layer {
|
||||
constructor(options?: MediaLayer.Options);
|
||||
setBounds(bounds: Bounds): void;
|
||||
getBounds(): Bounds;
|
||||
setOptions(options: Partial<MediaLayer.Options>): void;
|
||||
getOptions(): Partial<MediaLayer.Options>;
|
||||
getElement(): E | null;
|
||||
}
|
||||
|
||||
class ImageLayer extends MediaLayer<HTMLImageElement> {
|
||||
setImageUrl(url: string): void;
|
||||
getImageUrl(): string | undefined;
|
||||
}
|
||||
|
||||
class VideoLayer extends MediaLayer<HTMLVideoElement> {
|
||||
setVideoUrl(source: string | string[]): void;
|
||||
getVideoUrl(): string | string[] | undefined;
|
||||
}
|
||||
|
||||
class CanvasLayer extends MediaLayer<HTMLCanvasElement> {
|
||||
setCanvas(canvas: HTMLCanvasElement): void;
|
||||
getCanvas(): HTMLCanvasElement | undefined;
|
||||
reFresh(): void;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
declare namespace AMap {
|
||||
namespace TileLayer {
|
||||
interface EventMap {
|
||||
complete: Event<'complete'>;
|
||||
}
|
||||
|
||||
interface Options extends Layer.Options {
|
||||
tileSize?: number;
|
||||
tileUrl?: string;
|
||||
errorUrl?: string;
|
||||
getTileUrl?: string | ((x: number, y: number, level: number) => string);
|
||||
zIndex?: number;
|
||||
opacity?: number;
|
||||
zooms?: [number, number];
|
||||
detectRetina?: boolean;
|
||||
}
|
||||
class Satellite extends TileLayer { }
|
||||
class RoadNet extends TileLayer { }
|
||||
|
||||
namespace Traffic {
|
||||
interface Options extends TileLayer.Options {
|
||||
autoRefresh?: boolean;
|
||||
interval?: number;
|
||||
}
|
||||
}
|
||||
class Traffic extends TileLayer {
|
||||
constructor(options?: Traffic.Options);
|
||||
}
|
||||
}
|
||||
|
||||
class TileLayer extends Layer {
|
||||
constructor(options?: TileLayer.Options);
|
||||
getTiles(): string[];
|
||||
reload(): void;
|
||||
setTileUrl(url: string | ((x: number, y: number, level: number) => string)): void;
|
||||
}
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
declare namespace AMap {
|
||||
namespace TileLayer {
|
||||
namespace WMS {
|
||||
interface Params {
|
||||
VERSION?: string;
|
||||
LAYERS?: string;
|
||||
STYLES?: string;
|
||||
FORMAT?: string;
|
||||
TRANSPARENT?: 'TRUE' | 'FALSE';
|
||||
BGCOLOR?: string;
|
||||
EXCEPTIONS?: string;
|
||||
TIME?: string;
|
||||
ELEVATION?: string;
|
||||
}
|
||||
interface Options extends Flexible.Options {
|
||||
url: string;
|
||||
params: Params;
|
||||
blend?: boolean;
|
||||
}
|
||||
}
|
||||
class WMS extends Flexible {
|
||||
constructor(options: WMS.Options);
|
||||
setUrl(url: string): void;
|
||||
getUrl(): string;
|
||||
setParams(params: WMS.Params): void;
|
||||
getParams(): WMS.Params;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
declare namespace AMap {
|
||||
namespace TileLayer {
|
||||
namespace WMTS {
|
||||
interface Params {
|
||||
Version?: string;
|
||||
Layer?: string;
|
||||
Style?: string;
|
||||
Format?: string;
|
||||
}
|
||||
interface Options extends Flexible.Options {
|
||||
url: string;
|
||||
params: Params;
|
||||
blend?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
class WMTS extends Flexible {
|
||||
constructor(options: WMTS.Options);
|
||||
setUrl(url: string): void;
|
||||
getUrl(): string;
|
||||
setParams(params: WMTS.Params): void;
|
||||
getParams(): WMTS.Params;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
declare namespace AMap {
|
||||
class LngLat {
|
||||
constructor(lng: number, lat: number, noAutofix?: boolean);
|
||||
offset(east: number, north: number): LngLat;
|
||||
distance(lnglat: LngLat | LngLat[]): number;
|
||||
getLng(): number;
|
||||
getLat(): number;
|
||||
equals(lnglat: LngLat): boolean;
|
||||
toString(): string;
|
||||
|
||||
// internal
|
||||
add(lnglat: LngLat, noAutofix?: boolean): LngLat;
|
||||
subtract(lnglat: LngLat, noAutofix?: boolean): LngLat;
|
||||
divideBy(num: number, noAutofix?: boolean): LngLat;
|
||||
multiplyBy(num: number, noAutofix?: boolean): LngLat;
|
||||
}
|
||||
}
|
||||
Vendored
+187
@@ -0,0 +1,187 @@
|
||||
declare namespace AMap {
|
||||
namespace Map {
|
||||
type Feature = 'bg' | 'point' | 'road' | 'building';
|
||||
type ViewMode = '2D' | '3D';
|
||||
interface Options {
|
||||
view?: View2D;
|
||||
layers?: Layer[];
|
||||
zoom?: number;
|
||||
center?: LocationValue;
|
||||
labelzIndex?: number;
|
||||
zooms?: [number, number];
|
||||
lang?: Lang;
|
||||
defaultCursor?: string;
|
||||
crs?: 'EPSG3857' | 'EPSG3395' | 'EPSG4326';
|
||||
animateEnable?: boolean;
|
||||
isHotspot?: boolean;
|
||||
defaultLayer?: TileLayer;
|
||||
rotateEnable?: boolean;
|
||||
resizeEnable?: boolean;
|
||||
showIndoorMap?: boolean;
|
||||
expandZoomRange?: boolean;
|
||||
dragEnable?: boolean;
|
||||
zoomEnable?: boolean;
|
||||
doubleClickZoom?: boolean;
|
||||
keyboardEnable?: boolean;
|
||||
jogEnable?: boolean;
|
||||
scrollWheel?: boolean;
|
||||
touchZoom?: boolean;
|
||||
touchZoomCenter?: number;
|
||||
mapStyle?: string;
|
||||
features?: Feature[] | 'all' | Feature;
|
||||
showBuildingBlock?: boolean;
|
||||
viewMode?: ViewMode;
|
||||
pitch?: number;
|
||||
pitchEnable?: boolean;
|
||||
buildingAnimation?: boolean;
|
||||
skyColor?: string;
|
||||
preloadMode?: boolean;
|
||||
mask?: Array<[number, number]> | Array<Array<[number, number]>> | Array<Array<Array<[number, number]>>>;
|
||||
maxPitch?: number;
|
||||
rotation?: number;
|
||||
forceVector?: boolean;
|
||||
|
||||
// internal
|
||||
baseRender?: 'vw' | 'd' | 'dv' | 'v';
|
||||
overlayRender?: 'c' | 'd';
|
||||
showLabel?: boolean;
|
||||
gridMapForeign?: boolean;
|
||||
logoUrl?: string;
|
||||
logoUrlRetina?: string;
|
||||
copyright?: string;
|
||||
turboMode?: boolean;
|
||||
workerMode?: boolean;
|
||||
// continuousZoomEnable?: boolean;
|
||||
// showFog: boolean;
|
||||
// yaw: number;
|
||||
// scale: number;
|
||||
// detectRetina: number;
|
||||
}
|
||||
interface Status {
|
||||
animateEnable: boolean;
|
||||
doubleClickZoom: boolean;
|
||||
dragEnable: boolean;
|
||||
isHotspot: boolean;
|
||||
jogEnable: boolean;
|
||||
keyboardEnable: boolean;
|
||||
pitchEnable: boolean;
|
||||
resizeEnable: boolean;
|
||||
rotateEnable: boolean;
|
||||
scrollWheel: boolean;
|
||||
touchZoom: boolean;
|
||||
zoomEnable: boolean;
|
||||
}
|
||||
type HotspotEvent<N extends string> = Event<N, {
|
||||
lnglat: LngLat;
|
||||
name: string;
|
||||
id: string;
|
||||
// internal
|
||||
isIndoorPOI: boolean;
|
||||
}>;
|
||||
interface EventMap {
|
||||
click: MapsEvent<'click', Map>;
|
||||
dblclick: MapsEvent<'dblclick', Map>;
|
||||
rightclick: MapsEvent<'rightclick', Map>;
|
||||
rdblclick: MapsEvent<'rdblclick', Map>;
|
||||
mouseup: MapsEvent<'mouseup', Map>;
|
||||
mousedown: MapsEvent<'mousedown', Map>;
|
||||
mousemove: MapsEvent<'mousemove', Map>;
|
||||
mousewheel: MapsEvent<'mousewheel', Map>;
|
||||
mouseover: MapsEvent<'mouseover', Map>;
|
||||
mouseout: MapsEvent<'mouseout', Map>;
|
||||
touchstart: MapsEvent<'touchstart', Map>;
|
||||
touchmove: MapsEvent<'touchmove', Map>;
|
||||
touchend: MapsEvent<'touchend', Map>;
|
||||
contextmenu: MapsEvent<'contextmenu', Map>;
|
||||
|
||||
hotspotclick: HotspotEvent<'hotspotclick'>;
|
||||
hotspotover: HotspotEvent<'hotspotover'>;
|
||||
hotspotout: HotspotEvent<'hotspotout'>;
|
||||
|
||||
complete: Event<'complete'>;
|
||||
mapmove: Event<'mapmove'>;
|
||||
movestart: Event<'movestart'>;
|
||||
moveend: Event<'moveend'>;
|
||||
zoomchange: Event<'zoomchange'>;
|
||||
zoomstart: Event<'zoomstart'>;
|
||||
zoomend: Event<'zoomend'>;
|
||||
dragstart: Event<'dragstart'>;
|
||||
dragging: Event<'dragging'>;
|
||||
dragend: Event<'dragend'>;
|
||||
resize: Event<'resize'>;
|
||||
}
|
||||
}
|
||||
|
||||
class Map extends EventEmitter {
|
||||
constructor(container: string | HTMLElement, opts?: Map.Options);
|
||||
poiOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void;
|
||||
detailOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void;
|
||||
getZoom(): number;
|
||||
getLayers(): Layer[];
|
||||
getCenter(): LngLat;
|
||||
getContainer(): HTMLElement | null;
|
||||
getCity(callback: (cityData: {
|
||||
city: string;
|
||||
citycode: string;
|
||||
district: string;
|
||||
province: string | never[]; // province is empty array when getCity fail
|
||||
}) => void): void;
|
||||
getBounds(): Bounds;
|
||||
getLabelzIndex(): number;
|
||||
getLimitBounds(): Bounds;
|
||||
getLang(): Lang;
|
||||
getSize(): Size;
|
||||
getRotation(): number;
|
||||
getStatus(): Map.Status;
|
||||
getDefaultCursor(): string;
|
||||
getResolution(point?: LocationValue): number;
|
||||
getScale(dpi?: number): number;
|
||||
setZoom(level: number): void;
|
||||
setLabelzIndex(index: number): void;
|
||||
setLayers(layers: Layer[]): void;
|
||||
add(overlay: Overlay | Overlay[]): void;
|
||||
remove(overlay: Overlay | Overlay[]): void;
|
||||
getAllOverlays(type?: 'marker' | 'circle' | 'polyline' | 'polygon'): Overlay[];
|
||||
setCenter(center: LocationValue): void;
|
||||
setZoomAndCenter(zoomLevel: number, center: LocationValue): void;
|
||||
setCity(city: string, callback: (this: this, coord: [string, string], zoom: number) => void): void;
|
||||
setBounds(bound: Bounds): Bounds;
|
||||
setLimitBounds(bound: Bounds): void;
|
||||
clearLimitBounds(): void;
|
||||
setLang(lang: Lang): void;
|
||||
setRotation(rotation: number): void;
|
||||
setStatus(status: Partial<Map.Status>): void;
|
||||
setDefaultCursor(cursor: string): void;
|
||||
zoomIn(): void;
|
||||
zoomOut(): void;
|
||||
panTo(position: LocationValue): void;
|
||||
panBy(x: number, y: number): void;
|
||||
setFitView(
|
||||
overlayList?: Overlay | Overlay[],
|
||||
immediately?: boolean,
|
||||
avoid?: [number, number, number, number],
|
||||
maxZoom?: number
|
||||
): Bounds | false | undefined;
|
||||
clearMap(): void;
|
||||
destroy(): void;
|
||||
plugin(name: string | string[], callback: () => void): this;
|
||||
addControl(control: {}): void; // TODO
|
||||
removeControl(control: {}): void; // TODO
|
||||
clearInfoWindow(): void;
|
||||
pixelToLngLat(pixel: Pixel, level?: number): LngLat;
|
||||
lnglatToPixel(lnglat: LocationValue, level?: number): Pixel;
|
||||
containerToLngLat(pixel: Pixel): LngLat;
|
||||
lngLatToContainer(lnglat: LocationValue): Pixel;
|
||||
lnglatTocontainer(lnglat: LocationValue): Pixel;
|
||||
setMapStyle(style: string): void;
|
||||
getMapStyle(): string;
|
||||
setFeatures(feature: Map.Feature | Map.Feature[] | 'all'): void;
|
||||
getFeatures(): Map.Feature | Map.Feature[] | 'all';
|
||||
setDefaultLayer(layer: TileLayer): void;
|
||||
setPitch(pitch: number): void;
|
||||
getPitch(): number;
|
||||
getViewMode_(): Map.ViewMode;
|
||||
lngLatToGeodeticCoord(lnglat: LocationValue): Pixel;
|
||||
geodeticCoordToLngLat(pixel: Pixel): LngLat;
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
declare namespace AMap {
|
||||
namespace BezierCurve {
|
||||
interface EventMap<I = BezierCurve> extends Polyline.EventMap<I> { }
|
||||
type Options<ExtraData = any> = Merge<Polyline.Options<ExtraData>, {
|
||||
// internal
|
||||
path: Array<Array<number | string | Array<string | number>>>;
|
||||
tolerance?: number;
|
||||
interpolateNumLimit?: [number | number];
|
||||
}>;
|
||||
|
||||
interface GetOptionsResult<ExtraData = any> extends Polyline.GetOptionsResult<ExtraData> {
|
||||
path: Array<LngLat & { controlPoints: LngLat[] }>;
|
||||
}
|
||||
}
|
||||
class BezierCurve<ExtraData = any> extends Polyline<ExtraData> {
|
||||
constructor(options: BezierCurve.Options<ExtraData>);
|
||||
getOptions(): Partial<BezierCurve.GetOptionsResult<ExtraData>>;
|
||||
// internal
|
||||
getInterpolateLngLats(): LngLat[];
|
||||
getSerializedPath(): number[][];
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
declare namespace AMap {
|
||||
namespace Circle {
|
||||
interface EventMap<I = Circle> extends ShapeOverlay.EventMap<I> {
|
||||
setCenter: Event<'setCenter'>;
|
||||
setRadius: Event<'setRadius'>;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> {
|
||||
map?: Map;
|
||||
zIndex?: number;
|
||||
center?: LocationValue;
|
||||
bubble?: boolean;
|
||||
cursor?: string;
|
||||
radius?: number;
|
||||
strokeColor?: string;
|
||||
strokeOpcity?: number;
|
||||
strokeWeight?: number;
|
||||
fillColor?: string;
|
||||
fillOpacity?: number;
|
||||
strokeStyle?: StrokeStyle;
|
||||
extData?: ExtraData;
|
||||
strokeDasharray?: number[];
|
||||
|
||||
// internal
|
||||
visible?: boolean;
|
||||
unit?: 'meter' | 'px'; // 'might be typo'
|
||||
}
|
||||
|
||||
type GetOptionsResult<ExtraData = any> = Merge<Polygon.GetOptionsResult<ExtraData>, {
|
||||
path: LngLat[];
|
||||
center: LngLat;
|
||||
radius: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
class Circle<ExtraData = any> extends ShapeOverlay<ExtraData> {
|
||||
constructor(options?: Circle.Options<ExtraData>);
|
||||
setCenter(center: LocationValue, preventEvent?: boolean): void;
|
||||
getCenter(): LngLat | undefined;
|
||||
getBounds(): Bounds | null;
|
||||
setRadius(radius: number, preventEvent?: boolean): void;
|
||||
getRadius(): number;
|
||||
setOptions(options?: Circle.Options<ExtraData>): void;
|
||||
getOptions(): Partial<Circle.GetOptionsResult<ExtraData>>;
|
||||
contains(point: LocationValue): boolean;
|
||||
// internal
|
||||
getPath(count?: number): LngLat[];
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
declare namespace AMap {
|
||||
// tslint:disable-next-line;
|
||||
class CircleMarker<ExtraData = any> extends Circle<ExtraData> {}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
declare namespace AMap {
|
||||
namespace ContextMenu {
|
||||
interface Options {
|
||||
content?: string | HTMLElement;
|
||||
// internal
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
interface EventMap<I> {
|
||||
items: Event<'items'>;
|
||||
open: Event<'open', { target: I }>;
|
||||
close: Event<'close', { target: I }>;
|
||||
}
|
||||
}
|
||||
|
||||
class ContextMenu<ExtraData = any> extends Overlay<ExtraData> {
|
||||
constructor(options?: ContextMenu.Options);
|
||||
addItem(text: string, fn: (this: HTMLLIElement) => void, num?: number): void;
|
||||
removeItem(test: string, fn: (this: HTMLLIElement) => void): void;
|
||||
open(map: Map, position: LocationValue): void;
|
||||
close(): void;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
declare namespace AMap {
|
||||
namespace Ellipse {
|
||||
interface EventMap<I = Ellipse> extends ShapeOverlay.EventMap<I> {
|
||||
setPath: Event<'setPath'>;
|
||||
setCenter: Event<'setCenter'>;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends Polygon.Options<ExtraData> {
|
||||
center?: LocationValue;
|
||||
radius?: [number, number];
|
||||
}
|
||||
type GetOptionsResult<ExtraData = any> = Merge<Circle.GetOptionsResult<ExtraData>, {
|
||||
radius: [number, number];
|
||||
}>;
|
||||
}
|
||||
|
||||
class Ellipse<ExtraData = any> extends Polygon<ExtraData> {
|
||||
constructor(options?: Ellipse.Options<ExtraData>);
|
||||
getCenter(): LngLat | undefined;
|
||||
setCenter(center: LocationValue, preventEvent?: boolean): void;
|
||||
setOptions(options: Ellipse.Options<ExtraData>): void;
|
||||
|
||||
// internal
|
||||
setRadius(radius: [number, number], preventEvent?: boolean): void;
|
||||
getRadius(): [number, number];
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
declare namespace AMap {
|
||||
namespace GeoJSON {
|
||||
type Geometry = {
|
||||
type: 'Point';
|
||||
coordinates: [number, number];
|
||||
} | {
|
||||
type: 'MultiPoint' | 'LineString' | 'Polygon';
|
||||
coordinates: Array<[number, number]>;
|
||||
} | {
|
||||
type: 'MultiLineString' | 'MultiPolygon';
|
||||
coordinates: Array<Array<[number, number]>>;
|
||||
} | {
|
||||
type: 'GeometryCollection';
|
||||
geometries: Geometry[];
|
||||
};
|
||||
|
||||
type GeoJSONObject = {
|
||||
type: 'Feature';
|
||||
properties: any;
|
||||
geometry: Geometry;
|
||||
} | {
|
||||
type: 'FeatureCollection',
|
||||
properties: any;
|
||||
features: GeoJSONObject[];
|
||||
};
|
||||
interface Options {
|
||||
geoJSON?: GeoJSONObject | GeoJSONObject[];
|
||||
getMarker?(obj: GeoJSONObject, lnglat: LngLat): Marker;
|
||||
getPolyline?(obj: GeoJSONObject, lnglats: LngLat[]): Polyline;
|
||||
getPolygon?(obj: GeoJSONObject, lnglats: LngLat[]): Polygon;
|
||||
coordsToLatLng?(lnglat: LngLat): LngLat;
|
||||
|
||||
// internal
|
||||
coordsToLatLngs?(lnglats: LngLat[]): LngLat[];
|
||||
}
|
||||
}
|
||||
|
||||
class GeoJSON<ExtraData = any> extends OverlayGroup<Overlay, ExtraData> {
|
||||
constructor(options?: GeoJSON.Options);
|
||||
importData(obj: GeoJSON.GeoJSONObject | GeoJSON.GeoJSONObject[]): void;
|
||||
toGeoJSON(): GeoJSON.GeoJSONObject[];
|
||||
}
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
declare namespace AMap {
|
||||
namespace Icon {
|
||||
interface Options {
|
||||
size?: SizeValue;
|
||||
imageOffset?: Pixel;
|
||||
image?: string;
|
||||
imageSize?: SizeValue;
|
||||
}
|
||||
}
|
||||
|
||||
class Icon extends EventEmitter {
|
||||
constructor(options?: Icon.Options);
|
||||
setImageSize(size: SizeValue): void;
|
||||
getImageSize(): Size;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
declare namespace AMap {
|
||||
namespace InfoWindow {
|
||||
interface EventMap<I> {
|
||||
change: Event<'change', { target: I }>;
|
||||
open: Event<'open', { target: I }>;
|
||||
close: Event<'close', { target: I }>;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
|
||||
isCustom?: boolean;
|
||||
autoMove?: boolean;
|
||||
closeWhenClickMap?: boolean;
|
||||
content?: string | HTMLElement;
|
||||
size?: SizeValue;
|
||||
offset?: Pixel;
|
||||
position?: LocationValue;
|
||||
showShadow?: boolean;
|
||||
// internal
|
||||
height?: number;
|
||||
}
|
||||
}
|
||||
|
||||
class InfoWindow<ExtraData = any> extends Overlay<ExtraData> {
|
||||
constructor(options?: InfoWindow.Options);
|
||||
open(map: Map, position?: LocationValue): void;
|
||||
close(): void;
|
||||
getIsOpen(): boolean;
|
||||
setContent(content: string | HTMLElement): void;
|
||||
getContent(): string | HTMLElement | undefined;
|
||||
setPosition(lnglat: LocationValue): void;
|
||||
getPosition(): LngLat | undefined;
|
||||
setSize(size: SizeValue): void;
|
||||
getSize(): Size | undefined;
|
||||
// internal
|
||||
setOffset(offset: Pixel): void;
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
declare namespace AMap {
|
||||
namespace Marker {
|
||||
interface EventMap<I = Marker> {
|
||||
click: MapsEvent<'click', I>;
|
||||
dblclick: MapsEvent<'dblclick', I>;
|
||||
rightclick: MapsEvent<'rightclick', I>;
|
||||
mousemove: MapsEvent<'mousemove', I>;
|
||||
mouseover: MapsEvent<'mouseover', I>;
|
||||
mouseout: MapsEvent<'mouseout', I>;
|
||||
mousedown: MapsEvent<'mousedown', I>;
|
||||
mouseup: MapsEvent<'mouseup', I>;
|
||||
dragstart: MapsEvent<'dragstart', I>;
|
||||
dragging: MapsEvent<'dragging', I>;
|
||||
dragend: MapsEvent<'dragend', I>;
|
||||
moving: Event<'moving', { passwdPath: LngLat[]; }>;
|
||||
moveend: Event<'moveend'>;
|
||||
movealong: Event<'movealong'>;
|
||||
touchstart: MapsEvent<'touchstart', I>;
|
||||
touchmove: MapsEvent<'touchmove', I>;
|
||||
touchend: MapsEvent<'touchend', I>;
|
||||
}
|
||||
|
||||
interface Label {
|
||||
content?: string;
|
||||
offset?: Pixel;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
|
||||
position?: LocationValue;
|
||||
offset?: Pixel;
|
||||
icon?: string | Icon;
|
||||
content?: string | HTMLElement;
|
||||
topWhenClick?: boolean;
|
||||
bubble?: boolean;
|
||||
draggable?: boolean;
|
||||
raiseOnDrag?: boolean;
|
||||
cursor?: string;
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
angle?: number;
|
||||
autoRotation?: boolean;
|
||||
animation?: AnimationName;
|
||||
shadow?: Icon | string;
|
||||
title?: string;
|
||||
shape?: MarkerShape;
|
||||
label?: Label;
|
||||
zooms?: [number, number];
|
||||
|
||||
// internal
|
||||
topWhenMouseOver?: boolean;
|
||||
height?: number;
|
||||
}
|
||||
}
|
||||
|
||||
class Marker<ExtraData = any> extends Overlay<ExtraData> {
|
||||
constructor(options?: Marker.Options<ExtraData>);
|
||||
markOnAMAP(obj?: { name?: string, position?: LocationValue }): void;
|
||||
getOffset(): Pixel;
|
||||
setOffset(offset: Pixel): void;
|
||||
setAnimation(animate: AnimationName, prevent?: boolean): void;
|
||||
getAnimation(): AnimationName;
|
||||
setClickable(cilckable: boolean): void;
|
||||
getClickable(): boolean;
|
||||
getPosition(): LngLat | undefined;
|
||||
setPosition(position: LocationValue): void;
|
||||
setAngle(angle: number): void;
|
||||
setLabel(label?: Marker.Label): void;
|
||||
getLabel(): Marker.Label | undefined;
|
||||
getAngle(): number;
|
||||
setzIndex(index: number): void;
|
||||
getzIndex(): number;
|
||||
setIcon(content: string | Icon): void;
|
||||
getIcon(): string | Icon | undefined;
|
||||
setDraggable(draggable: boolean): void;
|
||||
getDraggable(): boolean;
|
||||
setCursor(cursor: string): void;
|
||||
setContent(content: string | HTMLElement): void;
|
||||
getContent(): string | HTMLElement;
|
||||
moveAlong(
|
||||
path: LngLat[],
|
||||
speed: number,
|
||||
timingFunction?: (t: number) => number,
|
||||
circleable?: boolean
|
||||
): void;
|
||||
moveTo(
|
||||
path: LocationValue,
|
||||
speed: number,
|
||||
timingFunction?: (t: number) => number
|
||||
): void;
|
||||
stopMove(): void;
|
||||
pauseMove(): boolean;
|
||||
resumeMove(): boolean;
|
||||
setMap(map: null | Map): void;
|
||||
setTitle(title: string): void;
|
||||
getTitle(): string | undefined;
|
||||
setTop(isTop: boolean): void;
|
||||
getTop(): boolean;
|
||||
setShadow(icon?: Icon | string): void;
|
||||
getShadow(): Icon | undefined | string;
|
||||
setShape(shape?: MarkerShape): void;
|
||||
getShape(): MarkerShape | undefined;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
declare namespace AMap {
|
||||
namespace MarkerShape {
|
||||
interface CircleOptions {
|
||||
type: 'circle';
|
||||
coords: [number, number, number];
|
||||
}
|
||||
interface PolyOptions {
|
||||
type: 'poly';
|
||||
coords: number[];
|
||||
}
|
||||
interface RectOptions {
|
||||
type: 'rect';
|
||||
coords: [number, number, number, number];
|
||||
}
|
||||
type Options = CircleOptions | PolyOptions | RectOptions;
|
||||
}
|
||||
|
||||
class MarkerShape extends EventEmitter {
|
||||
constructor(options: MarkerShape.Options);
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
declare namespace AMap {
|
||||
namespace Overlay {
|
||||
interface EventMap<I> {
|
||||
touchstart: MapsEvent<'touchstart', I>;
|
||||
touchmove: MapsEvent<'touchmove', I>;
|
||||
touchend: MapsEvent<'touchend', I>;
|
||||
click: MapsEvent<'click', I>;
|
||||
rightclick: MapsEvent<'rightclick', I>;
|
||||
dblclick: MapsEvent<'dblclick', I>;
|
||||
mousemove: MapsEvent<'mousemove', I>;
|
||||
mouseover: MapsEvent<'mouseover', I>;
|
||||
mousedown: MapsEvent<'mousedown', I>;
|
||||
mouseup: MapsEvent<'mouseup', I>;
|
||||
}
|
||||
interface Options<ExtraData = any> {
|
||||
map?: Map;
|
||||
cursor?: string;
|
||||
extData?: ExtraData;
|
||||
bubble?: boolean;
|
||||
clickable?: boolean;
|
||||
draggable?: boolean;
|
||||
}
|
||||
}
|
||||
abstract class Overlay<ExtraData = any> extends EventEmitter {
|
||||
constructor(options?: Overlay.Options);
|
||||
show(): void;
|
||||
hide(): void;
|
||||
getMap(): Map | null | undefined;
|
||||
setMap(map: Map | null): void;
|
||||
setExtData(extData: ExtraData): void;
|
||||
getExtData(): ExtraData | {};
|
||||
|
||||
// internal
|
||||
setHeight(height?: number | string): void;
|
||||
getHeight(): number | string;
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
type ReferOverlayOptions<O> =
|
||||
O extends AMap.BezierCurve ? AMap.BezierCurve.Options
|
||||
: O extends AMap.Polyline ? AMap.Polyline.Options
|
||||
: O extends AMap.Circle ? AMap.Circle.Options
|
||||
: O extends AMap.Ellipse ? AMap.Ellipse.Options
|
||||
: O extends AMap.Polygon ? AMap.Polygon.Options
|
||||
: O extends AMap.Text ? AMap.Text.Options
|
||||
: O extends AMap.Marker ? AMap.Marker.Options
|
||||
: O extends AMap.Rectangle ? AMap.Rectangle.Options
|
||||
: any;
|
||||
|
||||
declare namespace AMap {
|
||||
class OverlayGroup<O extends Overlay = Overlay, ExtraData = any> extends Overlay<ExtraData> {
|
||||
constructor(overlays?: O | O[]);
|
||||
addOverlay(overlay: O | O[]): this;
|
||||
addOverlays(overlay: O | O[]): this;
|
||||
getOverlays(): O[];
|
||||
hasOverlay(overlay: O | ((this: null, item: O, index: number, list: O[]) => boolean)): boolean;
|
||||
removeOverlay(overlay: O | O[]): this;
|
||||
removeOverlays(overlay: O | O[]): this;
|
||||
clearOverlays(): this;
|
||||
eachOverlay<C = O>(iterator: (this: C, overlay: O, index: number, overlays: O[]) => void, context?: C): this;
|
||||
setMap(map: null | Map): this;
|
||||
setOptions(options: ReferOverlayOptions<O>): this;
|
||||
show(): this;
|
||||
hide(): this;
|
||||
|
||||
getOverlay(finder: ((this: null, item: O, index: number, list: O[]) => boolean) | O): O | null;
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
declare namespace AMap {
|
||||
namespace PathOverlay {
|
||||
interface EventMap<I = PathOverlay> extends ShapeOverlay.EventMap<I> { }
|
||||
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
strokeColor?: string;
|
||||
strokeOpacity?: number;
|
||||
strokeWeight?: number;
|
||||
strokeStyle?: StrokeStyle;
|
||||
strokeDasharray?: number[];
|
||||
lineJoin?: StrokeLineJoin;
|
||||
lineCap?: StrokeLineCap;
|
||||
}
|
||||
}
|
||||
abstract class PathOverlay<ExtraData = any> extends ShapeOverlay<ExtraData> {
|
||||
constructor(options?: PathOverlay.Options<ExtraData>);
|
||||
getBounds(): Bounds | (this extends Rectangle ? undefined : null);
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
declare namespace AMap {
|
||||
namespace Polygon {
|
||||
interface EventMap<I = Polygon> extends PathOverlay.EventMap<I> { }
|
||||
interface Options<ExtraData = any> extends PathOverlay.Options<ExtraData> {
|
||||
path?: LocationValue[] | LocationValue[][];
|
||||
fillColor?: string;
|
||||
fillOpacity?: number;
|
||||
}
|
||||
|
||||
interface GetOptionsResult<ExtraData = any> extends ShapeOverlay.GetOptionsResult<ExtraData> {
|
||||
fillColor: string;
|
||||
fillOpacity: number;
|
||||
path: LngLat[] | LngLat[][];
|
||||
lineJoin: StrokeLineJoin;
|
||||
texture: string;
|
||||
}
|
||||
}
|
||||
|
||||
class Polygon<ExtraData = any> extends PathOverlay<ExtraData> {
|
||||
constructor(options?: Polygon.Options<ExtraData>);
|
||||
setPath(path: LocationValue[] | LocationValue[][]): void;
|
||||
getPath(): LngLat[] | LngLat[][];
|
||||
setOptions(options: Polygon.Options<ExtraData>): void;
|
||||
getOptions(): Partial<
|
||||
this extends Omit<Ellipse, keyof Polygon> ? Ellipse.GetOptionsResult<ExtraData> :
|
||||
this extends Omit<Rectangle, keyof Polygon> ? Rectangle.GetOptionsResult<ExtraData> :
|
||||
Polygon.GetOptionsResult<ExtraData>
|
||||
>;
|
||||
getArea(): number;
|
||||
contains(point: LocationValue): boolean;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
declare namespace AMap {
|
||||
namespace Polyline {
|
||||
interface EventMap<I = Polyline> extends PathOverlay.EventMap<I> { }
|
||||
interface GetOptionsResult<ExtraData = any> extends ShapeOverlay.GetOptionsResult<ExtraData> {
|
||||
isOutline: boolean;
|
||||
outlineColor: string;
|
||||
geodesic: boolean;
|
||||
path: LngLat[];
|
||||
lineJoin: StrokeLineJoin;
|
||||
lineCap: StrokeLineCap;
|
||||
borderWeight: number;
|
||||
showDir: boolean;
|
||||
dirColor: string;
|
||||
dirImg: string;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends PathOverlay.Options<ExtraData> {
|
||||
isOutline?: boolean;
|
||||
outlineColor?: string;
|
||||
geodesic?: boolean;
|
||||
dirColor?: string;
|
||||
borderWeight?: number;
|
||||
showDir?: boolean;
|
||||
// internal
|
||||
path?: LocationValue[];
|
||||
}
|
||||
}
|
||||
|
||||
class Polyline<ExtraData = any> extends PathOverlay<ExtraData> {
|
||||
constructor(options?: BezierCurve.Options<ExtraData> | Polyline.Options<ExtraData>);
|
||||
setPath(
|
||||
path: this extends Omit<BezierCurve, keyof Polyline> ?
|
||||
Array<Array<number | string | Array<string | number>>>
|
||||
: LocationValue[]
|
||||
): void;
|
||||
getPath(): this extends Omit<BezierCurve, keyof Polyline> ?
|
||||
Array<LngLat & { controlPoints: LngLat[] }>
|
||||
: LngLat[];
|
||||
getLength(): number;
|
||||
setOptions(options: this extends Omit<BezierCurve, keyof Polyline> ?
|
||||
Partial<BezierCurve.Options<ExtraData>>
|
||||
: Polyline.Options<ExtraData>
|
||||
): void;
|
||||
getOptions(): Partial<Polyline.GetOptionsResult<ExtraData>>;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
declare namespace AMap {
|
||||
namespace Rectangle {
|
||||
interface EventMap<I = Rectangle> extends Polygon.EventMap<I> {
|
||||
setBounds: Event<'setBounds'>;
|
||||
}
|
||||
|
||||
interface Options<ExtraData = any> extends Polygon.Options<ExtraData> {
|
||||
bounds?: Bounds;
|
||||
}
|
||||
type GetOptionsResult<ExtraData = any> = Merge<Polygon.GetOptionsResult<ExtraData>, {
|
||||
path: LngLat[];
|
||||
bounds: Bounds;
|
||||
texture: string;
|
||||
}>;
|
||||
}
|
||||
class Rectangle<ExtraData = any> extends Polygon<ExtraData> {
|
||||
constructor(options?: Rectangle.Options<ExtraData>);
|
||||
setBounds(bounds: Bounds, preventEvent?: boolean): void;
|
||||
setOptions(options: Partial<Rectangle.Options>): void;
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
declare namespace AMap {
|
||||
namespace ShapeOverlay {
|
||||
interface EventMap<I = ShapeOverlay> extends Overlay.EventMap<I> {
|
||||
show: Event<'show', { target: I }>;
|
||||
hide: Event<'hide', { target: I }>;
|
||||
options: Event<'options'>;
|
||||
change: Event<'change', { target: I }>;
|
||||
}
|
||||
interface GetOptionsResult<ExtraData = any> {
|
||||
map: Map;
|
||||
zIndex: number;
|
||||
strokeColor: string;
|
||||
strokeOpacity: number;
|
||||
strokeWeight: number;
|
||||
strokeStyle: StrokeStyle;
|
||||
strokeDasharray: number[];
|
||||
extData: ExtraData | {};
|
||||
bubble: boolean;
|
||||
clickable: boolean;
|
||||
}
|
||||
}
|
||||
abstract class ShapeOverlay<ExtraData = any> extends Overlay<ExtraData> {
|
||||
abstract setOptions(options: {}): void;
|
||||
abstract getOptions(): {};
|
||||
getzIndex(): number;
|
||||
setzIndex(zIndex: number): void;
|
||||
getVisible(): boolean;
|
||||
setDraggable(draggable: boolean): void;
|
||||
}
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
declare namespace AMap {
|
||||
namespace Text {
|
||||
type TextAlign = 'left' | 'right' | 'center';
|
||||
type VerticalAlign = 'top' | 'middle' | 'bottom';
|
||||
interface EventMap<I = Text> extends Marker.EventMap<I> { }
|
||||
interface Options extends Marker.Options {
|
||||
text?: string;
|
||||
textAlign?: TextAlign;
|
||||
verticalAlign?: VerticalAlign;
|
||||
}
|
||||
}
|
||||
|
||||
class Text<ExtraData = any> extends Marker<ExtraData> {
|
||||
constructor(options?: Text.Options);
|
||||
getText(): string;
|
||||
setText(text: string): void;
|
||||
setStyle(style: object): void;
|
||||
}
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
declare namespace AMap {
|
||||
class Pixel {
|
||||
constructor(x: number, y: number, round?: boolean);
|
||||
getX(): number;
|
||||
getY(): number;
|
||||
equals(point: Pixel): boolean;
|
||||
toString(): string;
|
||||
|
||||
// internal
|
||||
add(offset: {x: number; y: number}, round?: boolean): Pixel;
|
||||
round(): Pixel;
|
||||
floor(): Pixel;
|
||||
length(): number;
|
||||
direction(): null | number;
|
||||
toFixed(decimals?: number): this;
|
||||
}
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
declare namespace AMap {
|
||||
class Size {
|
||||
constructor(width: number, height: number);
|
||||
getWidth(): number;
|
||||
getHeight(): number;
|
||||
toString(): string;
|
||||
// internal
|
||||
contains(size: { x: number; y: number }): boolean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"array-bounds.d.ts",
|
||||
"bounds.d.ts",
|
||||
"browser.d.ts",
|
||||
"common.d.ts",
|
||||
"convert-from.d.ts",
|
||||
"dom-util.d.ts",
|
||||
"event.d.ts",
|
||||
"geometry-util.d.ts",
|
||||
"index.d.ts",
|
||||
"layer/building.d.ts",
|
||||
"layer/flexible.d.ts",
|
||||
"layer/layer.d.ts",
|
||||
"layer/layerGroup.d.ts",
|
||||
"layer/massMarks.d.ts",
|
||||
"layer/mediaLayer.d.ts",
|
||||
"layer/tileLayer.d.ts",
|
||||
"layer/wms.d.ts",
|
||||
"layer/wmts.d.ts",
|
||||
"lngLat.d.ts",
|
||||
"map.d.ts",
|
||||
"overlay/bezierCurve.d.ts",
|
||||
"overlay/circle.d.ts",
|
||||
"overlay/circleMarker.d.ts",
|
||||
"overlay/contextMenu.d.ts",
|
||||
"overlay/ellipse.d.ts",
|
||||
"overlay/geoJSON.d.ts",
|
||||
"overlay/icon.d.ts",
|
||||
"overlay/infoWindow.d.ts",
|
||||
"overlay/marker.d.ts",
|
||||
"overlay/markerShape.d.ts",
|
||||
"overlay/overlay.d.ts",
|
||||
"overlay/overlayGroup.d.ts",
|
||||
"overlay/pathOverlay.d.ts",
|
||||
"overlay/polygon.d.ts",
|
||||
"overlay/polyline.d.ts",
|
||||
"overlay/rectangle.d.ts",
|
||||
"overlay/shapeOverlay.d.ts",
|
||||
"overlay/text.d.ts",
|
||||
"pixel.d.ts",
|
||||
"size.d.ts",
|
||||
"type-util.d.ts",
|
||||
"util.d.ts",
|
||||
"view2D.d.ts",
|
||||
"amap-js-api-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
type Omit<T, E extends keyof T> = {
|
||||
[K in Exclude<keyof T, E>]: T[K]
|
||||
};
|
||||
|
||||
type OptionalKey<T> = { [K in keyof T]-?: undefined extends T[K] ? K : never }[keyof T];
|
||||
// type OmitUndefined<M> = Omit<M, { [K in keyof M]: M[K] extends undefined ? K : never }[keyof M]>;
|
||||
// type PickUndefined<M> = Omit<M, keyof OmitUndefined<M>>;
|
||||
|
||||
type Merge<O, T> =
|
||||
{ [K in Exclude<keyof O, keyof T | OptionalKey<O>>]-?: O[K]; } &
|
||||
{ [K in Extract<Exclude<keyof O, keyof T>, OptionalKey<O>>]?: O[K]; } &
|
||||
T;
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
declare namespace AMap {
|
||||
namespace Util {
|
||||
function colorNameToHex(colorName: string): string;
|
||||
|
||||
function rgbHex2Rgba(hex: string): string;
|
||||
|
||||
function argbHex2Rgba(hex: string): string;
|
||||
|
||||
function isEmpty(obj: object): boolean;
|
||||
|
||||
function deleteItemFromArray<T = any>(array: T[], item: T): T[];
|
||||
|
||||
function deleteItemFromArrayByIndex<T = any>(array: T[], index: number): T[];
|
||||
|
||||
function indexOf<T = any>(array: T[], item: T): number;
|
||||
|
||||
function format(floatNumber: number, digits?: number): number;
|
||||
|
||||
function isArray(data: any): data is any[];
|
||||
|
||||
function isDOM(data: any): data is HTMLElement;
|
||||
|
||||
function includes<T = any>(array: T[], item: T): boolean;
|
||||
|
||||
function requestIdleCallback(callback: (...args: any[]) => any, options?: { timeout?: number }): number;
|
||||
|
||||
function cancelIdleCallback(handle: number): void;
|
||||
|
||||
function requestAnimFrame<C = undefined>(callback: (this: C, ...args: any[]) => any, context?: C): number;
|
||||
|
||||
function cancelAnimFrame(handle: number): void;
|
||||
|
||||
function color2RgbaArray(color: string | number[]): [number, number, number, number];
|
||||
|
||||
function color2Rgba(color: string | number[]): string;
|
||||
}
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
declare namespace AMap {
|
||||
namespace View2D {
|
||||
interface Options {
|
||||
center?: LocationValue;
|
||||
rotation?: number;
|
||||
zoom?: number;
|
||||
crs?: 'EPGS3857' | 'EPGS3395' | 'EPGS4326';
|
||||
}
|
||||
}
|
||||
class View2D extends EventEmitter {
|
||||
constructor(options?: View2D.Options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user