-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle_engine.js
65 lines (55 loc) · 1.53 KB
/
google_engine.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
57
58
59
60
61
62
63
64
65
function GoogleEngine() {
this.map = null
this.codename = "Google"
this.icon = "http://maps.google.com/favicon.ico"
this.maxZoom = 17
}
GoogleEngine.prototype = new Engine()
GoogleEngine.prototype.initialize = function(container) {
this.map = new GMap2(container)
return this.map
}
GoogleEngine.prototype.setOptions = function(options) {
if (options["zoomControl"]) {
this.map.addControl(new GSmallZoomControl3D())
}
if (options["moveControl"]) {
this.map.addControl(new GLargeMapControl3D())
}
if (options["typeControl"]) {
this.map.addControl(new GMapTypeControl())
}
if (options["scrollToZoom"]) {
this.map.enableScrollWheelZoom()
}
if (options["switchControl"]) {
this.addSwitchControl(new GoogleSwitchControl(this))
}
return this
}
GoogleEngine.prototype.getNativeControl = function() {
return this.map
}
GoogleEngine.prototype.addSwitchControlOnMap = function(switchControl) {
this.map.addControl(switchControl)
return this
}
GoogleEngine.prototype.removeSwitchControlFromMap = function(switchControl) {
this.map.removeControl(switchControl)
return this
}
GoogleEngine.prototype.getCenter = function() {
var gp = this.map.getCenter()
return new GeoPoint(gp.lat(), gp.lng())
}
GoogleEngine.prototype.setCenter = function(geopoint) {
this.map.setCenter(new GLatLng(geopoint.lat, geopoint.lng))
return this
}
GoogleEngine.prototype.getZoom = function() {
return this.map.getZoom()
}
GoogleEngine.prototype.setZoom = function(zoom) {
this.map.setZoom(zoom)
return this
}