2016-11-29 01:04:30 +01:00
|
|
|
(function($){
|
|
|
|
|
|
|
|
var soundmap = window.Soundmap || {}
|
|
|
|
|
|
|
|
_.extend(soundmap, {
|
|
|
|
|
|
|
|
map: undefined,
|
|
|
|
layers:{},
|
|
|
|
|
|
|
|
initMap: function(){
|
2018-11-12 17:13:32 +01:00
|
|
|
/*
|
2016-11-29 01:04:30 +01:00
|
|
|
this.map = L.map('map_canvas_options',{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom});
|
|
|
|
this.layers.SATELLITE = new L.Google();
|
|
|
|
this.layers.TERRAIN = new L.Google('TERRAIN');
|
|
|
|
this.layers.HYBRID = new L.Google('HYBRID');
|
|
|
|
this.layers.ROADMAP = new L.Google('ROADMAP');
|
|
|
|
this.map.addLayer(this.layers[this.mapType]);
|
|
|
|
this.map.addControl(
|
|
|
|
new L.Control.Layers(
|
|
|
|
{
|
|
|
|
'Google':this.layers.SATELLITE,
|
|
|
|
'Google Terrain': this.layers.TERRAIN,
|
|
|
|
'Google Hybrid': this.layers.HYBRID,
|
|
|
|
'Google Roadmap': this.layers.ROADMAP
|
|
|
|
}, {}
|
|
|
|
)
|
2018-11-12 17:13:32 +01:00
|
|
|
);*/
|
|
|
|
mapboxUrl = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibHJ1bGxvIiwiYSI6ImNpaDUydjdoNTAwd3BzdGx5bGlhOTh6bXYifQ.tE8QgNbVSgwP8V5LnJWA3w';
|
|
|
|
var grayscale = L.tileLayer(mapboxUrl, {id: 'mapbox.light'}),
|
|
|
|
streets = L.tileLayer(mapboxUrl, {id: 'mapbox.streets'});
|
|
|
|
this.map = L.map('map_canvas_options',{center: [this.origin.lat, this.origin.lng], zoom: this.origin.zoom, layers: [grayscale,streets]});
|
|
|
|
this.map.addControl(
|
|
|
|
new L.Control.Layers(
|
|
|
|
{
|
|
|
|
'Grayscale':grayscale,
|
|
|
|
'Streets': streets
|
|
|
|
}, {}
|
|
|
|
)
|
2016-11-29 01:04:30 +01:00
|
|
|
);
|
|
|
|
|
2018-11-12 17:13:32 +01:00
|
|
|
|
2016-11-29 01:04:30 +01:00
|
|
|
this.map.addEventListener('dragend', this.mapDrag, this);
|
|
|
|
this.map.addEventListener('zoomend', this.mapZoom, this);
|
|
|
|
this.map.addEventListener('baselayerchange', this.layerChange, this);
|
|
|
|
|
|
|
|
_.bindAll(this);
|
|
|
|
this.initEvents();
|
|
|
|
},
|
|
|
|
|
|
|
|
layerChange: function(event){
|
|
|
|
var _t = event.layer._type;
|
|
|
|
$('#soundmap_op_origin_type').val(_t);
|
|
|
|
},
|
|
|
|
|
|
|
|
mapDrag: function(event){
|
|
|
|
var _l = this.map.getCenter();
|
|
|
|
$('#soundmap_op_origin_lat').val(_l.lat);
|
|
|
|
$('#soundmap_op_origin_lng').val(_l.lng);
|
|
|
|
},
|
|
|
|
mapZoom: function(event){
|
|
|
|
$('#soundmap_op_origin_zoom').val(this.map.getZoom());
|
|
|
|
},
|
|
|
|
initEvents: function(){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
soundmap.initMap();
|
|
|
|
});
|
|
|
|
|
2018-11-12 17:13:32 +01:00
|
|
|
}(jQuery));
|