From 7833b366700611f6239ce9c7ae14bbd7905d01c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Lain=C3=A9?= Date: Mon, 26 Aug 2024 15:39:32 +0200 Subject: [PATCH] =?UTF-8?q?Stats=20par=20commune=20v1=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/api/index.ts | 8 + client/components/carte/Map.vue | 23 +- client/components/carte/commune/Filter.vue | 120 ++++ client/components/carte/commune/Map.vue | 511 ++++++++++++++++++ client/components/donnees/AreaChart.vue | 4 +- .../components/donnees/DepartementChart.vue | 2 +- client/components/donnees/Filter.vue | 7 +- client/pages/donnees/carte-commune/index.vue | 61 +++ .../pages/donnees/carte-historique/index.vue | 66 +++ client/pages/donnees/departement/index.vue | 37 ++ client/pages/donnees/index.vue | 86 ++- client/pages/donnees/surface/index.vue | 37 ++ client/public/donnee_carte_commune.png | Bin 0 -> 218328 bytes client/public/donnee_carte_historique.png | Bin 0 -> 218328 bytes client/public/donnee_graphe_departement.png | Bin 0 -> 42200 bytes client/public/donnee_graphe_surface.png | Bin 0 -> 76911 bytes client/store/refData.ts | 15 +- client/utils/index.ts | 14 +- nuxt.config.ts | 18 +- package.json | 1 + yarn.lock | 5 + 21 files changed, 955 insertions(+), 60 deletions(-) create mode 100644 client/components/carte/commune/Filter.vue create mode 100644 client/components/carte/commune/Map.vue create mode 100644 client/pages/donnees/carte-commune/index.vue create mode 100644 client/pages/donnees/carte-historique/index.vue create mode 100644 client/pages/donnees/departement/index.vue create mode 100644 client/pages/donnees/surface/index.vue create mode 100644 client/public/donnee_carte_commune.png create mode 100644 client/public/donnee_carte_historique.png create mode 100644 client/public/donnee_graphe_departement.png create mode 100644 client/public/donnee_graphe_surface.png diff --git a/client/api/index.ts b/client/api/index.ts index 232e447b..5fa82931 100644 --- a/client/api/index.ts +++ b/client/api/index.ts @@ -94,6 +94,14 @@ const index = { }); }, + getDataDuree(): Promise { + const runtimeConfig = useRuntimeConfig(); + return useFetch(`/data/duree`, { + method: 'GET', + baseURL: runtimeConfig.public.apiSecheresseUrl, + }); + }, + getArretesRestrictions(date: string, area?: string): Promise { const runtimeConfig = useRuntimeConfig(); return useFetch(`/arretes_restrictions?date=${date}&${area ? area : ''}`, { diff --git a/client/components/carte/Map.vue b/client/components/carte/Map.vue index fb4e03fb..fa98474b 100644 --- a/client/components/carte/Map.vue +++ b/client/components/carte/Map.vue @@ -32,6 +32,7 @@ const departementCode = route.query.depCode; const showRestrictionsBtn = ref(true); const showError = ref(false); const refDataStore = useRefDataStore(); +const depsSelected = ref([]); const initialState = [[-7.075195, 41.211722], [11.403809, 51.248163]]; @@ -100,7 +101,7 @@ onMounted(() => { break; } } - map.value?.addSource('cadastre', { + map.value?.addSource('decoupage-administratif', { type: 'vector', url: `https://openmaptiles.data.gouv.fr/data/decoupage-administratif.json`, @@ -203,6 +204,10 @@ const updateContourFilter = () => { map.value?.setFilter('zones-contour', ['all', ['==', 'type', selectedTypeEau.value], ['==', 'id', zoneSelected.value]]); }; +const updateDepartementsContourFilter = () => { + map.value?.setFilter('departements-contour', ['in', 'code', ...depsSelected.value.map((d: any) => d.code)]); +}; + const closeModal = () => { modalOpened.value = false; }; @@ -256,7 +261,7 @@ const addSourceAndLayerZones = (pmtilesUrl: string) => { map.value?.addLayer({ id: 'departements-data', type: 'line', - source: 'cadastre', + source: 'decoupage-administratif', 'source-layer': 'departements', layout: { 'line-join': 'round', @@ -268,6 +273,18 @@ const addSourceAndLayerZones = (pmtilesUrl: string) => { }, }, firstSymbolId); + map.value?.addLayer({ + id: 'departements-contour', + type: 'line', + source: 'decoupage-administratif', + 'source-layer': 'departements', + filter: ['all', ['in', 'code', ...depsSelected.value.map((d: any) => d.code)]], + paint: { + 'line-color': '#000091', + 'line-width': 2, + }, + }, firstSymbolId); + map.value?.addLayer({ id: 'zones-contour', type: 'line', @@ -357,6 +374,8 @@ watch(() => props.area, () => { padding: 30, }); } + depsSelected.value = deps; + updateDepartementsContourFilter(); }); diff --git a/client/components/carte/commune/Filter.vue b/client/components/carte/commune/Filter.vue new file mode 100644 index 00000000..14f9ddfe --- /dev/null +++ b/client/components/carte/commune/Filter.vue @@ -0,0 +1,120 @@ + + + + + \ No newline at end of file diff --git a/client/components/carte/commune/Map.vue b/client/components/carte/commune/Map.vue new file mode 100644 index 00000000..66519dea --- /dev/null +++ b/client/components/carte/commune/Map.vue @@ -0,0 +1,511 @@ + + + + + \ No newline at end of file diff --git a/client/components/donnees/AreaChart.vue b/client/components/donnees/AreaChart.vue index a4f1f4e4..c369f050 100644 --- a/client/components/donnees/AreaChart.vue +++ b/client/components/donnees/AreaChart.vue @@ -59,6 +59,7 @@ async function loadData() { dataArea.value = data.value; sortData(); } + computeDisabled.value = true; loading.value = false; } @@ -216,7 +217,6 @@ watch(() => refDataStore.departements, () => {