function _displayMapDelete (divtarget) { divtarget = typeof divtarget !== 'undefined' ? divtarget : 'app'; document.getElementById(divtarget).innerHTML = "
"; document.getElementById('home').className = "nav-link flat"; document.getElementById('leaflet_crud_create').className = "nav-link flat"; document.getElementById('leaflet_crud_read').className = "nav-link flat"; document.getElementById('navbarDropdownUpdate').className = "nav-link dropdown-toggle"; document.getElementById('leaflet_crud_delete').className = "nav-link flat active"; var map, isCollapsed, openStreetMaps; if (document.body.clientWidth <= 767) { isCollapsed = true; } else { isCollapsed = false; } var promisePoint = $.ajax({ url: "assets/dataservice/read_point.php", method: "GET", dataType: "json", data: {command:"POINT"}, username: null, password: null }); var pointObjects = L.geoJson(null, { onEachFeature: function (feature, layer) { if (feature.properties) { layer.on({ click: function (e) { var featureGid = feature.properties.id; var deleteConfirmation = confirm("Vuoi cancellare questa geometria?"); if (deleteConfirmation == true) { $.ajax({ url: "assets/dataservice/delete_point.php", method: "GET", dataType: "json", data: {command:"DELETE",id:featureGid}, success: function (data) { if (data.response=="200") { map.off(); map.remove(); _displayMapDelete('app'); } else { console.log('Failed to delete.'); } }, username: null, password: null }); } else { console.log('Delete feature is cancelled.'); } } }); } } }); promisePoint.then(function (data) { pointObjects.addData(data); map.addLayer(pointObjects); }); var promiseLinestring = $.ajax({ url: "assets/dataservice/read_linestring.php", method: "GET", dataType: "json", data: {command:"LINESTRING"}, username: null, password: null }); var linestringObjects = L.geoJson(null, { onEachFeature: function (feature, layer) { if (feature.properties) { layer.on({ click: function (e) { var featureGid = feature.properties.id; var deleteConfirmation = confirm("Vuoi cancellare questa geometria?"); if (deleteConfirmation == true) { $.ajax({ url: "assets/dataservice/delete_linestring.php", method: "GET", dataType: "json", data: {command:"DELETE",id:featureGid}, success: function (data) { if (data.response=="200") { map.off(); map.remove(); _displayMapDelete('app'); } else { console.log('Failed to delete.'); } }, username: null, password: null }); } else { console.log('Delete feature is cancelled.'); } } }); } } }); promiseLinestring.then(function (data) { linestringObjects.addData(data); map.addLayer(linestringObjects); }); var promisePolygon = $.ajax({ url: "assets/dataservice/read_polygon.php", method: "GET", dataType: "json", data: {command:"POLYGON"}, username: null, password: null }); var polygonObjects = L.geoJson(null, { onEachFeature: function (feature, layer) { if (feature.properties) { layer.on({ click: function (e) { var featureGid = feature.properties.id; var deleteConfirmation = confirm("Vuoi cancellare questa geometria?"); if (deleteConfirmation == true) { $.ajax({ url: "assets/dataservice/delete_polygon.php", method: "GET", dataType: "json", data: {command:"DELETE",id:featureGid}, success: function (data) { if (data.response=="200") { map.off(); map.remove(); _displayMapDelete('app'); } else { console.log('Failed to delete.'); } }, username: null, password: null }); } else { console.log('Delete feature is cancelled.'); } } }); } } }); promisePolygon.then(function (data) { polygonObjects.addData(data); map.addLayer(polygonObjects); }); //################# INIZIO PARTICELLA SELEZIONATA ################# 100 ) { ?> particella = L.geoJson(, { style: {'color': "#ff0000",'fillColor': "rgb(255, 255, 0)",'fillOpacity': 0.4,'dashArray': 4,'weight': 3,'opacity': 0.9} }), //################# FINE PARTICELLA SELEZIONATA ################# openStreetMaps = new L.TileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { minZoom: 3, maxZoom: 20, attribution: 'Map Data © OpenStreetMap contributors.' }); map = L.map("map", { zoom: , center: [], layers: [openStreetMaps,particella], minZoom: 3, maxZoom: 20, zoomControl: false, attributionControl: true }); map.setMaxBounds([]); var zoomControl = L.control.zoom({ position: "topleft" }).addTo(map); var baseLayers = { "OpenStreetMap": openStreetMaps }; var overlayLayers = { "Elementi puntuali": pointObjects, "Elementi lineari": linestringObjects, "Elementi poligonali": polygonObjects }; var layerControl = L.control.layers(baseLayers, overlayLayers, { collapsed: isCollapsed }).addTo(map); }