|
@@ -1,56 +1,55 @@
|
|
|
window.SONATA_CONFIG.USE_ICHECK = false;
|
|
|
|
|
|
var map,
|
|
|
- defaultCoords,
|
|
|
- drawnItems,
|
|
|
- marker,
|
|
|
- loc,
|
|
|
- dataValue;
|
|
|
+ defaultCoords,
|
|
|
+ drawnItems,
|
|
|
+ marker,
|
|
|
+ loc,
|
|
|
+ dataValue;
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
- defaultCoords = new L.latLng(39.791312, -2.6949709); // España
|
|
|
+ defaultCoords = new L.latLng(_MAP_LATITUDE, _MAP_LONGITUDE);
|
|
|
map = new L.Map('map', {zoom: getZoomLevel(), center: getDataCoords()});
|
|
|
drawnItems = L.featureGroup().addTo(map);
|
|
|
|
|
|
drawMarker();
|
|
|
|
|
|
L.control.layers(
|
|
|
- {
|
|
|
- 'openstreetmap': L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
|
- {
|
|
|
- maxZoom: 18,
|
|
|
- attribution: '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
|
- }).addTo(map),
|
|
|
- "google": L.tileLayer('http://www.google.com.ar/maps/vt?lyrs=y@189&gl=cn&x={x}&y={y}&z={z}',
|
|
|
- {
|
|
|
- maxZoom: 18,
|
|
|
- attribution: 'google'
|
|
|
- })
|
|
|
- },
|
|
|
- {
|
|
|
- 'drawlayer': drawnItems
|
|
|
- },
|
|
|
- {
|
|
|
- position: 'topleft',
|
|
|
- collapsed: false
|
|
|
- }).addTo(map);
|
|
|
+ {
|
|
|
+ 'openstreetmap': L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
|
+ {
|
|
|
+ maxZoom: 18,
|
|
|
+ attribution: '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
|
+ }).addTo(map),
|
|
|
+ "google": L.tileLayer('http://www.google.com.ar/maps/vt?lyrs=y@189&gl=cn&x={x}&y={y}&z={z}',
|
|
|
+ {
|
|
|
+ maxZoom: 18,
|
|
|
+ attribution: 'google'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ {
|
|
|
+ 'drawlayer': drawnItems
|
|
|
+ },
|
|
|
+ {
|
|
|
+ position: 'topleft',
|
|
|
+ collapsed: false
|
|
|
+ }).addTo(map);
|
|
|
|
|
|
map.on('zoomend', function () {
|
|
|
setDataValue();
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
|
|
|
// Espera que el tab mostrado tenga la clase CSS 'active' y hace un refresh del mapa
|
|
|
// debido a que al estar oculto en un tab no se muestra con el tamaño correcto
|
|
|
var tab_id;
|
|
|
-$('.nav-tabs a').on('click', function() {
|
|
|
+$('.nav-tabs a').on('click', function () {
|
|
|
tab_id = $(this).attr('href');
|
|
|
checkForChanges();
|
|
|
});
|
|
|
|
|
|
-function checkForChanges()
|
|
|
-{
|
|
|
+function checkForChanges() {
|
|
|
if ($(tab_id).hasClass('active')) {
|
|
|
map._onResize();
|
|
|
} else {
|
|
@@ -58,8 +57,7 @@ function checkForChanges()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function getDataCoords()
|
|
|
-{
|
|
|
+function getDataCoords() {
|
|
|
var jsonParseData = {};
|
|
|
if ($('[name$="[extraData]"]').val()) {
|
|
|
dataValue = $('[name$="[extraData]"]').val();
|
|
@@ -75,8 +73,7 @@ function getDataCoords()
|
|
|
return loc;
|
|
|
}
|
|
|
|
|
|
-function drawMarker()
|
|
|
-{
|
|
|
+function drawMarker() {
|
|
|
if (marker) {
|
|
|
drawnItems.removeLayer(marker);
|
|
|
}
|
|
@@ -85,8 +82,7 @@ function drawMarker()
|
|
|
drawnItems.addLayer(marker);
|
|
|
}
|
|
|
|
|
|
-function getZoomLevel()
|
|
|
-{
|
|
|
+function getZoomLevel() {
|
|
|
var jsonParseData = {};
|
|
|
var zoomLevel = 18;
|
|
|
if ($('[name$="[extraData]"]').val()) {
|