From 265a9fd2b51e512a0e6808cf2a2c06c9a7f0d764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr> Date: Mon, 8 May 2023 11:59:18 +0200 Subject: [PATCH] switch addFeatures args list to object --- src/services/map-service.js | 2 +- src/views/Project/FeaturesListAndMap.vue | 14 +++++++------- src/views/Project/ProjectDetail.vue | 13 +++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/services/map-service.js b/src/services/map-service.js index e3a1885b..a95e3852 100644 --- a/src/services/map-service.js +++ b/src/services/map-service.js @@ -400,7 +400,7 @@ const mapService = { return { color, opacity }; }, - addVectorTileLayer: function (url, projectId, featureTypes, formFilters, queryParams) { + addVectorTileLayer: function ({ url, projectId, featureTypes, formFilters = {}, queryParams = {} }) { const format_cfg = {/*featureClass: Feature*/ }; const mvt = new MVT(format_cfg); const options = { diff --git a/src/views/Project/FeaturesListAndMap.vue b/src/views/Project/FeaturesListAndMap.vue index fcba7ab0..0c65860c 100644 --- a/src/views/Project/FeaturesListAndMap.vue +++ b/src/views/Project/FeaturesListAndMap.vue @@ -343,13 +343,13 @@ export default { this.$nextTick(() => { const project_id = this.projectSlug.split('-')[0]; const mvtUrl = `${this.API_BASE_URL}features.mvt`; - mapService.addVectorTileLayer( - mvtUrl, - project_id, - this.feature_types, - this.form, - this.queryparams, - ); + mapService.addVectorTileLayer({ + url: mvtUrl, + projectId: project_id, + featureTypes: this.feature_types, + formFilters: this.form, + queryParams: this.queryparams, + }); }); this.fetchPagedFeatures(); diff --git a/src/views/Project/ProjectDetail.vue b/src/views/Project/ProjectDetail.vue index 1275428c..7867a7f1 100644 --- a/src/views/Project/ProjectDetail.vue +++ b/src/views/Project/ProjectDetail.vue @@ -435,15 +435,16 @@ export default { this.checkForOfflineFeature(); const project_id = this.$route.params.slug.split('-')[0]; const mvtUrl = `${this.API_BASE_URL}features.mvt`; - mapService.addVectorTileLayer( - mvtUrl, - project_id, - this.feature_types, - { + mapService.addVectorTileLayer({ + url: mvtUrl, + projectId: project_id, + featureTypes: this.feature_types, + queryParams: { ordering: this.project.feature_browsing_default_sort, filter: this.project.feature_browsing_default_filter, } - ); + }); + this.mapLoading = false; this.arraysOffline.forEach((x) => (x.geojson.properties.color = 'red')); const featuresOffline = this.arraysOffline.map((x) => x.geojson); -- GitLab