gistda-sphere-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +827 -0
- package/dist/index.d.mts +1081 -0
- package/dist/index.d.ts +1081 -0
- package/dist/index.js +2057 -0
- package/dist/index.mjs +2013 -0
- package/package.json +70 -0
- package/src/__tests__/Layer.test.tsx +133 -0
- package/src/__tests__/Marker.test.tsx +183 -0
- package/src/__tests__/SphereContext.test.tsx +120 -0
- package/src/__tests__/SphereMap.test.tsx +240 -0
- package/src/__tests__/geometry.test.tsx +454 -0
- package/src/__tests__/hooks.test.tsx +173 -0
- package/src/__tests__/setup.ts +204 -0
- package/src/__tests__/useMapControls.test.tsx +168 -0
- package/src/__tests__/useOverlays.test.tsx +265 -0
- package/src/__tests__/useRoute.test.tsx +219 -0
- package/src/__tests__/useSearch.test.tsx +205 -0
- package/src/__tests__/useTags.test.tsx +179 -0
- package/src/components/Circle.tsx +189 -0
- package/src/components/Dot.tsx +150 -0
- package/src/components/Layer.tsx +177 -0
- package/src/components/Marker.tsx +204 -0
- package/src/components/Polygon.tsx +223 -0
- package/src/components/Polyline.tsx +211 -0
- package/src/components/Popup.tsx +130 -0
- package/src/components/Rectangle.tsx +194 -0
- package/src/components/SphereMap.tsx +315 -0
- package/src/components/index.ts +18 -0
- package/src/context/MapContext.tsx +41 -0
- package/src/context/SphereContext.tsx +348 -0
- package/src/context/index.ts +15 -0
- package/src/hooks/index.ts +42 -0
- package/src/hooks/useMapEvent.ts +66 -0
- package/src/hooks/useOverlays.ts +278 -0
- package/src/hooks/useRoute.ts +232 -0
- package/src/hooks/useSearch.ts +143 -0
- package/src/hooks/useSphere.ts +18 -0
- package/src/hooks/useTags.ts +129 -0
- package/src/index.ts +124 -0
- package/src/types/index.ts +1 -0
- package/src/types/sphere.ts +671 -0
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
export interface Location {
|
|
2
|
+
lon: number;
|
|
3
|
+
lat: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface Point {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Range {
|
|
12
|
+
min: number;
|
|
13
|
+
max: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface Bound {
|
|
17
|
+
minLon: number;
|
|
18
|
+
minLat: number;
|
|
19
|
+
maxLon: number;
|
|
20
|
+
maxLat: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Size {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Tile {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
z: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Icon {
|
|
35
|
+
url?: string;
|
|
36
|
+
urlHD?: string;
|
|
37
|
+
html?: string;
|
|
38
|
+
offset?: Point;
|
|
39
|
+
size?: Size;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type LayerType =
|
|
43
|
+
| "Vector"
|
|
44
|
+
| "XYZ"
|
|
45
|
+
| "WMS"
|
|
46
|
+
| "WMTS"
|
|
47
|
+
| "WMTS_REST"
|
|
48
|
+
| "TMS"
|
|
49
|
+
| "Tiles3D"
|
|
50
|
+
| "I3S";
|
|
51
|
+
|
|
52
|
+
export type BuiltInLayer =
|
|
53
|
+
| "SIMPLE"
|
|
54
|
+
| "STREETS"
|
|
55
|
+
| "STREETS_NIGHT"
|
|
56
|
+
| "HYBRID"
|
|
57
|
+
| "TRAFFIC"
|
|
58
|
+
| "IMAGES"
|
|
59
|
+
| "PM25"
|
|
60
|
+
| "HOTSPOT"
|
|
61
|
+
| "FLOOD"
|
|
62
|
+
| "DROUGHT";
|
|
63
|
+
|
|
64
|
+
export type FilterType =
|
|
65
|
+
| "Dark"
|
|
66
|
+
| "Light"
|
|
67
|
+
| "Protanopia"
|
|
68
|
+
| "Deuteranopia"
|
|
69
|
+
| "None";
|
|
70
|
+
|
|
71
|
+
export type LineStyleType = "Solid" | "Dashed" | "Dot";
|
|
72
|
+
|
|
73
|
+
export type UiComponentMode = "Full" | "Mobile" | "None";
|
|
74
|
+
|
|
75
|
+
export type RouteMode = "Traffic" | "Cost" | "Distance" | "Fly";
|
|
76
|
+
|
|
77
|
+
export type RouteType = "Road" | "Ferry" | "Tollway" | "All";
|
|
78
|
+
|
|
79
|
+
export type RouteLabelType = "Distance" | "Time" | "Hide";
|
|
80
|
+
|
|
81
|
+
export type TagType = "WFS" | "OGC";
|
|
82
|
+
|
|
83
|
+
export interface MapOptions {
|
|
84
|
+
layer?: SphereLayer | string;
|
|
85
|
+
zoom?: number;
|
|
86
|
+
zoomRange?: Range;
|
|
87
|
+
location?: Location;
|
|
88
|
+
placeholder?: HTMLElement;
|
|
89
|
+
ui?: UiComponentMode;
|
|
90
|
+
input?: boolean;
|
|
91
|
+
lastView?: boolean;
|
|
92
|
+
language?: string;
|
|
93
|
+
[key: string]:
|
|
94
|
+
| SphereLayer
|
|
95
|
+
| string
|
|
96
|
+
| number
|
|
97
|
+
| boolean
|
|
98
|
+
| Range
|
|
99
|
+
| Location
|
|
100
|
+
| HTMLElement
|
|
101
|
+
| UiComponentMode
|
|
102
|
+
| undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface LayerOptions {
|
|
106
|
+
type?: LayerType;
|
|
107
|
+
url?: string;
|
|
108
|
+
zoomRange?: Range;
|
|
109
|
+
source?: Range;
|
|
110
|
+
opacity?: number;
|
|
111
|
+
zIndex?: number;
|
|
112
|
+
bound?: Bound;
|
|
113
|
+
attribution?: string;
|
|
114
|
+
extraQuery?: string;
|
|
115
|
+
id?: string;
|
|
116
|
+
format?: string;
|
|
117
|
+
srs?: string;
|
|
118
|
+
tileMatrixPrefix?: string;
|
|
119
|
+
styles?: string;
|
|
120
|
+
version?: string;
|
|
121
|
+
refresh?: number;
|
|
122
|
+
zoomOffset?: number;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface MarkerOptions {
|
|
126
|
+
icon?: Icon;
|
|
127
|
+
title?: string;
|
|
128
|
+
detail?: string;
|
|
129
|
+
popup?: PopupOptions;
|
|
130
|
+
visibleRange?: Range;
|
|
131
|
+
clickable?: boolean;
|
|
132
|
+
draggable?: boolean;
|
|
133
|
+
zIndex?: number;
|
|
134
|
+
rotate?: number;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface PopupOptions {
|
|
138
|
+
title?: string;
|
|
139
|
+
detail?: string;
|
|
140
|
+
loadDetail?: (element: HTMLElement) => void;
|
|
141
|
+
html?: string;
|
|
142
|
+
loadHtml?: (element: HTMLElement) => void;
|
|
143
|
+
size?: Size;
|
|
144
|
+
closable?: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface GeometryOptions {
|
|
148
|
+
title?: string;
|
|
149
|
+
detail?: string;
|
|
150
|
+
label?: string;
|
|
151
|
+
labelOptions?: MarkerOptions;
|
|
152
|
+
popup?: PopupOptions;
|
|
153
|
+
visibleRange?: Range;
|
|
154
|
+
lineWidth?: number;
|
|
155
|
+
lineColor?: string;
|
|
156
|
+
fillColor?: string;
|
|
157
|
+
lineStyle?: LineStyleType;
|
|
158
|
+
pivot?: Location | (() => Location);
|
|
159
|
+
clickable?: boolean;
|
|
160
|
+
draggable?: boolean;
|
|
161
|
+
pointer?: boolean;
|
|
162
|
+
zIndex?: number;
|
|
163
|
+
editable?: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface TagOptions {
|
|
167
|
+
source?: string;
|
|
168
|
+
type?: TagType;
|
|
169
|
+
icon?: Icon | "big" | "small";
|
|
170
|
+
visibleRange?: Range;
|
|
171
|
+
label?: Range;
|
|
172
|
+
area?: string;
|
|
173
|
+
dataset?: string;
|
|
174
|
+
name?: string;
|
|
175
|
+
extraQuery?: string;
|
|
176
|
+
version?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface SearchOptions {
|
|
180
|
+
area?: string;
|
|
181
|
+
tag?: string;
|
|
182
|
+
span?: string;
|
|
183
|
+
offset?: number;
|
|
184
|
+
limit?: number;
|
|
185
|
+
dataset?: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface SuggestOptions {
|
|
189
|
+
area?: string;
|
|
190
|
+
offset?: number;
|
|
191
|
+
limit?: number;
|
|
192
|
+
dataset?: string;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface AddressOptions {
|
|
196
|
+
limit?: number;
|
|
197
|
+
dataset?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface NearPoiOptions {
|
|
201
|
+
span?: number;
|
|
202
|
+
zoom?: number;
|
|
203
|
+
limit?: number;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export type EventName =
|
|
207
|
+
| "ready"
|
|
208
|
+
| "resize"
|
|
209
|
+
| "repaint"
|
|
210
|
+
| "zoom"
|
|
211
|
+
| "zoomRange"
|
|
212
|
+
| "location"
|
|
213
|
+
| "fullscreen"
|
|
214
|
+
| "rotate"
|
|
215
|
+
| "pitch"
|
|
216
|
+
| "toolbarChange"
|
|
217
|
+
| "drawCreate"
|
|
218
|
+
| "drawDelete"
|
|
219
|
+
| "tooltipChange"
|
|
220
|
+
| "beforeContextmenu"
|
|
221
|
+
| "contextmenu"
|
|
222
|
+
| "mousemove"
|
|
223
|
+
| "click"
|
|
224
|
+
| "doubleClick"
|
|
225
|
+
| "wheel"
|
|
226
|
+
| "drag"
|
|
227
|
+
| "drop"
|
|
228
|
+
| "idle"
|
|
229
|
+
| "layerChange"
|
|
230
|
+
| "tileLoading"
|
|
231
|
+
| "tileLoaded"
|
|
232
|
+
| "overlayChange"
|
|
233
|
+
| "overlayUpdate"
|
|
234
|
+
| "overlayClick"
|
|
235
|
+
| "overlayLoad"
|
|
236
|
+
| "overlayDrag"
|
|
237
|
+
| "overlayDrop"
|
|
238
|
+
| "overlayHover"
|
|
239
|
+
| "overlayLeave"
|
|
240
|
+
| "popupClose"
|
|
241
|
+
| "routeError"
|
|
242
|
+
| "routeComplete"
|
|
243
|
+
| "error";
|
|
244
|
+
|
|
245
|
+
// biome-ignore lint/suspicious/noConfusingVoidType: Event handlers can return void, undefined, or boolean
|
|
246
|
+
export type EventHandler<T = void> = (data: T) => void | undefined | boolean;
|
|
247
|
+
|
|
248
|
+
export interface OverlayClickEventData {
|
|
249
|
+
overlay: SphereOverlay;
|
|
250
|
+
location?: Location;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export type OverlayEventData = SphereOverlay;
|
|
254
|
+
|
|
255
|
+
export type PopupCloseEventData = SpherePopup;
|
|
256
|
+
|
|
257
|
+
export interface SphereEvent {
|
|
258
|
+
bind<T = unknown>(eventName: EventName, handler: EventHandler<T>): this;
|
|
259
|
+
unbind<T = unknown>(eventName: EventName, handler: EventHandler<T>): this;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface SphereLayer {
|
|
263
|
+
name(): string;
|
|
264
|
+
options(): LayerOptions;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface SphereLayerCollection {
|
|
268
|
+
language(value?: string): string | this;
|
|
269
|
+
setBase(layer: SphereLayer | object | string): this;
|
|
270
|
+
add(layer: SphereLayer | object, beforeId?: string): this;
|
|
271
|
+
remove(layer: SphereLayer | object): this;
|
|
272
|
+
clear(): this;
|
|
273
|
+
list(): object[];
|
|
274
|
+
size(): number;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface SphereOverlay {
|
|
278
|
+
location(
|
|
279
|
+
geojson?: Location | Location[] | object,
|
|
280
|
+
animate?: boolean
|
|
281
|
+
): Location | Location[] | this;
|
|
282
|
+
visibleRange(): Range;
|
|
283
|
+
active(): boolean;
|
|
284
|
+
shift(vector: Location): this;
|
|
285
|
+
distance(
|
|
286
|
+
overlay: Location | SphereOverlay,
|
|
287
|
+
language?: string
|
|
288
|
+
): number | string;
|
|
289
|
+
intersects(overlay: Location | SphereOverlay): boolean;
|
|
290
|
+
contains(overlay: Location | SphereOverlay): boolean;
|
|
291
|
+
within(overlay: Location | SphereOverlay): boolean;
|
|
292
|
+
toJSON(key?: string): object;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface SphereMarker extends SphereOverlay {
|
|
296
|
+
popup(): SpherePopup;
|
|
297
|
+
element(): HTMLElement;
|
|
298
|
+
pop(mode?: boolean): this;
|
|
299
|
+
update(newOptions: MarkerOptions): this;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export interface SpherePopup extends SphereOverlay {
|
|
303
|
+
element(): HTMLElement;
|
|
304
|
+
title(value?: string): HTMLElement | this;
|
|
305
|
+
detail(value?: string): HTMLElement | this;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface SpherePolyline extends SphereOverlay {
|
|
309
|
+
popup(): SpherePopup;
|
|
310
|
+
pop(mode?: boolean, location?: Location): this;
|
|
311
|
+
pivot(): Location;
|
|
312
|
+
centroid(): Location;
|
|
313
|
+
bound(): Bound;
|
|
314
|
+
update(newOptions: GeometryOptions): this;
|
|
315
|
+
rotate(angle: number): this;
|
|
316
|
+
size(language?: string): number | string;
|
|
317
|
+
union(overlay: SpherePolyline, options?: GeometryOptions): SpherePolyline;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface SpherePolygon extends SpherePolyline {
|
|
321
|
+
intersection(
|
|
322
|
+
overlay: SpherePolygon,
|
|
323
|
+
options?: GeometryOptions
|
|
324
|
+
): SpherePolygon;
|
|
325
|
+
difference(overlay: SpherePolygon, options?: GeometryOptions): SpherePolygon;
|
|
326
|
+
split(splitter: SpherePolygon, options?: GeometryOptions): SpherePolygon[];
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface SphereCircle extends SpherePolyline {
|
|
330
|
+
radius(language?: string): number | string;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface SphereDot extends SpherePolyline {}
|
|
334
|
+
|
|
335
|
+
export interface SphereRectangle extends SpherePolygon {}
|
|
336
|
+
|
|
337
|
+
export interface SphereOverlayCollection {
|
|
338
|
+
add(overlay: SphereOverlay): this;
|
|
339
|
+
remove(overlay: SphereOverlay): this;
|
|
340
|
+
load(mode: object): this;
|
|
341
|
+
unload(mode: object): this;
|
|
342
|
+
clear(): this;
|
|
343
|
+
list(): SphereOverlay[];
|
|
344
|
+
size(): number;
|
|
345
|
+
lastOpenPopup(): SpherePopup;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface SphereUiControl {
|
|
349
|
+
visible(state?: boolean): boolean | SphereUiControl;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export interface SphereContextMenu {
|
|
353
|
+
enableNearPoi(state?: boolean): boolean | SphereContextMenu;
|
|
354
|
+
enableAddress(state?: boolean): boolean | SphereContextMenu;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface SphereKeyboard {
|
|
358
|
+
enable(state?: boolean): boolean | SphereKeyboard;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface SphereMouse {
|
|
362
|
+
enable(state?: boolean): boolean | SphereMouse;
|
|
363
|
+
enableClick(state?: boolean): boolean | SphereMouse;
|
|
364
|
+
enableDrag(state?: boolean): boolean | SphereMouse;
|
|
365
|
+
enableWheel(state?: boolean): boolean | SphereMouse;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface SphereUiCollection {
|
|
369
|
+
DPad: SphereUiControl;
|
|
370
|
+
Geolocation: SphereUiControl;
|
|
371
|
+
Zoombar: SphereUiControl;
|
|
372
|
+
Toolbar: SphereUiControl;
|
|
373
|
+
LayerSelector: SphereUiControl;
|
|
374
|
+
Fullscreen: SphereUiControl;
|
|
375
|
+
Crosshair: SphereUiControl;
|
|
376
|
+
Scale: SphereUiControl;
|
|
377
|
+
ContextMenu: SphereContextMenu;
|
|
378
|
+
Keyboard: SphereKeyboard;
|
|
379
|
+
Mouse: SphereMouse;
|
|
380
|
+
language(value?: string): string | SphereUiCollection;
|
|
381
|
+
add(control: object): SphereUiCollection;
|
|
382
|
+
remove(control: object): SphereUiCollection;
|
|
383
|
+
lockMap(options?: object): SphereUiCollection;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export interface SphereSearch {
|
|
387
|
+
language(value?: string): string | this;
|
|
388
|
+
placeholder(value?: HTMLElement, options?: object): HTMLElement | this;
|
|
389
|
+
suggest(keyword: string, options?: SuggestOptions): Promise<object>;
|
|
390
|
+
search(keyword: string, options?: SearchOptions): Promise<object>;
|
|
391
|
+
address(location: Location, options?: AddressOptions): Promise<object>;
|
|
392
|
+
nearPoi(location: Location, options?: NearPoiOptions): Promise<object>;
|
|
393
|
+
clear(): this;
|
|
394
|
+
enablePopup(state?: boolean): boolean | this;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface SphereTagCollection {
|
|
398
|
+
language(value?: string): string | this;
|
|
399
|
+
set(tag: string | ((tile: Tile) => object[]), options?: TagOptions): this;
|
|
400
|
+
add(tag: string | ((tile: Tile) => object[]), options?: TagOptions): this;
|
|
401
|
+
remove(tag: string): this;
|
|
402
|
+
clear(): this;
|
|
403
|
+
list(): string[];
|
|
404
|
+
size(): number;
|
|
405
|
+
enablePopup(state?: boolean): boolean | this;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export interface SphereRoute {
|
|
409
|
+
language(value?: string): string | this;
|
|
410
|
+
placeholder(value?: HTMLElement): HTMLElement | this;
|
|
411
|
+
enableContextMenu(): this;
|
|
412
|
+
line(type: string, value?: GeometryOptions): GeometryOptions | this;
|
|
413
|
+
auto(state?: boolean): boolean | this;
|
|
414
|
+
mode(value?: RouteMode): RouteMode | this;
|
|
415
|
+
modeOf(index: number, value?: RouteMode): RouteMode | this;
|
|
416
|
+
enableRoute(routeType: RouteType, state?: boolean): boolean | this;
|
|
417
|
+
enableRestrict(routeRestrict: string, state?: boolean): boolean | this;
|
|
418
|
+
label(value?: RouteLabelType): RouteLabelType | this;
|
|
419
|
+
add(destination: SphereMarker | Location, mode?: RouteMode): this;
|
|
420
|
+
insert(
|
|
421
|
+
index: number,
|
|
422
|
+
destination: SphereMarker | Location,
|
|
423
|
+
mode?: RouteMode
|
|
424
|
+
): this;
|
|
425
|
+
remove(destination: SphereMarker): this;
|
|
426
|
+
removeAt(index: number): this;
|
|
427
|
+
clearDestination(): this;
|
|
428
|
+
clearPath(): this;
|
|
429
|
+
clear(): this;
|
|
430
|
+
list(): SphereMarker[];
|
|
431
|
+
size(): number;
|
|
432
|
+
reverse(): this;
|
|
433
|
+
search(): this;
|
|
434
|
+
distance(format?: boolean): number | string;
|
|
435
|
+
interval(format?: boolean): number | string;
|
|
436
|
+
guide(format?: boolean): object[] | HTMLElement;
|
|
437
|
+
exportRouteLine(options?: GeometryOptions): SpherePolyline;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export interface FlyToOptions {
|
|
441
|
+
center?: Location;
|
|
442
|
+
zoom?: number;
|
|
443
|
+
bearing?: number;
|
|
444
|
+
pitch?: number;
|
|
445
|
+
padding?: { top?: number; bottom?: number; left?: number; right?: number };
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface SphereMap {
|
|
449
|
+
Event: SphereEvent;
|
|
450
|
+
Layers: SphereLayerCollection;
|
|
451
|
+
Overlays: SphereOverlayCollection;
|
|
452
|
+
Ui: SphereUiCollection;
|
|
453
|
+
Search: SphereSearch;
|
|
454
|
+
Tags: SphereTagCollection;
|
|
455
|
+
Route: SphereRoute;
|
|
456
|
+
Renderer: {
|
|
457
|
+
on(event: string, handler: () => void): void;
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
id(): number;
|
|
461
|
+
resize(): this;
|
|
462
|
+
repaint(): this;
|
|
463
|
+
placeholder(): HTMLElement;
|
|
464
|
+
zoom(value?: number | boolean, animate?: boolean): number | this;
|
|
465
|
+
zoomRange(value?: Range): Range | this;
|
|
466
|
+
location(value?: Location, animate?: boolean): Location | this;
|
|
467
|
+
bound(value?: Bound, options?: object): Bound | this;
|
|
468
|
+
move(offset: Point, animate?: boolean): this;
|
|
469
|
+
language(value?: string): string | this;
|
|
470
|
+
rotate(angle?: number, animate?: boolean): number | this;
|
|
471
|
+
pitch(angle?: number): number | this;
|
|
472
|
+
enableFilter(filter?: FilterType | false): FilterType | false | this;
|
|
473
|
+
goTo(target: FlyToOptions, animate?: boolean): this;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export interface SphereNamespace {
|
|
477
|
+
Map: new (options?: MapOptions) => SphereMap;
|
|
478
|
+
Marker: new (
|
|
479
|
+
location: Location | object,
|
|
480
|
+
options?: MarkerOptions
|
|
481
|
+
) => SphereMarker;
|
|
482
|
+
Popup: new (
|
|
483
|
+
location: Location | object,
|
|
484
|
+
options?: PopupOptions
|
|
485
|
+
) => SpherePopup;
|
|
486
|
+
Polyline: new (
|
|
487
|
+
locationList: Location[] | object,
|
|
488
|
+
options?: GeometryOptions
|
|
489
|
+
) => SpherePolyline;
|
|
490
|
+
Polygon: new (
|
|
491
|
+
locationList: Location[] | object,
|
|
492
|
+
options?: GeometryOptions
|
|
493
|
+
) => SpherePolygon;
|
|
494
|
+
Circle: new (
|
|
495
|
+
location: Location | object,
|
|
496
|
+
radius: number,
|
|
497
|
+
options?: GeometryOptions
|
|
498
|
+
) => SphereCircle;
|
|
499
|
+
Dot: new (
|
|
500
|
+
location: Location | object,
|
|
501
|
+
options?: GeometryOptions
|
|
502
|
+
) => SphereDot;
|
|
503
|
+
Rectangle: new (
|
|
504
|
+
location: Location,
|
|
505
|
+
size: Size | Location,
|
|
506
|
+
options?: GeometryOptions
|
|
507
|
+
) => SphereRectangle;
|
|
508
|
+
Layer: new (name: string, options?: LayerOptions) => SphereLayer;
|
|
509
|
+
|
|
510
|
+
Layers: {
|
|
511
|
+
SIMPLE: SphereLayer;
|
|
512
|
+
STREETS: SphereLayer;
|
|
513
|
+
STREETS_NIGHT: SphereLayer;
|
|
514
|
+
HYBRID: SphereLayer;
|
|
515
|
+
TRAFFIC: SphereLayer;
|
|
516
|
+
IMAGES: SphereLayer;
|
|
517
|
+
PM25: SphereLayer;
|
|
518
|
+
HOTSPOT: SphereLayer;
|
|
519
|
+
FLOOD: SphereLayer;
|
|
520
|
+
DROUGHT: SphereLayer;
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
LayerType: {
|
|
524
|
+
Vector: string;
|
|
525
|
+
XYZ: string;
|
|
526
|
+
WMS: string;
|
|
527
|
+
WMTS: string;
|
|
528
|
+
WMTS_REST: string;
|
|
529
|
+
TMS: string;
|
|
530
|
+
Tiles3D: string;
|
|
531
|
+
I3S: string;
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
LineStyle: {
|
|
535
|
+
Solid: string;
|
|
536
|
+
Dashed: string;
|
|
537
|
+
Dot: string;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
Filter: {
|
|
541
|
+
Dark: FilterType;
|
|
542
|
+
Light: FilterType;
|
|
543
|
+
Protanopia: FilterType;
|
|
544
|
+
Deuteranopia: FilterType;
|
|
545
|
+
None: FilterType;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
EventName: Record<EventName, EventName>;
|
|
549
|
+
|
|
550
|
+
TagType: {
|
|
551
|
+
WFS: string;
|
|
552
|
+
OGC: string;
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
RouteMode: {
|
|
556
|
+
Traffic: string;
|
|
557
|
+
Cost: string;
|
|
558
|
+
Distance: string;
|
|
559
|
+
Fly: string;
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
RouteType: {
|
|
563
|
+
Road: string;
|
|
564
|
+
Ferry: string;
|
|
565
|
+
Tollway: string;
|
|
566
|
+
All: string;
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
RouteLabel: {
|
|
570
|
+
Distance: string;
|
|
571
|
+
Time: string;
|
|
572
|
+
Hide: string;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
Util: {
|
|
576
|
+
append(
|
|
577
|
+
element: HTMLElement,
|
|
578
|
+
childName: string,
|
|
579
|
+
propertyMap?: object
|
|
580
|
+
): HTMLElement;
|
|
581
|
+
prepend(
|
|
582
|
+
element: HTMLElement,
|
|
583
|
+
childName: string,
|
|
584
|
+
propertyMap?: object,
|
|
585
|
+
beforeElement?: HTMLElement
|
|
586
|
+
): HTMLElement;
|
|
587
|
+
empty(element: HTMLElement): HTMLElement;
|
|
588
|
+
loadStyle(url: string, media?: string): void;
|
|
589
|
+
loadScript(url: string, callback?: (isLoad: boolean) => void): void;
|
|
590
|
+
getJson(url: string): Promise<object>;
|
|
591
|
+
isHD(): number;
|
|
592
|
+
validateLocation(location: Location): boolean;
|
|
593
|
+
sameLocation(a: Location, b: Location): boolean;
|
|
594
|
+
longitudeLength(lat: number): number;
|
|
595
|
+
latitudeLength(lat: number): number;
|
|
596
|
+
isAbsInRange(value: number, range: number): boolean;
|
|
597
|
+
bound(value: number, min: number, max: number): number;
|
|
598
|
+
formatDate(date: string, language: string): string;
|
|
599
|
+
formatTime(time: string): string;
|
|
600
|
+
formatDateTimeRange(
|
|
601
|
+
startDatetime: string,
|
|
602
|
+
stopDatetime: string,
|
|
603
|
+
language: string
|
|
604
|
+
): string;
|
|
605
|
+
formatInterval(interval: number, language: string): string;
|
|
606
|
+
formatDistance(distance: number, language: string): string;
|
|
607
|
+
formatArea(area: number, language: string): string;
|
|
608
|
+
formatThaiArea(area: number, language: string): string;
|
|
609
|
+
initLibrary(library: string): Promise<void>;
|
|
610
|
+
project(
|
|
611
|
+
fromProjection: string | undefined,
|
|
612
|
+
toProjection: string,
|
|
613
|
+
coordinates: object | unknown[]
|
|
614
|
+
): object;
|
|
615
|
+
WKTToGeoJSON(text: string): object;
|
|
616
|
+
EsriJSONToGeoJSON(json: object): object;
|
|
617
|
+
TopoJSONToGeoJSON(json: object, obj: object | string): object;
|
|
618
|
+
GMLToGeoJSON(doc: Document | string): object;
|
|
619
|
+
GPXToGeoJSON(doc: Document | string): object;
|
|
620
|
+
KMLToGeoJSON(doc: Document | string): object;
|
|
621
|
+
formatPoi?: (poi: object, lang: string) => HTMLElement;
|
|
622
|
+
poiPopupOptions?: (
|
|
623
|
+
source: string,
|
|
624
|
+
id: string,
|
|
625
|
+
name: string,
|
|
626
|
+
language: string
|
|
627
|
+
) => PopupOptions;
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
Math: {
|
|
631
|
+
distance(dx: number, dy: number): number;
|
|
632
|
+
closestPointOnLine(
|
|
633
|
+
x: number,
|
|
634
|
+
y: number,
|
|
635
|
+
x1: number,
|
|
636
|
+
y1: number,
|
|
637
|
+
x2: number,
|
|
638
|
+
y2: number
|
|
639
|
+
): Point;
|
|
640
|
+
lineIntersectPoint(
|
|
641
|
+
x1: number,
|
|
642
|
+
y1: number,
|
|
643
|
+
x2: number,
|
|
644
|
+
y2: number,
|
|
645
|
+
u1: number,
|
|
646
|
+
v1: number,
|
|
647
|
+
u2: number,
|
|
648
|
+
v2: number,
|
|
649
|
+
skipOverlap?: boolean
|
|
650
|
+
): Point | number[] | null;
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
Overlays: {
|
|
654
|
+
cameras: { popup?: boolean; motion?: boolean };
|
|
655
|
+
events: { popup?: boolean };
|
|
656
|
+
aqi: { popup?: boolean };
|
|
657
|
+
Object: new (
|
|
658
|
+
id: string,
|
|
659
|
+
dataset?: string,
|
|
660
|
+
options?: object
|
|
661
|
+
) => SphereOverlay;
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
declare global {
|
|
666
|
+
interface Window {
|
|
667
|
+
sphere?: SphereNamespace;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export type { SphereNamespace as Sphere };
|