forked from cdguysFEE/amap-types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
1392 lines (763 loc) · 25.1 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare namespace AMap {
export type FeaturesTypes = 'bg' | 'point' | 'road' | 'building'
export type ZoomType = [number, number]
export type LngLatLiteral = [number, number]
export interface PixelLiteral {
x: number
y: number
}
// event
export class Event {
addDomListener(instance, eventName, handler, context): EventListener
addListener( instance, eventName, handler, context): EventListener
addListenerOnce( instance, eventName, handler, context): EventListener
removeListener(eventListener: EventListener): void
trigger(instance, eventName, extArgs): void
}
export interface MouseEvent {
latLng: LngLat
pixel: Pixel
type: string
target: any
}
export class BaseEvent {
constructor()
on(eventName, handler, context?): void
off(eventName, handler, context?): void
}
export interface Layer {
}
export interface Overlay {
}
export interface GeocoderOptions {
city?: string
radius?: number
lang?: string
batch?: boolean
extensions?: string
}
export class Geocoder {
constructor(option: GeocoderOptions)
getLocation(address: string, callback: (status: string, result: any) => {})
setCity(city: String)
getAddress(location: LngLat | LngLatLiteral | LngLatLiteral[] | LngLat[],
callback: (status: String, result: any) => void)
}
export interface View2DOptions {
center?: LngLat
rotation?: number
zoom?: number
// 地图显示的参考坐标系
crs?: 'EPSG3857' | 'EPSG3395' | 'EPSG4326'
}
export interface TileLayerOptions {
map?: Map
tileSize?: number
tileUrl?: string
errorUrl?: string
getTileUrl?: string
zIndex?: number
opacity?: number
zooms?: ZoomType
detectRetina?: boolean
}
export interface MapOptions {
view?: View2D
// TODO: 暂时不清楚类型,先填入any,需要完善
// 地图图层数组,数组可以是图层 中的一个或多个,默认为普通二维地图。
// 当叠加多个图层时,普通二维地图需通过实例化一个TileLayer类实现
layers?: Array<any>
zoom?: number
center?: LngLat | number[]
labelzIndex?: number
zooms?: [number, number]
lang?: string
defaultCursor?: string
// 参见View
crs?: string
animateEnable?: Boolean
isHotspot?: Boolean
defaultLayer?: TileLayer
rotateEnable?: Boolean
resizeEnable?: Boolean
showIndoorMap?: Boolean
indoorMap?: IndoorMap
expandZoomRange?: Boolean
dragEnable?: Boolean
zoomEnable?: Boolean
doubleClickZoom?: Boolean
keyboardEnable?: Boolean
jogEnable?: Boolean
scrollWheel?: Boolean
touchZoom?: Boolean
touchZoomCenter?: Number
mapStyle?: String
features?: Array<FeaturesTypes>
showBuildingBlock?: Boolean
viewMode?: String
pitch?: Number
pitchEnable?: Boolean
buildingAnimation?: Boolean
skyColor?: String
preloadMode?: boolean
}
export class Pixel {
constructor(x: number, y: number)
getX(): number
getY(): number
equals(point: Pixel): boolean
toString(): string
}
export class Size {
constructor(width: number, height: number)
getWidth(): number
getHeight(): number
toString(): string
}
export class LngLat {
constructor(lng: number, lat: number)
offset(w: Number, s: Number): LngLat
distance(lnglat: LngLat | Array<LngLat>): number
getLng(): number
getLat(): number
equals(lnglat: LngLat): boolean
toString(): string
}
export class Bounds {
constructor(southWest: LngLat, northEast: LngLat)
contains(point: LngLat): boolean
getCenter(): LngLat
getSouthWest(): LngLat
getNorthEast(): LngLat
toString(): string
}
export class View2D {
constructor(opt: View2DOptions)
}
export class ArrayBounds {
constructor(bounds: Array<LngLat|Pixel>)
}
export interface TrafficOptions {
map?: Map
zIndex?: Number
opacity?: number
zooms?: [number, number]
detectRetina?: Boolean
autoRefresh?: Boolean
interval?: Number
}
export namespace TileLayer {
export class Traffic {
constructor(option: TrafficOptions )
setOpacity(alpha: number): void
show(): void
hide(): void
getTiles(): Array<any>
reload(): void
setTileUrl(): void
getZooms(): [number, number]
setzIndex(index: Number): void
setMap(map: Map): void
}
}
export class TileLayer {
constructor(tileOpt: TileLayerOptions)
setOpacity(alpha: number): void
show(): void
hide(): void
// TODO: 类型待确定
getTiles(): Array<any>
reload(): void
setTileUrl(): void
getZooms(): ZoomType
setzIndex(index: number): void
setMap(map: Map): void
}
/**
*
* TODO: 内嵌类型待定
*/
export interface City {
province?: string
city?: string
citycode?: string
district?: string
}
export class Map extends BaseEvent {
constructor(container: String| HTMLDivElement, opts: MapOptions)
poiOnAMAP(obj: Object): void
detailOnAMAP(obj: Object): void
getZoom(): number
getLayers(): Array<any> // todo
getCenter(): LngLat
getContainer(): HTMLDivElement
getCity(callback: Function): City
getBounds(): Bounds
getLabelzIndex(): Number
getLimitBounds(): Bounds
getLang(): String
getSize(): Size
getRotation(): Number
getStatus(): Object
getDefaultCursor(): String
getResolution(point: LngLat): Number
getScale(dpi: Number): Number
setZoom(level: Number): void
setlabelzIndex(index: Number): void
setLayers(layers: Array<Layer>): void
add(overlayers: Array<Overlay>): void
remove(overlayers: Array<Overlay>): void
// TODO: 类型待定
getAllOverlays(type?: any): Object
setCenter(position: LngLatLiteral | LngLat): void
setZoomAndCenter(zoomLevel: Number, center: LngLat): void
setCity(city: String, callback: Function): void
setBounds(bound: Bounds): void
setLimitBounds(bound: Bounds): void
setLang(lang: String): String
setRotation(rotation: Number): Number
setStatus(status: Object): void
setDefaultCursor(cursor: String): void
panTo(positon: LngLat): void
panBy(x: Number, y: Number): void
setFitView(overlayList: Array<Overlay>): void
addControl(obj: Object): void
removeControl(obj: Object): void
pixelToLngLat(pixel: Pixel, level: Number): LngLat
lnglatToPixel(lngLat: LngLat, level: Number): Pixel
containerToLngLat(pixel: Pixel): LngLat
lngLatToContainer(lnglat: LngLat): Pixel
setMapStyle(style: String): void
getMapStyle(): String
setFeatures(feature: Array<FeaturesTypes>): void
getFeatures(): Array<FeaturesTypes>
setDefaultLayer(layer: TileLayer): void
setPitch(pitch: number): void
getPitch(): Number
plugin(plugins: string[], callback: Function)
destroy(): void
}
export interface IconOptions {
size?: Size
imageOffset?: Pixel
image?: string
imageSize?: Size
}
export class Icon {
constructor(opt: IconOptions)
etImageSize(): Size
setImageSize(size: Size): void
}
export interface MarkerShapeOptions {
coords?: number[]
type?: string
}
export class MarkerShape {
constructor(opt: MarkerShapeOptions)
}
export interface IndoorMapOptions {
zIndex?: number
opacity?: number
cursor?: string
hideFloorBar?: boolean
alwaysShow?: boolean
}
export class IndoorMap {
constructor(opts: IndoorMapOptions)
showIndoorMap(indoorid: string, floor: number, shopid: string): void
showFloor(floor: number, noMove: boolean): void
setMap(map: Map): void
show(): void
hide(): void
setzIndex(): void
showFloorBar(): void
hideFloorBar(): void
setOpacity(alpha: number): void
getOpacity(): number
showLabels(): void
hideLabels(): void
getSelectedBuildingId(): string
/**
* TODO: 类型待定
*
* 获取处于被选中状态的室内地图的一些基本信息,包含名称、当前楼层、所有楼层信息、ID等,结构如:{
* id:'xx'//ID
* name:'xx'//名称
* lnglat://LngLat对象,室内所在位置
* floor:0//整数,当前楼层
* floor_details:{//所有楼层的信息
* floor_indexs:[],//各楼层索引
* floor_nonas:[],//各楼层英文
* floor_names:[]//各楼层名字
* }
* }
*/
getSelectedBuilding(): any
}
export interface Building {
floor?: string
name?: string
lnglat?: LngLat
id?: string
}
export interface Shop {
id?: string
name?: string
lnglat?: LngLat
building_id?: string
}
// Marker
export interface MarkerOptions {
map?: Map
offset?: Pixel | PixelLiteral
position?: LngLat | LngLatLiteral
icon?: String | Icon
content?: String | Object
topWhenClick?: Boolean
bubble?: Boolean
draggable?: Boolean
raiseOnDrag?: Boolean
cursor?: String
visible?: Boolean
zIndex?: Number
angle?: Number
autoRotation?: Boolean
animation?: String
shadow?: Icon
title?: String
clickable?: Boolean
shape?: MarkerShape
extData?: any
// TODO: type
label?: any
}
export class Marker extends BaseEvent {
constructor(opt: MarkerOptions)
markOnAMAP(obj: Object): void
getOffset(): Pixel
setOffset(offset: Pixel): void
setAnimation(animate: String): void
getAnimation(): String
setClickable(clickable: Boolean): void
getClickable(): Boolean
getPosition(): LngLat
setPosition(lnglat: LngLat | LngLatLiteral): void
setAngle(angle: Number): void
setLabel(label: Object): void
getLabel(): Object
getAngle(): Number
setzIndex(index: Number): void
getzIndex(): Number
setIcon(content: String | Icon): void
getIcon(): String | Icon
setDraggable(draggable: Boolean): void
getDraggable(): Boolean
hide(): void
show(): void
setCursor(Cursor: string): String
setContent(html: String | HTMLElement): void
getContent(): void
moveAlong(path: LngLat[], speed: Number, f: Function, circlable: Boolean): void
moveTo(lnglat: LngLat, speed: Number, f: Function): void
stopMove(): void
pauseMove(): void
resumeMove(): void
setMap(map: Map): void
getMap(): void
setTitle(title: String): void
getTitle(): String
setTop(isTop: Boolean): void
getTop(): Boolean
setShadow(icon: Icon): void
getShadow(): Icon
setShape(shape: MarkerShape): void
getShape(): MarkerShape
setExtData(ext: any): void
getExtData(): any
}
export interface ElasticMarkerOptions {
styles?: Array<String>
zoomStyleMapping?: Object
map?: Map
position?: LngLat
topWhenClick?: Boolean
bubble?: Boolean
draggable?: Boolean
cursor?: String
visible?: Boolean
zIndex?: Number
clickable?: Boolean
extData?: any
}
export class ElasticMarker {
constructor(opt: ElasticMarkerOptions)
markOnAMAP(obj: Object): void
setClickable(clickable: Boolean): void
getClickable(): Boolean
getPosition(): LngLat
setPosition(lnglat: LngLat): void
setzIndex(index: Number): void
getzIndex(): Number
setDraggable(draggable: Boolean): void
getDraggable(): Boolean
hide(): void
show(): void
setCursor(cursor: string): String
setMap(map: Map): void
getMap(): void
setTitle(title: String): void
getTitle(): String
setTop(isTop: Boolean): void
getTop(): Boolean
setExtData(ext: any): void
getExtData(): any
}
export interface TextOptions {
text?: String
textAlign?: String
verticalAlign?: String
map?: Map
position?: LngLat
offset?: Pixel
topWhenClick?: Boolean
bubble?: Boolean
draggable?: Boolean
raiseOnDrag?: Boolean
cursor?: String
visible?: Boolean
zIndex?: Number
autoRotation?: Boolean
animation?: String
shadow?: Icon
title?: String
clickable?: Boolean
extData?: any
}
export class Text {
constructor(opt: TextOptions)
getText(): String
setText(text: string): void
setStyle(styles: Object): void
markOnAMAP(obj: Object): void
getOffset(): Pixel
setOffset(offset: Pixel): void
setAnimation(animate: String): void
getAnimation(): String
setClickable(clickable: Boolean): void
getClickable(): Boolean
getPosition(): LngLat
setPosition(lnglat: LngLat | LngLatLiteral): void
setAngle(angle: Number): void
getAngle(): Number
setzIndex(index: Number): void
getzIndex(): Number
setDraggable(draggable: Boolean): void
getDraggable(): Boolean
hide(): void
show(): void
setCursor(cursor: string): String
moveAlong(path: LngLat[], speed: Number, f: Function, circlable: Boolean): void
moveTo(lnglat: LngLat, speed: Number, f: Function): void
stopMove(): void
pauseMove(): void
resumeMove(): void
setMap(map: Map): void
getMap(): Map
setTitle(title: String): void
getTitle(): String
setTop(isTop: Boolean): void
getTop(): Boolean
setShadow(icon: Icon): void
getShadow(): Icon
setExtData(ext: any): void
getExtData(): any
}
// polyline
export interface PolylineOptions {
map?: Map
zIndex?: Number
bubble?: Boolean
cursor?: String
geodesic?: Boolean
isOutline?: Boolean
borderWeight?: Number
outlineColor?: String
path?: LngLat[] | LngLatLiteral[]
strokeColor?: String
strokeOpacity?: Number
strokeWeight?: Number
strokeStyle?: String
strokeDasharray?: Array<number>
lineJoin?: String
lineCap?: String
draggable?: Boolean
extData?: any
showDir?: Boolean
}
export class Polyline {
constructor(opt: PolylineOptions)
setPath(path: LngLat[]): void
getPath(): LngLat[]
setOptions(opt: PolylineOptions): void
getOptions(): Object
getLength(): Number
getBounds(): Bounds
hide(): void
show(): void
setMap(map: Map): void
setExtData(ext: any): void
getExtData(): any
}
// Polygon
export interface PolygonOptions {
map?: Map
zIndex?: Number
path?: Array<LngLat> | Array<Array<LngLat>>
bubble?: Boolean
cursor?: String
strokeColor?: String
strokeOpacity?: Number
strokeWeight?: Number
fillColor?: String
fillOpacity?: Number
draggable?: Boolean
extData?: any
strokeStyle?: String
strokeDasharray?: number[]
}
export class Polygon {
constructor(opt: PolygonOptions)
setPath(path: Array<LngLat> | Array<Array<LngLat>>): void
getPath(): Array<LngLat> | Array<Array<LngLat>>
setOptions(opt: PolygonOptions): void
getOptions(): object
getBounds(): Bounds
getArea(): Number
hide(): void
show(): void
setMap(map: Map): void
setExtData(ext: any): void
getExtData(): any
contains(point: LngLat): Boolean
}
export interface BezierCurveOptions {
path?: Array<number[]>
map?: AMap.Map
strokeColor?: String
strokeOpacity?: Number
strokeWeight?: Number
strokeStyle?: String
strokeDasharray?: Array<number>
zIndex?: Number
showDir?: Boolean
bubble?: Boolean
cursor?: String