changeset 2392:0b8793a1947c

fairway_profile: calc relative depth WIP
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 25 Feb 2019 17:30:07 +0100
parents 123e7f43b676
children 85c47d63fdb9 e120631797f6
files client/src/components/fairway/Fairwayprofile.vue
diffstat 1 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/Fairwayprofile.vue	Mon Feb 25 16:16:33 2019 +0100
+++ b/client/src/components/fairway/Fairwayprofile.vue	Mon Feb 25 17:30:07 2019 +0100
@@ -142,22 +142,26 @@
     ...mapGetters("fairwayprofile", ["totalLength"]),
     ...mapState("application", ["showSplitscreen"]),
     ...mapState("fairwayprofile", [
-      "startPoint",
+      "additionalSurvey",
+      "currentProfile",
       "endPoint",
-      "currentProfile",
-      "additionalSurvey",
+      "fairwayData",
       "minAlt",
       "maxAlt",
-      "fairwayData",
-      "waterLevels",
+      "profileLoading",
+      "referenceWaterLevel",
       "selectedWaterLevel",
-      "profileLoading"
+      "startPoint",
+      "waterLevels"
     ]),
     ...mapState("bottlenecks", [
       "selectedBottleneck",
       "selectedSurvey",
       "surveysLoading"
     ]),
+    relativeWaterLevelDelta() {
+      return this.selectedWaterLevel.value - this.referenceWaterLevel;
+    },
     currentLevel: {
       get() {
         return this.selectedWaterLevel.date;
@@ -192,6 +196,9 @@
       return [0, this.totalLength];
     },
     yScaleRight() {
+      //ToDO calcReleativeDepth(this.maxAlt) to get the
+      // maximum depth according to the actual waterlevel
+      // additionally: take the one which is higher reference or current waterlevel
       const DELTA = this.maxAlt * 1.1 - this.maxAlt;
       return [this.maxAlt * 1 + DELTA, -DELTA];
     }
@@ -223,6 +230,25 @@
     formatSurveyDate(value) {
       return formatSurveyDate(value);
     },
+    calcRelativeDepth(depth) {
+      /* takes a depth value and substracts the delta of the relative waterlevel
+       * say the reference level is above the current level, the ground is nearer,
+       * thus, the depth is lower.
+       *
+       * E.g.:
+       *
+       * Reference waterlevel 5m, current 4m => delta = -1m
+       * If the distance to the ground was 3m from the 5m mark
+       * it is now only 2m from the current waterlevel.
+       *
+       *  Vice versa:
+       *
+       *  If the reference level is 5m and the current 6m => delta = +1m
+       *  The ground is one meter farer away from the current waterlevel
+       *
+       */
+      return depth - this.relativeWaterLevelDelta;
+    },
     drawDiagram() {
       this.coordinatesSelect = null;
       const chartDiv = document.querySelector(".fairwayprofile");