forked from Yermo/nativescript-mapbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapbox.d.ts
196 lines (171 loc) · 4.71 KB
/
mapbox.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
declare module "nativescript-mapbox" {
/**
* The allowed values for show.style
*/
enum MapStyle {
DARK,
OUTDOORS,
LIGHT,
SATELLITE,
HYBRID, // deprecated, use SATELLITE_STREETS
SATELLITE_STREETS,
STREETS
}
export interface LatLng {
lat: number;
lng: number;
}
export interface AddPolygonOptions {
points: LatLng[];
}
export interface AddMarkersOption extends LatLng {
title?: string;
subtitle?: string;
}
export interface SetZoomLevelOptions {
level: number;
animated: boolean;
}
export interface SetTiltOptions {
/**
* default 30 (degrees)
*/
pitch: number;
/**
* default 5000 (milliseconds)
*/
duration: number;
}
export interface ShowOptionsMargins {
left?: number;
right?: number;
top?: number;
bottom?: number;
}
export interface Bounds {
north: number;
east: number;
south: number;
west: number;
}
export interface Viewport {
bounds: Bounds;
zoomLevel: number;
}
export interface DeleteOfflineRegionOptions {
/**
* The name of the offline region to delete.
*/
name: string;
}
export interface ListOfflineRegionsOptions {
/**
* On Android you need to pass this in in case you haven't done so in a previous function (like 'show')
*/
accessToken?: string;
}
export interface OfflineRegion {
name: string;
bounds: Bounds;
minZoom: number;
maxZoom: number;
style: MapStyle;
}
export interface DownloadProgress {
name: string;
completed: number;
expected: number;
percentage: number;
complete: boolean;
/**
* Android only, the size in bytes of the download so far.
*/
completedSize?: number;
}
export interface DownloadOfflineRegionOptions extends OfflineRegion {
/**
* On Android you need to pass this in in case you haven't done so in a previous function (like 'show')
*/
accessToken?: string;
onProgress: (data: DownloadProgress) => void;
}
/**
* The options object passed into the show function.
*/
export interface ShowOptions {
accessToken: string;
/**
* default 'streets'
*/
style?: MapStyle;
margins?: ShowOptionsMargins;
center?: LatLng;
/**
* default 0 (which is almost the entire planet)
*/
zoomLevel?: number;
/**
* default false (true requires adding `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` to the .plist)
*/
showUserLocation?: boolean;
/**
* default false (required for the 'starter' plan)
*/
hideLogo?: boolean;
/**
* default true
*/
hideAttribution?: boolean;
/**
* default false
*/
hideCompass?: boolean;
/**
* default false
*/
disableRotation?: boolean;
/**
* default false
*/
disableScroll?: boolean;
/**
* default false
*/
disableZoom?: boolean;
/**
* default false
*/
disableTilt?: boolean;
}
export interface AnimateCameraOptions {
target: LatLng;
/**
* For Android, 0.0 - 20.0
*/
zoomLevel?: number;
/**
* For iOS, in meters from the ground
*/
altitude?: number;
bearing?: number;
tilt?: number;
duration?: number;
}
export function show(options: ShowOptions): Promise<any>;
export function hide(): Promise<any>;
export function addMarkers(markers: AddMarkersOption[]): Promise<any>;
export function setCenter(arg: LatLng): Promise<any>;
export function getCenter(): Promise<LatLng>;
export function setZoomLevel(arg: SetZoomLevelOptions): Promise<any>;
export function getZoomLevel(): Promise<number>;
export function setTilt(arg: SetTiltOptions): Promise<any>;
export function getTilt(): Promise<number>;
export function addPolygon(arg: AddPolygonOptions): Promise<any>;
export function animateCamera(arg: AnimateCameraOptions): Promise<any>;
export function requestFineLocationPermission(): Promise<any>;
export function hasFineLocationPermission(): Promise<boolean>;
export function getViewport(): Promise<Viewport>;
export function downloadOfflineRegion(arg: DownloadOfflineRegionOptions): Promise<any>;
export function listOfflineRegions(arg: ListOfflineRegionsOptions): Promise<Array<OfflineRegion>>;
export function deleteOfflineRegion(arg: DeleteOfflineRegionOptions): Promise<any>;
}