Mercurial > gemma
changeset 829:797063af6dc8
client: complete simple survey selection
* Change code to only request a profile if a selectedMorph is there
and use the selected date and bottleneck id for the backend request.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Thu, 27 Sep 2018 23:45:58 +0200 |
parents | 90a601884ff2 |
children | 56fa02c93766 |
files | client/src/application/Morphtool.vue client/src/map/Maplayer.vue |
diffstat | 2 files changed, 18 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/application/Morphtool.vue Thu Sep 27 23:19:31 2018 +0200 +++ b/client/src/application/Morphtool.vue Thu Sep 27 23:45:58 2018 +0200 @@ -1,5 +1,5 @@ <template> - <div v-if="selectedBottleneck"> + <div v-if="selectedBottleneck || selectedMorph"> <div v-if="surveyList" class="ui-element card card-body shadow"> <div class="headline"> <h5>{{selectedBottleneck.get("objnam")}}</h5>
--- a/client/src/map/Maplayer.vue Thu Sep 27 23:19:31 2018 +0200 +++ b/client/src/map/Maplayer.vue Thu Sep 27 23:45:58 2018 +0200 @@ -51,7 +51,7 @@ }, computed: { ...mapGetters("mapstore", ["layers", "getLayerByName"]), - ...mapState("mapstore", ["openLayersMap"]), + ...mapState("mapstore", ["openLayersMap", "selectedMorph"]), mapStyle() { return { mapfull: !this.split, @@ -93,20 +93,23 @@ draw.on("drawend", this.drawEnd); return draw; }, - findFeature(profileLine) { - return new Feature({ - geometry: profileLine, - // FIXME: hardcoded bottleneck and survey date - bottleneck: "AT_Bottleneck_44", - date: "2017-11-20" - }); - }, drawEnd(event) { const length = getLength(event.feature.getGeometry()); this.$store.commit("mapstore/setCurrentMeasurement", length); // also place the a rounded length in a property, so identify can show it event.feature.set("length", Math.round(length * 10) / 10); + // if a survey has been selected, request a profile + // 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) { + console.log("requesting profile for", this.selectedMorph); + this.requestProfile(event, this.selectedMorph); + } + }, + requestProfile(event, survey) { + // survey has to have the properties bottleneck_id and date_info + // prepare to send the first line seqment to the server as GeoJSON const inputLineString = event.feature.getGeometry().clone(); inputLineString.transform("EPSG:3857", "EPSG:4326"); @@ -114,7 +117,11 @@ this.$store.commit("fairwayprofile/setStartPoint", start); this.$store.commit("fairwayprofile/setEndPoint", end); const profileLine = new LineString([start, end]); - const feature = this.findFeature(profileLine); + const feature = new Feature({ + geometry: profileLine, + bottleneck: survey.bottleneck_id, + dat: survey.date_info + }); const geoJSON = new GeoJSON({ geometryName: "geometry" }).writeFeature( feature );