# HG changeset patch # User Thomas Junk # Date 1551112207 -3600 # Node ID 0b8793a1947c190fd7c5850a62ebe73fbbbc6906 # Parent 123e7f43b676edc43db5f707d0d7284d7b1dc70e fairway_profile: calc relative depth WIP diff -r 123e7f43b676 -r 0b8793a1947c client/src/components/fairway/Fairwayprofile.vue --- 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");