changeset 3463:6f4dad7473d7

afdLNWL: basical usage of classbreaks
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 27 May 2019 09:57:54 +0200
parents 9be91acbe49a
children 5b50261b85ef
files client/src/components/fairway/AvailableFairwayDepthDialogue.vue client/src/components/fairway/AvailableFairwayDepthLNWL.vue client/src/store/fairwayavailability.js
diffstat 3 files changed, 36 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepthDialogue.vue	Mon May 27 09:33:05 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthDialogue.vue	Mon May 27 09:57:54 2019 +0200
@@ -467,7 +467,13 @@
           from: this.from,
           to: this.to,
           frequency: this.frequency,
-          LOS: this.los
+          LOS: this.los,
+          type: this.type,
+          depthLimit1: this.depthLimit1,
+          depthLimit2: this.depthLimit2,
+          widthLimit1: this.widthLimit1,
+          widthLimit2: this.widthLimit2,
+          limitingFactor: this.limitingFactor
         })
         .then(() => {
           this.$store.commit(
--- a/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Mon May 27 09:33:05 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Mon May 27 09:57:54 2019 +0200
@@ -571,7 +571,7 @@
           return this.yScale(d);
         })
         .attr("width", this.ldcWidth)
-        .attr("fill", d => {
+        .attr("fill", () => {
           return this.$options.LWNLCOLORS.LDC;
         });
     },
--- a/client/src/store/fairwayavailability.js	Mon May 27 09:33:05 2019 +0200
+++ b/client/src/store/fairwayavailability.js	Mon May 27 09:57:54 2019 +0200
@@ -127,54 +127,6 @@
   });
 };
 
-/**
- * transformAFDLNWL
- * @param {*} csv
- *
- * takes the afd csv and transforms it to an intermediary format
- * for display of diagrams
- *
- * Incoming csv Format
- * #time,#LDC < 162.000 [%],#LDC >= 162.000 [%],#d < 230.000 [%],#d >= 230.000 [%],#d >= 250.000 [%]
- * 05-2018,0.000,0.000,0.000,0.000,16.163
- * 06-2018,0.000,0.000,0.000,0.000,16.701
- * 07-2018,0.000,0.000,0.000,0.000,16.163
- * 08-2018,0.000,0.000,0.000,0.000,16.163
- * 09-2018,0.000,0.000,0.000,0.000,16.701
- * 10-2018,0.000,0.000,0.000,0.000,16.163
- * 11-2018,0.000,0.000,0.000,0.000,16.701
- * 12-2018,0.000,0.000,0.000,0.000,16.163
- * 01-2019,0.000,0.000,0.000,0.000,16.163
- * 02-2019,0.000,0.000,0.000,0.000,17.894
- * 03-2019,0.000,0.000,0.000,0.000,16.163
- * 04-2019,0.000,0.000,0.000,0.000,16.701
- * 05-2019,0.000,16.163,0.000,0.000,16.163
- */
-// CURRENTLY UNUSED
-// const transformAFDLNWL = csv => {
-//   return csv.map(e => {
-//     const result = e.split(",");
-//     let [label, lowldc, ldc, lower, middle, highestLevel] = result;
-//     let levelsWithSum = [
-//       {
-//         height: Number(lower),
-//         translateY: 0
-//       },
-//       {
-//         height: Number(middle),
-//         translateY: Number(lower)
-//       }
-//     ];
-//     return {
-//       label: label,
-//       ldc: ldc,
-//       lowldc: lowldc,
-//       highestLevel: highestLevel,
-//       lowerLevels: levelsWithSum
-//     };
-//   });
-// };
-
 const fairwayavailability = {
   init,
   namespaced: true,
@@ -284,7 +236,7 @@
         }
         const start = encodeURIComponent("00:00:00+00:00");
         const end = encodeURIComponent("23:59:59+00:00");
-        const URL = `/data/${endpoint}/fairway-depth/${encodeURIComponent(
+        const URL = `data/${endpoint}/fairway-depth/${encodeURIComponent(
           name
         )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}${additionalParams}`;
         HTTP.get(URL, {
@@ -306,7 +258,17 @@
     },
     loadAvailableFairwayDepthLNWL: (context, options) => {
       return new Promise((resolve, reject) => {
-        const { feature, frequency, LOS } = options;
+        const {
+          feature,
+          frequency,
+          LOS,
+          depthLimit1,
+          depthLimit2,
+          widthLimit1,
+          widthLimit2,
+          limitingFactor,
+          type
+        } = options;
         let { from, to } = options;
         let name =
           feature.constructor.name === "Feature"
@@ -315,9 +277,23 @@
         [from, to] = getIntervallBorders(from, to, frequency);
         const start = encodeURIComponent("00:00:00+00:00");
         const end = encodeURIComponent("23:59:59+00:00");
-        const URL = `/data/bottleneck/availability/${encodeURIComponent(
+        let additionalParams = "";
+        let endpoint = "";
+        switch (type) {
+          case TYPES.BOTTLENECKS:
+            endpoint = "bottleneck";
+            if (limitingFactor === LIMITINGFACTORS.DEPTH)
+              additionalParams = `&breaks=${depthLimit1},${depthLimit2}`;
+            if (limitingFactor === LIMITINGFACTORS.WIDTH)
+              additionalParams = `&breaks=${widthLimit1},${widthLimit2}`;
+            break;
+          default:
+            endpoint = "bottleneck";
+            break;
+        }
+        const URL = `data/${endpoint}/availability/${encodeURIComponent(
           name
-        )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}`;
+        )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}${additionalParams}`;
         HTTP.get(URL, {
           headers: { "X-Gemma-Auth": localStorage.getItem("token") }
         })