Mercurial > gemma
changeset 1056:28eb62f7c676 crossprofile
additional survey as dynamic property
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 25 Oct 2018 16:19:46 +0200 |
parents | 9bd4f82fcd8d |
children | 7242b5a427bc |
files | client/src/fairway/Fairwayprofile.vue client/src/fairway/store.js client/src/map/Maplayer.vue |
diffstat | 3 files changed, 28 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/fairway/Fairwayprofile.vue Thu Oct 25 15:01:59 2018 +0200 +++ b/client/src/fairway/Fairwayprofile.vue Thu Oct 25 16:19:46 2018 +0200 @@ -3,7 +3,7 @@ <div class="fairwayprofile"></div> <div class="additionalsurveys d-flex flex-column"> <small class="label">Available Additional Surveys</small> - <select v-model="additionalSurvey" @change="selectAdditionalSurveyData"> + <select v-model="additionalSurvey"> <option value="">None</option> <option v-for="survey in additionalSurveys" @@ -107,6 +107,15 @@ "waterLevels", "selectedWaterLevel" ]), + additionalSurvey: { + get() { + return this.$store.getters["fairwayprofile/additionalSurvey"]; + }, + set(value) { + this.$store.commit("fairwayprofile/setAdditionalSurvey", value); + this.selectAdditionalSurveyData(); + } + }, currentData() { const currentSurveyDate = this.selectedMorph.date_info; return this.currentProfile[currentSurveyDate]; @@ -123,7 +132,6 @@ }, data() { return { - additionalSurvey: "", wait: false }; },
--- a/client/src/fairway/store.js Thu Oct 25 15:01:59 2018 +0200 +++ b/client/src/fairway/store.js Thu Oct 25 16:19:46 2018 +0200 @@ -24,6 +24,7 @@ const FairwayProfile = { namespaced: true, state: { + additionalSurvey: "", availableSurveys: null, totalLength: 0, minAlt: 0, @@ -39,9 +40,15 @@ getters: { length: state => { return state.totalLength; + }, + additionalSurvey: state => { + return state.additionalSurvey; } }, mutations: { + setAdditionalSurvey: (state, additionalSurvey) => { + state.additionalSurvey = additionalSurvey; + }, setSelectedMorph: (state, selectedMorph) => { state.selectedMorph = selectedMorph; }, @@ -63,9 +70,15 @@ // Use Vue.set() to make new object properties rective // https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats Vue.set(state.currentProfile, surveyDate, result.points); - state.minAlt = result.minAlt; - state.maxAlt = result.maxAlt; - state.totalLength = result.lengthPolyLine; + if (!state.minAlt || state.minAlt > result.minAlt) { + state.minAlt = result.minAlt; + } + if (!state.maxAlt || state.maxAlt < result.maxAlt) { + state.maxAlt = result.maxAlt; + } + if (!state.totalLength || state.totalLength < result.totalLength) { + state.totalLength = result.lengthPolyLine; + } }, setStartPoint: (state, start) => { state.startPoint = start; @@ -77,6 +90,7 @@ state.fairwayCoordinates = coordinates; }, clearCurrentProfile: state => { + state.additionalSurvey = ""; state.currentProfile = {}; } },
--- a/client/src/map/Maplayer.vue Thu Oct 25 15:01:59 2018 +0200 +++ b/client/src/map/Maplayer.vue Thu Oct 25 16:19:46 2018 +0200 @@ -164,6 +164,7 @@ // TODO an improvement could be to check if the line intersects // with the bottleneck area's polygon before trying the server request if (this.selectedMorph) { + this.$store.commit("fairwayprofile/clearCurrentProfile"); console.log("requesting profile for", this.selectedMorph); const inputLineString = event.feature.getGeometry().clone(); inputLineString.transform("EPSG:3857", "EPSG:4326");