changeset 841:07be3e5f99a9

WIP Fairwayprofile
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 28 Sep 2018 11:23:50 +0200
parents 0f61bfc21041
children ee6f127f573c
files client/src/application/Main.vue client/src/fairway/Fairwayprofile.vue client/src/fairway/store.js
diffstat 3 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/application/Main.vue	Fri Sep 28 10:56:03 2018 +0200
+++ b/client/src/application/Main.vue	Fri Sep 28 11:23:50 2018 +0200
@@ -2,7 +2,7 @@
     <div class="main d-flex flex-column">
         <Maplayer :drawMode="drawMode" :split="isSplitscreen" :lat="6155376" :long="1819178" :zoom="11"></Maplayer>
         <div v-if="isSplitscreen" class="profile d-flex flex-row">
-            <FairwayProfile :fairwayCoordinates="fairwayCoordinates" :waterLevels="waterLevels" :data="currentProfile" :height="height" :width="width" :xScale="xAxis" :yScaleLeft="yAxisLeft" :yScaleRight="yAxisRight" :margin="margins" :totalLength="totalLength"></FairwayProfile>
+            <FairwayProfile :selectedWaterLevel="selectedWaterLevel" :fairwayCoordinates="fairwayCoordinates" :waterLevels="waterLevels" :data="currentProfile" :height="height" :width="width" :xScale="xAxis" :yScaleLeft="yAxisLeft" :yScaleRight="yAxisRight" :margin="margins" :totalLength="totalLength"></FairwayProfile>
         </div>
     </div>
 </template>
@@ -50,7 +50,8 @@
       "maxAlt",
       "totalLength",
       "waterLevels",
-      "fairwayCoordinates"
+      "fairwayCoordinates",
+      "selectedWaterLevel"
     ]),
     xAxis() {
       return [this.xScale.x, this.xScale.y];
--- a/client/src/fairway/Fairwayprofile.vue	Fri Sep 28 10:56:03 2018 +0200
+++ b/client/src/fairway/Fairwayprofile.vue	Fri Sep 28 11:23:50 2018 +0200
@@ -47,7 +47,8 @@
     "margin",
     "totalLength",
     "waterLevels",
-    "fairwayCoordinates"
+    "fairwayCoordinates",
+    "selectedWaterLevel"
   ],
   computed: {
     waterColor() {
@@ -58,9 +59,7 @@
     }
   },
   data() {
-    return {
-      selectedWaterLevel: this.waterLevels[0].level
-    };
+    return {};
   },
   watch: {
     data() {
--- a/client/src/fairway/store.js	Fri Sep 28 10:56:03 2018 +0200
+++ b/client/src/fairway/store.js	Fri Sep 28 11:23:50 2018 +0200
@@ -9,14 +9,18 @@
     maxAlt: 0,
     currentProfile: [],
     waterLevels: [
-      { year: "2016", level: 0, color: "#005DFF" },
-      { year: "2017", level: -0.5, color: "#639CFF" }
+      { year: "2016", level: 149.3, color: "#005DFF" },
+      { year: "2017", level: 148.2, color: "#639CFF" }
     ],
+    selectedWaterLevel: 149.3,
     fairwayCoordinates: [],
     startPoint: null,
     endPoint: null
   },
   getters: {
+    selectedWaterLevel: state => {
+      return state.selectedWaterLevel;
+    },
     fairwayCoordinates: state => {
       return state.fairwayCoordinates;
     },
@@ -46,6 +50,9 @@
     }
   },
   mutations: {
+    setSelectedWaterLevel: (state, level) => {
+      state.selectedWaterLevel = level;
+    },
     profileLoaded: (state, response) => {
       const { data } = response;
       const coordinates = data.geometry.coordinates;