-
Notifications
You must be signed in to change notification settings - Fork 0
/
google_service.js
57 lines (43 loc) · 1.36 KB
/
google_service.js
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
function newGoogleService() {
var Google = new Object();
Google.map = new Object();
Google.centerLatitude = 19.5;
Google.centerLongitude = -155.5;
Google.zoom = 9;
Google.addMarkerListener = function(marker, eventName, lambda) {
GEvent.addListener(marker, eventName, lambda);
}
Google.defaultMap = function() {
this.newMap("map");
this.addSmallMapControl();
this.centerMap();
}
Google.newMap = function(name) {
this.map = new GMap($(name));
}
Google.addToOverlay = function(obj) {
this.map.addOverlay(obj);
}
Google.removeFromOverlay = function(obj) {
this.map.removeOverlay(obj);
}
Google.addSmallMapControl = function() {
this.map.addControl(new GSmallMapControl());
}
Google.setMapCenter = function(lat, lng, zoom) {
this.map.setCenter(new GLatLng(lat, lng), zoom);
}
Google.centerMap = function() {
this.map.setCenter(new GLatLng(this.centerLatitude, this.centerLongitude), this.zoom);
}
Google.addNewMarkerToOverlay = function(lat, lng, id) {
var marker = new GMarker(new GLatLng(lat, lng));
this.addMarkerListener(marker, 'click',
function() {
focusPoint(id);
} );
this.addToOverlay(marker);
return marker;
}
return Google;
}