-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapInterface.ts
More file actions
105 lines (83 loc) · 2.25 KB
/
MapInterface.ts
File metadata and controls
105 lines (83 loc) · 2.25 KB
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
/**
* @project MyGPService v4
* @author Žan Kafol on 7.1.2019
*/
export interface MapInterface<M> {
API_KEY: string;
instance: M;
init (map: any, initialView: MapPosition): Promise<any>;
setCenter(newCenter: MapPosition): void;
panTo(position: MapPosition): void;
setZoom(zoom: number): void;
getZoom(): number;
fitBounds(bounds: MapPosition[]): void;
boundsContain(position: MapPosition): boolean;
setMapType(mapType: string): void;
addLayer(layer: any): any;
removeLayer(layer: any): void;
addTraffic(): any;
addMarker(options: MarkerOptions): any;
addInfoWindow(options: MarkerOptions, parent?: any): any;
addMarkerOverlay(position: MarkerOptions, offset?: MapPoint): any;
addPolyline(options: MapPolylineOptions): any;
onDrag(callback: Function): void;
geocode(pos: MapPosition): Promise<String>;
}
export interface MapPosition {
lat: number;
lon: number;
zoom?: number;
}
export interface MapLayer<L, M> {
map: MapInterface<M>;
instance: L;
listeners: {[key: string]: Function[]};
addListener(event: string, callback: Function): void;
}
export interface MapTrafficLayer<L, M> {
map: MapInterface<M>;
instance: L;
}
export interface MapMarker<L, M> extends MapLayer<L, M> {
setPosition(position: MapPosition): void;
getPosition(): MapPosition;
setIcon(icon: MarkerIcon): void;
setLabel(label: string): void;
}
export interface MapInfoWindow<L, M> extends MapLayer<L, M> {
setContent(content: string | HTMLElement);
setPosition(position: MapPosition): void;
setParent(parent: any): void;
getPosition(): MapPosition;
open(): void;
close(): void;
onClose(callback: Function): void;
}
export interface MapMarkerOverlay {
div: HTMLElement;
setPosition(position: MapPosition): void;
getPosition(): MapPosition;
}
export interface MapPolyline<L, M> extends MapLayer<L, M> {
setPath(path: MapPosition[]): void;
}
export interface MapPolylineOptions {
path?: MapPosition[];
color?: string;
opacity?: number;
weight?: number;
animated?: boolean;
}
export interface MapPoint {
x: number;
y: number;
}
export interface MarkerIcon {
url: string;
anchor?: MapPoint;
}
export interface MarkerOptions extends MapPosition {
icon?: MarkerIcon;
label?: string;
color?: string;
}