carto: use exported polygon styles
This commit is contained in:
parent
f321e9df3f
commit
53c6003d27
1 changed files with 23 additions and 36 deletions
|
@ -1,45 +1,32 @@
|
||||||
import L from 'leaflet';
|
import L from 'leaflet';
|
||||||
|
import {
|
||||||
|
drawLayer,
|
||||||
|
noEditStyle,
|
||||||
|
CADASTRE_POLYGON_STYLE,
|
||||||
|
QP_POLYGON_STYLE
|
||||||
|
} from '../../shared/carto';
|
||||||
|
|
||||||
function drawLayerWithItems(map, items, style) {
|
export function drawCadastre(map, data) {
|
||||||
if (Array.isArray(items) && items.length > 0) {
|
drawLayer(
|
||||||
const layer = new L.GeoJSON();
|
map,
|
||||||
|
data.cadastres,
|
||||||
items.forEach(function(item) {
|
noEditStyle(CADASTRE_POLYGON_STYLE),
|
||||||
layer.addData(item.geometry);
|
'cadastres'
|
||||||
});
|
);
|
||||||
|
|
||||||
layer.setStyle(style).addTo(map);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function drawCadastre(map, { dossierCadastres }) {
|
export function drawQuartiersPrioritaires(map, data) {
|
||||||
drawLayerWithItems(map, dossierCadastres, {
|
drawLayer(
|
||||||
fillColor: '#8A6D3B',
|
map,
|
||||||
weight: 2,
|
data.quartiersPrioritaires,
|
||||||
opacity: 0.7,
|
noEditStyle(QP_POLYGON_STYLE),
|
||||||
color: '#8A6D3B',
|
'quartiersPrioritaires'
|
||||||
dashArray: '3',
|
);
|
||||||
fillOpacity: 0.5
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function drawQuartiersPrioritaires(
|
export function drawUserSelection(map, data) {
|
||||||
map,
|
if (data.selection.length > 0) {
|
||||||
{ dossierQuartiersPrioritaires }
|
const polygon = L.polygon(data.selection, {
|
||||||
) {
|
|
||||||
drawLayerWithItems(map, dossierQuartiersPrioritaires, {
|
|
||||||
fillColor: '#31708F',
|
|
||||||
weight: 2,
|
|
||||||
opacity: 0.7,
|
|
||||||
color: '#31708F',
|
|
||||||
dashArray: '3',
|
|
||||||
fillOpacity: 0.5
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function drawUserSelection(map, { dossierJsonLatLngs }) {
|
|
||||||
if (dossierJsonLatLngs.length > 0) {
|
|
||||||
const polygon = L.polygon(dossierJsonLatLngs, {
|
|
||||||
color: 'red',
|
color: 'red',
|
||||||
zIndex: 3
|
zIndex: 3
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
Loading…
Add table
Reference in a new issue