From 414884c19db16bdbc8b51775bca1294b97e80a12 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Fri, 29 Nov 2019 17:26:35 +0100
Subject: [PATCH] MacroRugoCompound with inclined apron: display lateral
 inclination

---
 .../macrorugo-compound-results.component.html |  4 ++++
 .../macrorugo-compound-results.component.scss |  9 ++++++++
 .../macrorugo-compound-results.component.ts   | 22 ++++++++++++++++++-
 src/locale/messages.en.json                   |  1 +
 src/locale/messages.fr.json                   |  1 +
 5 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.html b/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.html
index 58fb3b861..bfbf59270 100644
--- a/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.html
+++ b/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.html
@@ -12,6 +12,10 @@
         <macrorugo-compound-results-table *ngIf="hasDisplayableResults" [results]="mrcResults"></macrorugo-compound-results-table>
     </div>
 
+    <div id="mrcLateralInclination" *ngIf="isInclined">
+        <strong [innerHTML]="uitextLateralInclination"></strong> {{ lateralInclination }}
+    </div>
+
     <quicknav *ngIf="hasDisplayableResults" [items]="[ 'input', 'results', 'charts' ]"
         [currentItem]="'charts'" [align]="'left'"></quicknav>
 
diff --git a/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.scss b/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.scss
index 446313ba6..961f3a25b 100644
--- a/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.scss
+++ b/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.scss
@@ -2,3 +2,12 @@ results-chart {
     margin-left: 1em;
     margin-right: 1em;
 }
+
+#mrcLateralInclination {
+    margin-top: 1em;
+    margin-bottom: 2em;
+
+    > strong {
+        font-weight: bold;
+    }
+}
diff --git a/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.ts b/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.ts
index 13aba7855..a969d0cce 100644
--- a/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.ts
+++ b/src/app/components/macrorugo-compound-results/macrorugo-compound-results.component.ts
@@ -1,6 +1,8 @@
 import { Component, ViewChild, DoCheck } from "@angular/core";
 
-import { Result, cLog, Message, MessageCode, MessageSeverity } from "jalhyd";
+import { Result, cLog, Message, MessageCode, MessageSeverity, MacrorugoCompound } from "jalhyd";
+
+import { fv } from "../../../app/util";
 
 import { LogComponent } from "../../components/log/log.component";
 import { CalculatorResults } from "../../results/calculator-results";
@@ -310,6 +312,24 @@ export class MacrorugoCompoundResultsComponent implements DoCheck {
         return this.i18nService.localizeText("INFO_TITREJOURNAL_GLOBAL");
     }
 
+    public get uitextLateralInclination(): string {
+        return this.i18nService.localizeText("INFO_MACRORUGOCOMPOUND_LINCL");
+    }
+
+    public get isInclined(): boolean {
+        return (
+            this.mrcResults
+            && this.mrcResults.result
+            && this.mrcResults.result.sourceNub
+            && this.mrcResults.result.sourceNub.properties.getPropValue("inclinedApron")
+        );
+    }
+
+    public get lateralInclination(): string {
+        const lincl = this.mrcResults.result.resultElements[this._mrcResults.variableIndex].values.LIncl;
+        return fv(lincl);
+    }
+
     /** builds a set of PlottableData from MacrorugoCompoundResults, to feed the chart */
     protected get plottableResults(): PlottableData {
         this._plottableResults.setMrcResults(this.mrcResults);
diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json
index 11cdf1402..93da9f31d 100644
--- a/src/locale/messages.en.json
+++ b/src/locale/messages.en.json
@@ -315,6 +315,7 @@
     "INFO_MENU_DIAGRAM_TITLE": "Modules diagram",
     "INFO_MACRORUGOCOMPOUND_TITRE": "Compound rock-ramp fishpasses (beta)",
     "INFO_MACRORUGOCOMPOUND_TITRE_COURT": "Compound RR",
+    "INFO_MACRORUGOCOMPOUND_LINCL": "Lateral inclination (m/m): ",
     "INFO_PENTE_TITRE": "Slope",
     "INFO_PENTE_TITRE_COURT": "Slope",
     "INFO_MENU_EMPTY_SESSION_TITLE": "New session",
diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json
index f2621fea8..66b5a00b7 100644
--- a/src/locale/messages.fr.json
+++ b/src/locale/messages.fr.json
@@ -314,6 +314,7 @@
     "INFO_MENU_DIAGRAM_TITLE": "Diagramme des modules",
     "INFO_MACRORUGOCOMPOUND_TITRE": "Passe à macro-rugosités complexe (beta)",
     "INFO_MACRORUGOCOMPOUND_TITRE_COURT": "M-Rugo complexe",
+    "INFO_MACRORUGOCOMPOUND_LINCL": "Dévers latéral (m/m)&nbsp;:",
     "INFO_PENTE_TITRE": "Pente",
     "INFO_PENTE_TITRE_COURT": "Pente",
     "INFO_MENU_EMPTY_SESSION_TITLE": "Nouvelle session",
-- 
GitLab