Remove dead carto code

This commit is contained in:
Paul Chavard 2018-10-10 20:03:35 +02:00
parent 55b955f838
commit 9a4975a2dd
3 changed files with 0 additions and 126 deletions

View file

@ -1,66 +0,0 @@
import L from 'leaflet';
import $ from 'jquery';
export function cadastreActive() {
return $('#map.cadastre').length > 0;
}
export function getCadastre(dossierId, coordinates) {
return $.ajax({
method: 'post',
url: `/users/dossiers/${dossierId}/carte/cadastre`,
data: { coordinates: JSON.stringify(coordinates) },
dataType: 'json'
}).then(({ cadastres }) => cadastres);
}
let cadastreItems;
export function displayCadastre(map, cadastres) {
if (!cadastreActive()) return;
$('#cadastre.list ul').html('');
newCadastreLayer(map);
if (cadastres.length == 1 && cadastres[0]['zoom_error']) {
$('#cadastre.list ul').html(
'<li><b>Merci de dessiner une surface plus petite afin de récupérer les parcelles cadastrales.</b></li>'
);
} else if (cadastres.length > 0) {
cadastres.forEach(function(cadastre) {
$('#cadastre.list ul').append(
'<li> Parcelle nº ' +
cadastre.numero +
' - Feuille ' +
cadastre.code_arr +
' ' +
cadastre.section +
' ' +
cadastre.feuille +
'</li>'
);
cadastreItems.addData(cadastre.geometry);
});
cadastreItems.setStyle({
fillColor: '#8a6d3b',
weight: 2,
opacity: 0.3,
color: 'white',
dashArray: '3',
fillOpacity: 0.7
});
} else {
$('#cadastre.list ul').html('<li>AUCUN</li>');
}
}
function newCadastreLayer(map) {
if (cadastreItems) {
map.removeLayer(cadastreItems);
}
cadastreItems = new L.GeoJSON();
cadastreItems.addTo(map);
}

View file

@ -1,56 +0,0 @@
import L from 'leaflet';
import $ from 'jquery';
export function qpActive() {
return $('#map.qp').length > 0;
}
export function getQP(dossierId, coordinates) {
return $.ajax({
method: 'post',
url: `/users/dossiers/${dossierId}/carte/qp`,
data: { coordinates: JSON.stringify(coordinates) },
dataType: 'json'
}).done(({ quartier_prioritaires }) => values(quartier_prioritaires));
}
let qpItems;
export function displayQP(map, qps) {
if (!qpActive()) return;
$('#qp.list ul').html('');
newQPLayer(map);
if (qps.length > 0) {
qps.forEach(function(qp) {
$('#qp.list ul').append('<li>' + qp.commune + ' : ' + qp.nom + '</li>');
qpItems.addData(qp.geometry);
});
qpItems.setStyle({
fillColor: '#31708f',
weight: 2,
opacity: 0.3,
color: 'white',
dashArray: '3',
fillOpacity: 0.7
});
} else {
$('#qp.list ul').html('<li>AUCUN</li>');
}
}
function newQPLayer(map) {
if (qpItems) {
map.removeLayer(qpItems);
}
qpItems = new L.GeoJSON();
qpItems.addTo(map);
}
function values(obj) {
return Object.keys(obj).map(v => obj[v]);
}

View file

@ -1,9 +1,5 @@
const LON = '2.428462';
const LAT = '46.538192';
const DEFAULT_POSITION = { lon: LON, lat: LAT, zoom: 5 };
import L from 'leaflet';
export { DEFAULT_POSITION, LAT, LON };
const LAYERS = {};
export function initMap(position) {