-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
1535 lines (1140 loc) · 52.2 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
// Type definitions for MapKit JS 5.13.0
// Project: https://developer.apple.com/documentation/mapkitjs
// Definitions by: Jon Nermut <asdeqlabs.com>, Will Ross <paxswill.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** The JavaScript API for embedding Apple maps on your website. */
export as namespace mapkit
/* Non-exported utility types used within this file. */
declare interface MapKitError
{
/* MapKit JS uses an Error type in a couple of spots. */
code: number
message: string
}
declare interface SelectEventTypes
{
/*
* Maps, Annotations and Overlays all have events with these names. This is
* the most general typing of them. See MapEventTypes, AnnotationEventTypes,
* and OverlayEventTypes for more details
*/
"select": AnnotationEvent | OverlayEvent
"deselect": AnnotationEvent | OverlayEvent
}
declare class MapKitEvented<T>
{
/*
* Helper type so that event listeners can be added in a more type-safe
* manner. See MapEventTypes and Map for an example of usage.
*/
addEventListener<K extends keyof T>(type: K, listener: (event: T[K]) => void, thisObject?: any): void
removeEventListener<K extends keyof T>(type: K, listener: (event: T[K]) => void, thisObject?: any): void
}
/** Initialize a mapkit object by providing an authorization callback and language. */
export function init(options: MapKitInitOptions): void
declare enum MapKitInitSuccessStatus
{
/** MapKit successfully initialized and configured. */
initialized = "Initialized",
/** MapKit configuration updated. */
refreshed = "Refreshed"
}
declare enum MapKitInitFailureStatus
{
/** The authorization token provided is invalid. */
unauthorized = "Unauthorized",
/** The authorization token provided is based on a Maps ID, which has exceeded its allowed daily usage. */
tooManyRequests = "Too Many Requests"
}
declare class MapKitInitSuccessEvent extends Event
{
status: MapKitInitSuccessStatus
}
declare class MapKitInitFailureEvent extends Event
{
status: MapKitInitFailureStatus
}
interface MapKitEventTypes
{
"configuration-change": MapKitInitSuccessEvent
"error": MapKitInitFailureEvent
}
/** Subscribes a listener function to an event type. */
export function addEventListener<K extends keyof MapKitEventTypes>(type: K, listener: (event: MapKitEventTypes[K]) => void, thisObject?: any): void
/** Unsubscribes a listener function from an event type. */
export function removeEventListener<K extends keyof MapKitEventTypes>(type: K, listener: (event: MapKitEventTypes[K]) => void, thisObject?: any): void
/** An array to which maps are automatically added and removed as they are initialized and destroyed. */
export let maps: Map[]
/** A language ID indicating the selected language. */
export let language: string
/** A build string that is used internally. It is helpful to include this in bug reports. */
export const build: string
/** Initialization options for MapKit JS. */
export interface MapKitInitOptions
{
/**
* The callback function MapKit JS will invoke to asynchronously obtain an authorization token.
* authorizationCallback will be invoked by MapKit JS throughout a session and should be prepared to obtain a new token and pass it to the done function, which will be provided my MapKit JS as the sole argument each time the authorizationCallback function is called.
*/
authorizationCallback: (done: (jwt: (string)) => void) => void
/** An ID that indicates the preferred language in which to display map labels, controls, directions, and other text. */
language?: string
}
/** An object representing the latitude and longitude for a point on the Earth's surface. */
export class Coordinate
{
/** Creates a coordinate object with the specified latitude and longitude. */
constructor(latitude: number, longitude: number)
/** The latitude in degrees. */
latitude: number
/** The longitude in degrees. */
longitude: number
/** Returns a copy of the coordinate. */
copy(): Coordinate
/** Returns a Boolean value indicating whether two coordinates are equal. */
equals(other: Coordinate): boolean
/** Returns the map point that corresponds to the coordinate. */
toMapPoint(): MapPoint
/** Returns the unwrapped map point that corresponds to the coordinate. */
toUnwrappedMapPoint(): MapPoint
}
/** An object that contains options for initializing a map's features. */
export interface MapConstructorOptions
{
/** The visible area of the map defined in map units. */
visibleMapRect?: MapRect
/** The area currently displayed by the map. */
region?: CoordinateRegion
/** The map coordinate at the center of the map view. */
center?: Coordinate
/** The map's rotation, in degrees. */
rotation?: number
/** The CSS color that is used to paint the user interface controls on the map. */
tintColor?: string
/** The map’s color scheme when displaying standard or muted standard map types. */
colorScheme?: Map.ColorSchemes
/** The type of data displayed by the map view. */
mapType?: Map.MapTypes
/** The map's inset margins. */
padding?: Padding
/** A Boolean value that determines whether to display a control that lets users choose the map type. */
showsMapTypeControl?: boolean
/** A Boolean value that determines whether the user may rotate the map using the compass control or a rotate gesture. */
isRotationEnabled?: boolean
/** A feature visibility setting that determines when the compass is visible. */
showsCompass?: FeatureVisibility
/** A Boolean value that determines whether the user may zoom in and out on the map using pinch gestures or the zoom control. */
isZoomEnabled?: boolean
/** A Boolean value that determines whether to display a control for zooming in and zooming out on a map. */
showsZoomControl?: boolean
/** A Boolean value that determines whether the user may scroll the map with a pointing device or gestures on a touchscreen. */
isScrollEnabled?: boolean
/** A feature visibility setting that determines when the map's scale is displayed. */
showsScale?: FeatureVisibility
/** A delegate method for modifying cluster annotations. */
annotationForCluster?: (clusterAnnotation: Annotation) => void | Annotation
/** An array of all the annotations on the map. */
annotations?: Annotation[]
/** The annotation on the map that is selected. */
selectedAnnotation?: Annotation
/** An array of all of the map's overlays. */
overlays?: Overlay[]
/** The overlay on the map that is selected. */
selectedOverlay?: Overlay
/** A Boolean value that determines whether the map displays points of interest. */
showsPointsOfInterest?: boolean
/** A Boolean value that determines whether to show the user's location on the map. */
showsUserLocation?: boolean
/** A Boolean value that determines whether to center the map on the user's location. */
tracksUserLocation?: boolean
/** A Boolean value that determines whether the user location control is visible. */
showsUserLocationControl?: boolean
}
declare class MapEvent extends Event
{
/* Just in case Apple adds more properties to Map events. */
}
declare class OverlayEvent extends Event
{
overlay: Overlay
}
declare class UserLocationChangeEvent extends Event
{
coordinate: Coordinate
timestamp: Date
}
declare enum LocationError
{
PERMISSION_DENIED = 1,
POSITION_UNAVAILABLE = 2,
TIMEOUT = 3,
MAPKIT_NOT_INITIALIZED = 4
}
declare class UserLocationErrorEvent implements MapKitError
{
code: LocationError
message: string
}
interface MapEventTypes extends SelectEventTypes, AnnotationEventWithoutSelectTypes, OverlayEventWithoutSelectTypes
{
"region-change-start": MapEvent
"region-change-end": MapEvent
"scroll-start": MapEvent
"scroll-end": MapEvent
"zoom-start": MapEvent
"zoom-end": MapEvent
"map-type-change": MapEvent
"user-location-change": UserLocationChangeEvent
"user-location-error": UserLocationErrorEvent
}
/** An embeddable interactive map that you add to a webpage. */
export class Map extends MapKitEvented<MapEventTypes>
{
/** Creates a map that you embed on a webpage, and initializes its display properties and other options. */
constructor(parent?: string | HTMLElement, options?: MapConstructorOptions)
/** A Boolean value that indicates if map rotation is available. */
isRotationAvailable: boolean
/** A Boolean value that determines whether the user may rotate the map using the compass control or a rotate gesture. */
isRotationEnabled: boolean
/** A Boolean value that determines whether the user may scroll the map with a pointing device or with gestures on a touchscreen. */
isScrollEnabled: boolean
/** A Boolean value that determines whether the user may zoom in and out on the map using pinch gestures or the zoom control. */
isZoomEnabled: boolean
/** The map coordinate at the center of the map view. */
center: Coordinate
/** Centers the map to the provided coordinate, with optional animation. */
setCenterAnimated(coordinate: Coordinate, animate?: boolean): Map
/** The area currently displayed by the map. */
region: CoordinateRegion
/** Changes the map's region to the region provided, with optional animation. */
setRegionAnimated(egion: CoordinateRegion, animate?: boolean): Map
/** The map's rotation, in degrees. */
rotation: number
/** Changes the map's rotation setting to the number of degrees specified. */
setRotationAnimated(degrees: number, animate?: boolean): Map
/** The visible area of the map defined in map units. */
visibleMapRect: MapRect
/** Changes the map's visible map rectangle to the specified map rectangle. */
setVisibleMapRectAnimated(mapRect: MapRect, animate?: boolean): Map
/** The map’s color scheme when displaying standard or muted standard map types. */
colorScheme: Map.ColorSchemes
/** The system of measurement displayed on the map. */
distances: Map.Distances
/** The type of data displayed by the map view. */
mapType: Map.MapTypes
/** The map's inset margins. */
padding: Padding
/** A feature visibility setting that determines when the compass is visible. */
showsCompass: FeatureVisibility
/** A Boolean value that determines whether to display a control that lets users choose the map type. */
showsMapTypeControl: boolean
/** A Boolean value that determines whether to display a control for zooming in and zooming out on a map. */
showsZoomControl: boolean
/** A Boolean value that determines whether the user location control is visible. */
showsUserLocationControl: boolean
/** A Boolean value that determines whether the map displays points of interest. */
showsPointsOfInterest: boolean
/** A feature visibility setting that determines when the map's scale is displayed. */
showsScale: FeatureVisibility
/** The CSS color that is used to paint the user interface controls on the map. */
tintColor: string
/** Adjusts the map's visible region to bring the specified overlays and annotations into view. */
showItems(items: (Annotation | Overlay)[], options?: MapShowItemsOptions): (Annotation | Overlay)[]
/** A delegate method for modifying cluster annotations. */
annotationForCluster?: (clusterAnnotation: Annotation) => void | Annotation
/** An array of all the annotations on the map. */
annotations?: Annotation[]
/** The annotation on the map that is selected. */
selectedAnnotation: Annotation | null
/** Returns the list of annotation objects located in the specified map rectangle. */
annotationsInMapRect(mapRect: MapRect): Annotation[]
/** Adds an annotation to the map. */
addAnnotation(annotation: Annotation): Annotation
/** Adds multiple annotations to the map. */
addAnnotations(annotations: Annotation[]): Annotation[]
/** Removes an annotation from the map. */
removeAnnotation(annotation: Annotation): Annotation
/** Removes multiple annotations from the map. */
removeAnnotations(annotations: Annotation[]): Annotation[]
/** An array of all of the map's overlays. */
overlays: Overlay[]
/** The overlay on the map that is selected. */
selectedOverlay: Overlay | null
/** Returns an array of overlays at a given point on the webpage. */
overlaysAtPoint(point: DOMPoint): Overlay[]
/** Adds an overlay to the map. */
addOverlay(overlay: Overlay): Overlay
/** Adds multiple overlays to the map. */
addOverlays(overlays: Overlay[]): Overlay[]
/** Removes an overlay from the map. */
removeOverlay(overlay: Overlay): Overlay
/** Removes multiple overlays from the map. */
removeOverlays(overlays: Overlay[]): Overlay[]
/** Returns the topmost overlay at a given point on the webpage. */
topOverlayAtPoint(point: DOMPoint): Overlay
/** An array of all of the map's tile overlays. */
tileOverlays: TileOverlay[]
/** Adds a tile overlay to the map. */
addTileOverlay(overlay: TileOverlay): TileOverlay
/** Adds an array of tile overlays to the map. */
addTileOverlays(overlays: TileOverlay[]): TileOverlay[]
/** Removes a tile overlay from the map. */
removeTileOverlay(overlay: TileOverlay): TileOverlay
/** Removes an array of tile overlays from the map. */
removeTileOverlays(overlays: TileOverlay[]): TileOverlay[]
/** A Boolean value that determines whether to show the user's location on the map. */
showsUserLocation: boolean
/** A Boolean value that determines whether to center the map on the user's location. */
tracksUserLocation: boolean
/** An annotation that indicates the user's location on the map. */
userLocationAnnotation: Annotation | null
/** Converts a coordinate on the map to a point in the page's coordinate system. */
convertCoordinateToPointOnPage(coordinate: Coordinate): DOMPoint
/** Converts a point in page coordinates to the corresponding map coordinate. */
convertPointOnPageToCoordinate(point: DOMPoint): Coordinate
/** Removes the map's element from the DOM and releases internal references to this map to free up memory. */
destroy(): void
/** The map's DOM element. */
element: HTMLElement
}
export namespace Map
{
/** Constants representing the type of map to display. */
export enum MapTypes
{
/** A satellite image of the area with road and road name information layered on top. */
Hybrid = 'Hybrid',
/** Satellite imagery of the area. */
Satellite = 'Satellite',
/** A street map that shows the position of all roads and some road names. */
Standard = 'Standard',
/** In this style, map features are less prominent, which allows user features such as annotations and overlays to stand out by comparison. */
MutedStandard = 'MutedStandard'
}
/** Constants indicating the color scheme of the map. */
export enum ColorSchemes
{
/** A constant indicating a light color scheme. */
Light = 'Light',
/** A constant indicating a dark color scheme. */
Dark = 'Dark'
}
/** Constants indicating the system of measurement displayed on the map. */
export enum Distances
{
/** A constant indicating the measurement system is adaptive, and determined based on the map's language. */
Adaptive = 'Adaptive',
/** A constant indicating the measurement system is metric. */
Metric = 'Metric',
/** A constant indicating the measurement system is imperial. */
Imperial = 'Imperial'
}
}
/** Options that determine map parameters used when showing items. */
export interface MapShowItemsOptions
{
/** A Boolean value that determines whether the map is animated as the map region changes to show the items. */
animate?: boolean
/** The minimum longitudinal and latitudinal span the map should display. */
minimumSpan?: CoordinateSpan
/** Spacing that is added around the computed map region when showing items. */
padding: Padding
}
/** A location on a map when the Earth's surface is projected onto a two-dimensional surface. */
export class MapPoint
{
/** Initializes a mapkit.MapPoint object. */
constructor(x: number, y: number)
/** The location of the point along the x-axis of the map. */
x: number
/** The location of the point along the y-axis of the map. */
y: number
/** Returns a copy of a map point. */
copy(): MapPoint
/** Indicates whether two map points are equal. */
equals(other: MapPoint): boolean
/** Returns a coorindate containing the latitude and longitude corresponding to a map point. */
toCoordinate(): Coordinate
}
/** A pair of values in map units that define the width and height of a projected coordinate span. */
export class MapSize
{
/** Initializes a mapkit.MapSize object. */
constructor(width: number, height: number)
/** The width value, in map point units. */
width: number
/** The height value, in map point units. */
height: number
/** Returns a copy of a map size. */
copy: MapSize
/** Indicates whether two map sizes are equal. */
equals(anotherSize: MapSize): boolean
}
/** A rectangular area on a two-dimensional map projection. */
export class MapRect
{
/** Initializes a mapkit.MapRect object. */
constructor(x: number, y: number, width: number, height: number)
/** The origin point of a rectangle. */
origin: MapPoint
/** The width and height of a rectangle, starting from the origin point. */
size: MapSize
/** The maximum x-axis value of a rectangle. */
maxX: number
/** The maximum y-axis value of a rectangle. */
maxY: number
/** The mid-point along the x-axis of a rectangle. */
midX: number
/** The mid-point along the y-axis of a rectangle.*/
midY: number
/** The minimum x-axis value of a rectangle. */
minX: number
/** The minimum y-axis value of a rectangle. */
minY: number
/** Returns a copy of a map rectangle. */
copy(): MapRect
/** Indicates whether two map rectangles are equal. */
equals(other: MapRect): boolean
// NOTE: Apple doesn't have a short description for this function in their documentation
scale(scaleFactor: number, scaleCenter: MapPoint): MapRect
/** Returns the region that corresponds to a map rectangle. */
toCoordinateRegion(): CoordinateRegion
}
/** A rectangular area on a map defined by a center coordinate and a span, expressed in degrees of latitude and longitude. */
export class CoordinateRegion
{
/** A rectangular geographic region centered around a latitude and longitude coordinate. */
constructor(center: Coordinate, span: CoordinateSpan)
/** The center point of the region. */
center: Coordinate
/** The horizontal and vertical span representing the amount of map to display. */
span: CoordinateSpan
/** Returns a copy of this region. */
copy(): CoordinateRegion
/** Returns a Boolean value indicating whether two regions are equal. */
equals(other: CoordinateRegion): boolean
/** Returns the bounding region that corresponds to this region. */
toBoundingRegion(): BoundingRegion
/** Returns the map rectangle that corresponds to the region. */
toMapRect(): MapRect
}
/** The width and height of a map region. */
export class CoordinateSpan
{
/** Creates a new coordinate span object with the specified latitude and longitude deltas. */
constructor(latitudeDelta: number, longitudeDelta: number)
/** The amount of north-to-south distance (measured in degrees) to display on the map. */
latitudeDelta: number
/** The amount of east-to-west distance (measured in degrees) to display for the map region. */
longitudeDelta: number
/** Returns a copy of the coordinate span. */
copy(): CoordinateSpan
/** Returns a Boolean value that indicates whether two spans are equal. */
equals(other: CoordinateSpan): boolean
}
/** A rectangular area on a map, defined by coordinates of the rectangle's northeast and southwest corners. */
export class BoundingRegion
{
/** Creates a rectangular bounding region defined by the latitude and longitude coordinates of the rectangle's northeast and southwest corners. */
constructor( northLatitude: number, eastLongitude: number, southLatitude: number, westLongitude: number)
/** The north latitude of the bounding region. */
northLatitude: number
/** The east longitude of the bounding region. */
eastLongitude: number
/** The south latitude of the bounding region. */
southLatitude: number
/** The west longitude of the bounding region. */
westLongitude: number
/** Returns a copy of the calling bounding region. */
copy(): BoundingRegion
/** Returns the coordinate region that corresponds to the calling bounding region. */
toCoordinateRegion(): CoordinateRegion
}
/** Initial values of the edge insets for padding. */
export interface PaddingConstructorOptions
{
/** The amount of padding, in CSS pixels, to inset the map from the bottom edge. */
bottom: number
/** The amount of padding, in CSS pixels, to inset the map from the left edge. */
left: number
/** The amount of padding, in CSS pixels, to inset the map from the right edge. */
right: number
/** The amount of padding, in CSS pixels, to inset the map from the top edge. */
top: number
}
/** The values that define content padding within the map view frame. */
export class Padding
{
/** Creates a padding object, and initializes its inset margin properties. */
constructor(options?: PaddingConstructorOptions|number[] )
/** The amount of padding, in CSS pixels, to inset the map from the bottom edge. */
bottom: number
/** The amount of padding, in CSS pixels, to inset the map from the left edge. */
left: number
/** The amount of padding, in CSS pixels, to inset the map from the right edge. */
right: number
/** The amount of padding, in CSS pixels, to inset the map from the top edge. */
top: number
}
/** An object that contains options for initializing annotation features. */
export interface AnnotationConstructorOptions
{
/** Data that you define that is assigned to the annotation. */
data?: any
/** The text to display in the annotation's callout. */
title?: string
/** The text to display as a subtitle, on the second line of an annotation's callout. */
subtitle?: string
/** The offset in CSS pixels of the element from the bottom center. */
anchorOffset?: DOMPoint
/** A CSS animation that runs when the annotation appears on the map. */
appearanceAnimation?: string
/** A hint that provides the priority of displaying the annotation. */
displayPriority?: number
/** The desired dimensions of the annotation, in CSS pixels. */
size?: { height: number, width: number }
/** A Boolean value that determines if the annotation is visible or hidden. */
visible?: boolean
/** A Boolean value that determines if the annotation should be animated. */
animates?: boolean
/** A Boolean value that determines whether the user can drag the annotation. */
draggable?: boolean
/** A Boolean value that determines whether the annotation responds to user interaction. */
enabled?: boolean
/** A Boolean value that determines whether the annotation is selected. */
selected?: boolean
/** A delegate that enables you to customize the callout for the annotation. */
callout?: AnnotationCalloutDelegate
/** A Boolean value that determines whether a callout should be shown. */
calloutEnabled?: boolean
/** The offset in CSS pixels of a callout from the top center of the element. */
calloutOffset?: DOMPoint
/** An identifer used for grouping annotations into the same cluster. */
clusteringIdentifier?: string
/** A mode that determines the shape of the collision frame. */
collisionMode?: Annotation.CollisionMode
/** Accessibility text for the annotation. */
accessibilityLabel?: string
}
declare class AnnotationEvent extends Event
{
annotation: Annotation
}
interface AnnotationEventWithoutSelectTypes
{
/*
* This type is inherited by MapEventTypes, so if adding an event here,
* double check that it is also listenable as an event on Map objects.
*/
"drag-start": AnnotationEvent
"dragging": AnnotationEvent
"drag-end": AnnotationEvent
}
interface AnnotationEventTypes extends SelectEventTypes, AnnotationEventWithoutSelectTypes
{
"select": AnnotationEvent
"deselect": AnnotationEvent
}
/**
* The base object for annotations, used when creating custom annotations.
*/
export class Annotation extends MapKitEvented<AnnotationEventTypes>
{
/** Creates a new annotation given its location and initialization options. */
constructor(coordinate: Coordinate, factory: Function, options?: AnnotationConstructorOptions)
/** The annotation's coordinate. */
coordinate: Coordinate
/** Data that you define that is assigned to the annotation. */
data: any
/** The text to display in the annotation's callout. */
title: string
/** The text to display as a subtitle, on the second line of an annotation's callout. */
subtitle: string
/** An offset that changes the annotation's default anchor point. */
anchorOffset: DOMPoint
/** A CSS animation that runs when the annotation appears on the map. */
appearanceAnimation: string
/** A numeric hint the map uses to prioritize displaying annotations. */
displayPriority: number
/** The desired dimensions of the annotation, in CSS pixels. */
size: { height: number, width: number }
/** A Boolean value that determines if the annotation is visible or hidden. */
visible: boolean
/** A Boolean value that determines if the annotation should be animated. */
animates: boolean
/** A Boolean value that determines whether the user can drag the annotation. */
draggable: boolean
/** A Boolean value indicating whether the annotation is selected. */
selected: boolean
/** A Boolean value that determines whether the annotation responds to user interaction. */
enabled: boolean
/** The map to which the annotation was added. */
map: Map
/** The annotation's element in the DOM. */
element: HTMLElement
/** A delegate that enables you to customize the annotation's callout. */
callout: AnnotationCalloutDelegate
/** A Boolean value that determines whether an annotation's callout should be shown. */
calloutEnabled: boolean
/** An offset that changes the annotation callout's default placement. */
calloutOffset: DOMPoint
/** An array of annotations that are grouped together in a cluster. */
memberAnnotations: Annotation[]
/** An identifer used for grouping annotations into the same cluster. */
clusteringIdentifier: string
/** A mode that determines the shape of the collision frame. */
collisionMode: Annotation.CollisionMode
/** Accessibility text for the annotation. */
accessibilityLabel: string
}
export namespace Annotation
{
/** Constant values used to provide a hint the map uses to prioritize displaying annotations. */
export enum DisplayPriority
{
/** A low display priority, with a preset value of 250 out of 1000. */
Low = 250,
/** A high display priority, with a preset value of 750 out of 1000. */
High = 750,
/** The highest display priority, with a preset value of 1000 out of 1000. */
Required = 1000
}
/** Constants indicating how to interpret the collision frame rectangle of an annotation view. */
export enum CollisionMode
{
/** A constant indicating that a circle inscribed in the collision frame rectangle should be used to determine collisions. */
Circle = 'Circle',
/** A constant indicating that the full collision rectangle should be used for detecting collisions. */
Rectangle = 'Rectangle'
}
}
/** An object with URLs to images to be shown at standard, 2x, and 3x Retina screen types */
interface DisplayAsset
{
/** A URL to an image shown at standard screen densities. The dimensions should be 20 x 20 pixels. */
1: string,
/** An optional URL to be shown at 2x screen densities. The dimensions should be 40 x 40 pixels. */
2?: string,
/** An optional URL to be shown at 3x screen densities. The dimensions should be 60 x 60 pixels. */
3?: string,
}
/** An annotation that displays a balloon-shaped marker at the designated location. */
export class MarkerAnnotation extends Annotation
{
/** Creates a marker annotation at the coordinate location with provided options. */
constructor(coordinate: Coordinate, options?: MarkerAnnotationConstructorOptions)
/** The fill color of the marker. */
color: string
/** The fill color of the glyph. */
glyphColor: string
/** The images to display in the marker. */
glyphImage: DisplayAsset
/** The text to display in the marker. */
glyphText: string
/** The images to display in the balloon when the user selects the annotation. */
selectedGlyphImage: DisplayAsset
/** A value that determines when the subtitle is visible. */
subtitleVisibility: FeatureVisibility
/** A value that determines when the title is visible. */
titleVisibility: FeatureVisibility
}
/** An object containing the options that initialize a marker annotation. */
export interface MarkerAnnotationConstructorOptions extends AnnotationConstructorOptions
{
/** The fill color of the marker. */
color?: string
/** The fill color of the glyph. */
glyphColor?: string
/** The images to display in the marker. */
glyphImage?: DisplayAsset
/** The text to display in the marker. */
glyphText?: string
/** The images to display in the balloon when the user selects the annotation. */
selectedGlyphImage?: DisplayAsset
/** A value that determines when the subtitle is visible. */
subtitleVisibility?: FeatureVisibility
/** A value that determines when the title is visible. */
titleVisibility?: FeatureVisibility
}
/** A customized annotation with image resources that you provide. */
export class ImageAnnotation extends Annotation
{
/** Initializes an image annotation with a URL to its image and a coordinate. */
constructor(coordinate: Coordinate, options?: ImageAnnotationConstructorOptions)
/** An object containing URLs for the image assets in multiple resolutions. */
url: DisplayAsset
}
/** An object containing options for initializing an image annotation. */
export interface ImageAnnotationConstructorOptions extends AnnotationConstructorOptions
{
/** An object containing URLs for the image assets in multiple resolutions. */
url: DisplayAsset
}
/** Constants indicating the visibility of different adaptive map features. */
export enum FeatureVisibility
{
/** Indicates that a map feature adapts to the current map state. */
Adaptive = 'Adaptive',
/** Indicates that a map feature is always hidden */
Hidden = 'Hidden',
/** Indicates that a map feature is always visible. */
Visible = 'Visible'
}
export interface AnnotationCalloutDelegate
{
/** Returns a point determining the callout's anchor offset. */
calloutAnchorOffsetForAnnotation(annotation: Annotation, size: {width: number, height: number}): DOMPoint
/** Determines whether the callout should appear for an annotation. */
calloutShouldAppearForAnnotation(annotation: Annotation): boolean
/** Determines whether the callout should animate. */
calloutShouldAnimateForAnnotation(annotation: Annotation): boolean
/** Returns a CSS animation used when the callout appears. */
calloutAppearanceAnimationForAnnotation(annotation: Annotation): string
/** Returns custom content for the callout bubble. */
calloutContentForAnnotation(annotation: Annotation): HTMLElement
/** Returns an element representing a custom callout. */
calloutElementForAnnotation(annotation: Annotation): HTMLElement
/** Returns an element used as a custom accessory on the left side of the callout content area. */
calloutLeftAccessoryForAnnotation(annotation: Annotation): HTMLElement
/** Returns an element used as a custom accessory on the right side of the callout content area. */
calloutRightAccessoryForAnnotation(annotation: Annotation): HTMLElement
}
declare enum FillOpacityRule
{
NonZero = "nonzero",
EvenOdd = "evenodd"
}
declare enum LineCapStyle
{
Butt = "butt",
Round = "round",
Square = "square"
}
declare enum LineJoinStyle
{
Miter = "miter",
Round = "round",
Bevel = "bevel"
}
/** Initial values of options for applying style to overlays. */
export interface StyleConstructorOptions
{
/** The fill color of a shape. */
fillColor?: string | null
/** The opacity of the fill color. */
fillOpacity?: number
/** A rule for determining whether a point is inside or outside a polygon. */
fillRule?: FillOpacityRule
/** The style to use when drawing line endings. */
lineCap?: LineCapStyle
/** An array of line and gap lengths, used to create a dashed line. */
lineDash?: number[]
/** The number of CSS pixels to offset drawing of a line's dash pattern. */
lineDashOffset?: number