|
|
@ -43,6 +43,9 @@ function updateCurrentGeoJson() { |
|
|
|
let shapes = []; |
|
|
|
let shapes = []; |
|
|
|
drawnItems.eachLayer(function (layer) { |
|
|
|
drawnItems.eachLayer(function (layer) { |
|
|
|
let geojson = layer.toGeoJSON(); |
|
|
|
let geojson = layer.toGeoJSON(); |
|
|
|
|
|
|
|
if (layer instanceof L.Circle) { |
|
|
|
|
|
|
|
geojson.properties.radius = layer.getRadius(); |
|
|
|
|
|
|
|
} |
|
|
|
shapes.push(geojson); |
|
|
|
shapes.push(geojson); |
|
|
|
}); |
|
|
|
}); |
|
|
|
currentGeoJson = { |
|
|
|
currentGeoJson = { |
|
|
@ -50,8 +53,7 @@ function updateCurrentGeoJson() { |
|
|
|
features: shapes |
|
|
|
features: shapes |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
function openActivityMap(id) |
|
|
|
function openActivityMap(id) { |
|
|
|
{ |
|
|
|
|
|
|
|
currentIdAct = id; |
|
|
|
currentIdAct = id; |
|
|
|
map.invalidateSize(); |
|
|
|
map.invalidateSize(); |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
@ -70,7 +72,15 @@ function openActivityMap(id) |
|
|
|
let lGeoJson = L.geoJSON(feature); |
|
|
|
let lGeoJson = L.geoJSON(feature); |
|
|
|
let layers = lGeoJson.getLayers(); |
|
|
|
let layers = lGeoJson.getLayers(); |
|
|
|
layers.forEach(layer => { |
|
|
|
layers.forEach(layer => { |
|
|
|
|
|
|
|
let radius = layer.feature.properties.radius; |
|
|
|
|
|
|
|
if (radius) { |
|
|
|
|
|
|
|
let latlon = layer.getLatLng(); |
|
|
|
|
|
|
|
let circle = L.circle([latlon.lat, latlon.lng], { radius: radius }); |
|
|
|
|
|
|
|
addDrawnLayer(circle); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
addDrawnLayer(layer) |
|
|
|
addDrawnLayer(layer) |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -234,8 +244,7 @@ $(document).ready(function () { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function submitLocation() |
|
|
|
function submitLocation() { |
|
|
|
{ |
|
|
|
|
|
|
|
let payload |
|
|
|
let payload |
|
|
|
|
|
|
|
|
|
|
|
if (currentGeoJson && currentGeoJson != "") { |
|
|
|
if (currentGeoJson && currentGeoJson != "") { |
|
|
@ -279,14 +288,13 @@ $(document).ready(function () { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function submitCircle(radius) |
|
|
|
function submitCircle(radius) { |
|
|
|
{ |
|
|
|
|
|
|
|
let circle = L.circle([circLat, circLong], { radius: radius }); |
|
|
|
let circle = L.circle([circLat, circLong], { radius: radius }); |
|
|
|
let geojsoncircle = circle.toGeoJSON(); |
|
|
|
let geojsoncircle = circle.toGeoJSON(); |
|
|
|
geojsoncircle.properties.radius = radius |
|
|
|
geojsoncircle.properties.radius = radius |
|
|
|
currentGeoJson = geojsoncircle |
|
|
|
currentGeoJson = geojsoncircle |
|
|
|
// console.log("geojsoncircle", geojsoncircle);
|
|
|
|
|
|
|
|
addDrawnLayer(circle); |
|
|
|
addDrawnLayer(circle); |
|
|
|
|
|
|
|
updateCurrentGeoJson(); |
|
|
|
map.addControl(drawnControlEdit); |
|
|
|
map.addControl(drawnControlEdit); |
|
|
|
|
|
|
|
|
|
|
|
$("#modal_radius").modal('hide'); |
|
|
|
$("#modal_radius").modal('hide'); |
|
|
|