From 669ce4ff2c630e7ddb83fd966b71a2aaa858b3f5 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Thu, 26 Sep 2019 17:16:44 +0200
Subject: [PATCH] MacroRugoCompound: add Y to results

---
 .../macrorugo-compound/macrorugo-compound.en.json     |  1 +
 .../macrorugo-compound/macrorugo-compound.fr.json     |  1 +
 .../macrorugo-compound-results-table.component.ts     | 11 +++++++++++
 src/app/results/macrorugo-compound-results.ts         |  1 +
 .../results/plottable-macrorugo-compound-results.ts   |  1 +
 5 files changed, 15 insertions(+)

diff --git a/src/app/calculators/macrorugo-compound/macrorugo-compound.en.json b/src/app/calculators/macrorugo-compound/macrorugo-compound.en.json
index 6d94fcc83..e0e7a98dc 100644
--- a/src/app/calculators/macrorugo-compound/macrorugo-compound.en.json
+++ b/src/app/calculators/macrorugo-compound/macrorugo-compound.en.json
@@ -18,6 +18,7 @@
     "BR": "Total width",
     "ZF1": "Apron elevation",
     "B": "Width",
+    "Y": "Water depth",
     "xCenter": "Mid-apron abscissa",
 
     "select_pass_type_0": "Multiple aprons",
diff --git a/src/app/calculators/macrorugo-compound/macrorugo-compound.fr.json b/src/app/calculators/macrorugo-compound/macrorugo-compound.fr.json
index 1a8b5331f..2422a8c9b 100644
--- a/src/app/calculators/macrorugo-compound/macrorugo-compound.fr.json
+++ b/src/app/calculators/macrorugo-compound/macrorugo-compound.fr.json
@@ -18,6 +18,7 @@
     "BR": "Largeur totale",
     "ZF1": "Cote de radier",
     "B": "Largeur",
+    "Y": "Profondeur",
     "xCenter": "Abscisse du milieu du radier",
 
     "select_pass_type_0": "Radiers multiples",
diff --git a/src/app/components/macrorugo-compound-results/macrorugo-compound-results-table.component.ts b/src/app/components/macrorugo-compound-results/macrorugo-compound-results-table.component.ts
index 60bcf7555..e9f971bdb 100644
--- a/src/app/components/macrorugo-compound-results/macrorugo-compound-results-table.component.ts
+++ b/src/app/components/macrorugo-compound-results/macrorugo-compound-results-table.component.ts
@@ -82,11 +82,22 @@ export class MacrorugoCompoundResultsTableComponent extends ResultsComponent {
                 } catch (e) {
                     // silent fail
                 }
+                let Y: number;
+                try {
+                    if (nub.prms.Y.hasMultipleValues) {
+                        Y = nub.prms.Y.getInferredValuesList()[vi];
+                    } else {
+                        Y = nub.prms.Y.singleValue;
+                    }
+                } catch (e) {
+                    // silent fail
+                }
 
                 this._dataSet.push([
                     i + 1, // n° radier
                     (zf1 !== undefined ? zf1.toFixed(nDigits) : "-"),
                     (b !== undefined ? b.toFixed(nDigits) : "-"),
+                    (Y !== undefined ? Y.toFixed(nDigits) : "-"),
                     (res.Q !== undefined ? res.Q.toFixed(nDigits) : "-"),
                     res.Vdeb.toFixed(nDigits),
                     res.Fr.toFixed(nDigits),
diff --git a/src/app/results/macrorugo-compound-results.ts b/src/app/results/macrorugo-compound-results.ts
index fdcafd43c..4ad289da5 100644
--- a/src/app/results/macrorugo-compound-results.ts
+++ b/src/app/results/macrorugo-compound-results.ts
@@ -19,6 +19,7 @@ export class MacrorugoCompoundResults extends MultiDimensionResults {
             "RADIER_N",
             "ZF1",
             "B",
+            "Y",
             "Q",
             "Vdeb",
             "Fr",
diff --git a/src/app/results/plottable-macrorugo-compound-results.ts b/src/app/results/plottable-macrorugo-compound-results.ts
index 51e158a6f..2caf8e6ce 100644
--- a/src/app/results/plottable-macrorugo-compound-results.ts
+++ b/src/app/results/plottable-macrorugo-compound-results.ts
@@ -85,6 +85,7 @@ export class PlottableMacrorugoCompoundResults implements PlottableData {
                     break;
 
                 case "ZF1":
+                case "Y":
                 case "B":
                     let v: number;
                     const nub = this.mrcResults.childrenResults[i].sourceNub;
-- 
GitLab