Mercurial > gemma
comparison client/src/components/fairway/Fairwayprofile.vue @ 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 | 13de09e30645 |
children | e2f05ac81471 |
comparison
equal
deleted
inserted
replaced
2391:123e7f43b676 | 2392:0b8793a1947c |
---|---|
140 }, | 140 }, |
141 computed: { | 141 computed: { |
142 ...mapGetters("fairwayprofile", ["totalLength"]), | 142 ...mapGetters("fairwayprofile", ["totalLength"]), |
143 ...mapState("application", ["showSplitscreen"]), | 143 ...mapState("application", ["showSplitscreen"]), |
144 ...mapState("fairwayprofile", [ | 144 ...mapState("fairwayprofile", [ |
145 "startPoint", | 145 "additionalSurvey", |
146 "currentProfile", | |
146 "endPoint", | 147 "endPoint", |
147 "currentProfile", | 148 "fairwayData", |
148 "additionalSurvey", | |
149 "minAlt", | 149 "minAlt", |
150 "maxAlt", | 150 "maxAlt", |
151 "fairwayData", | 151 "profileLoading", |
152 "waterLevels", | 152 "referenceWaterLevel", |
153 "selectedWaterLevel", | 153 "selectedWaterLevel", |
154 "profileLoading" | 154 "startPoint", |
155 "waterLevels" | |
155 ]), | 156 ]), |
156 ...mapState("bottlenecks", [ | 157 ...mapState("bottlenecks", [ |
157 "selectedBottleneck", | 158 "selectedBottleneck", |
158 "selectedSurvey", | 159 "selectedSurvey", |
159 "surveysLoading" | 160 "surveysLoading" |
160 ]), | 161 ]), |
162 relativeWaterLevelDelta() { | |
163 return this.selectedWaterLevel.value - this.referenceWaterLevel; | |
164 }, | |
161 currentLevel: { | 165 currentLevel: { |
162 get() { | 166 get() { |
163 return this.selectedWaterLevel.date; | 167 return this.selectedWaterLevel.date; |
164 }, | 168 }, |
165 set(value) { | 169 set(value) { |
190 }, | 194 }, |
191 xScale() { | 195 xScale() { |
192 return [0, this.totalLength]; | 196 return [0, this.totalLength]; |
193 }, | 197 }, |
194 yScaleRight() { | 198 yScaleRight() { |
199 //ToDO calcReleativeDepth(this.maxAlt) to get the | |
200 // maximum depth according to the actual waterlevel | |
201 // additionally: take the one which is higher reference or current waterlevel | |
195 const DELTA = this.maxAlt * 1.1 - this.maxAlt; | 202 const DELTA = this.maxAlt * 1.1 - this.maxAlt; |
196 return [this.maxAlt * 1 + DELTA, -DELTA]; | 203 return [this.maxAlt * 1 + DELTA, -DELTA]; |
197 } | 204 } |
198 }, | 205 }, |
199 watch: { | 206 watch: { |
220 } | 227 } |
221 }, | 228 }, |
222 methods: { | 229 methods: { |
223 formatSurveyDate(value) { | 230 formatSurveyDate(value) { |
224 return formatSurveyDate(value); | 231 return formatSurveyDate(value); |
232 }, | |
233 calcRelativeDepth(depth) { | |
234 /* takes a depth value and substracts the delta of the relative waterlevel | |
235 * say the reference level is above the current level, the ground is nearer, | |
236 * thus, the depth is lower. | |
237 * | |
238 * E.g.: | |
239 * | |
240 * Reference waterlevel 5m, current 4m => delta = -1m | |
241 * If the distance to the ground was 3m from the 5m mark | |
242 * it is now only 2m from the current waterlevel. | |
243 * | |
244 * Vice versa: | |
245 * | |
246 * If the reference level is 5m and the current 6m => delta = +1m | |
247 * The ground is one meter farer away from the current waterlevel | |
248 * | |
249 */ | |
250 return depth - this.relativeWaterLevelDelta; | |
225 }, | 251 }, |
226 drawDiagram() { | 252 drawDiagram() { |
227 this.coordinatesSelect = null; | 253 this.coordinatesSelect = null; |
228 const chartDiv = document.querySelector(".fairwayprofile"); | 254 const chartDiv = document.querySelector(".fairwayprofile"); |
229 d3.select(".fairwayprofile svg").remove(); | 255 d3.select(".fairwayprofile svg").remove(); |