-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyandex_engine.js
65 lines (55 loc) · 1.53 KB
/
yandex_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 YandexEngine() {
this.map = null
this.maxZoom = 17
this.codename = "Yandex"
this.icon = "http://maps.yandex.ru/favicon.ico"
}
YandexEngine.prototype = new Engine()
YandexEngine.prototype.initialize = function(container) {
this.map = new YMaps.Map(container)
return this.map
}
YandexEngine.prototype.setOptions = function(options) {
if (options["zoomControl"]) {
this.map.addControl(new YMaps.Zoom)
}
if (options["moveControl"]) {
this.map.addControl(new YMaps.ToolBar())
}
if (options["typeControl"]) {
this.map.addControl(new YMaps.TypeControl())
}
if (options["scrollToZoom"]) {
this.map.enableScrollZoom()
}
if (options["switchControl"]) {
this.addSwitchControl(new YandexSwitchControl(this))
}
return this
}
YandexEngine.prototype.getNativeControl = function() {
return this.map
}
YandexEngine.prototype.addSwitchControlOnMap = function(switchControl) {
this.map.addControl(switchControl)
return this
}
YandexEngine.prototype.removeSwitchControlFromMap = function(switchControl) {
this.map.removeControl(switchControl)
return this
}
YandexEngine.prototype.getCenter = function() {
var gp = this.map.getCenter()
return new GeoPoint(gp.getY(), gp.getX())
}
YandexEngine.prototype.setCenter = function(geopoint) {
this.map.setCenter(new YMaps.GeoPoint(geopoint.lng, geopoint.lat))
return this
}
YandexEngine.prototype.getZoom = function() {
return this.map.getZoom()
}
YandexEngine.prototype.setZoom = function(zoom) {
this.map.setZoom(zoom)
return this
}