2014-12-29 12:17:40 +01:00
|
|
|
L.Contao = L.Class.extend( {
|
|
|
|
|
includes: L.Mixin.Events,
|
|
|
|
|
|
|
|
|
|
maps: {},
|
|
|
|
|
|
|
|
|
|
addMap: function (id, map) {
|
|
|
|
|
this.maps[id] = map;
|
|
|
|
|
|
2015-01-06 18:49:22 +01:00
|
|
|
this.fire('map:added', { id: id, map: map});
|
2014-12-29 12:17:40 +01:00
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getMap: function (id) {
|
2015-01-06 14:55:12 +01:00
|
|
|
if (typeof (this.maps[id]) === 'undefined') {
|
2014-12-29 12:17:40 +01:00
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-06 14:55:12 +01:00
|
|
|
return this.maps[id];
|
2015-01-06 18:49:22 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
pointToLayer: function(feature, latlng) {
|
|
|
|
|
var marker = L.marker(latlng, feature.properties.options);
|
|
|
|
|
|
|
|
|
|
this.applyFeatureMethods(marker, feature);
|
|
|
|
|
this.fire('marker:created', { marker: marker, feature: feature, latlng: latlng });
|
|
|
|
|
|
|
|
|
|
return marker;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
applyFeatureMethods: function(obj, feature) {
|
|
|
|
|
if (feature.properties && feature.properties.methods) {
|
|
|
|
|
for (var i=0; i < feature.properties.methods.length; i++) {
|
|
|
|
|
var method = feature.properties.methods[i];
|
|
|
|
|
|
|
|
|
|
obj[method[0]].apply(obj, method[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-29 12:17:40 +01:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-01-06 18:49:22 +01:00
|
|
|
L.Icon.Default.imagePath = 'assets/leaflet/libs/leaflet/images';
|
2015-01-06 14:55:12 +01:00
|
|
|
|
2014-12-29 12:17:40 +01:00
|
|
|
window.ContaoLeaflet = new L.Contao();
|