From 8d3315cec5c94b80d6484d6912afe581a6fc1cb6 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Fri, 27 Sep 2019 15:57:24 +0200
Subject: [PATCH] Fix #295 add Pente module

---
 docs-fr/calculators/hsl/pente.md            | 12 ++++++++++++
 jalhyd_branch                               |  2 +-
 mkdocs.yml                                  |  1 +
 src/app/calculators/pente/pente.config.json | 17 +++++++++++++++++
 src/app/calculators/pente/pente.en.json     |  7 +++++++
 src/app/calculators/pente/pente.fr.json     |  7 +++++++
 src/app/config.json                         |  2 +-
 src/app/services/formulaire.service.ts      |  1 +
 src/locale/messages.en.json                 |  2 ++
 src/locale/messages.fr.json                 |  2 ++
 10 files changed, 51 insertions(+), 2 deletions(-)
 create mode 100644 docs-fr/calculators/hsl/pente.md
 create mode 100644 src/app/calculators/pente/pente.config.json
 create mode 100644 src/app/calculators/pente/pente.en.json
 create mode 100644 src/app/calculators/pente/pente.fr.json

diff --git a/docs-fr/calculators/hsl/pente.md b/docs-fr/calculators/hsl/pente.md
new file mode 100644
index 000000000..606c4428c
--- /dev/null
+++ b/docs-fr/calculators/hsl/pente.md
@@ -0,0 +1,12 @@
+# Pente
+
+Cet outil permet de calculer la valeur manquante des quatre grandeurs :
+
+- la cote amont (\(Z_1\)) en m;
+- la cote aval (\(Z_2\)) en m;
+- la longueur (\(L\)) en m;
+- la pente (\(I\)) en m/m;
+
+## Formule
+
+$$I = \frac{(Z_1 - Z_2)}{L}$$
diff --git a/jalhyd_branch b/jalhyd_branch
index d51eab3aa..16cc54ad7 100644
--- a/jalhyd_branch
+++ b/jalhyd_branch
@@ -1 +1 @@
-114-ajout-du-module-devalaison-pertes-de-charge-grille-de-prise-d-eau
+143-module-de-calcul-pente
diff --git a/mkdocs.yml b/mkdocs.yml
index c8a9621dd..b43cc3726 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -29,6 +29,7 @@ nav:
         - Régime uniforme: calculators/hsl/regime_uniforme.md
         - calculators/hsl/courbe_remous.md
         - calculators/hsl/section_parametree.md
+        - calculators/hsl/pente.md
         - calculators/hsl/types_sections.md
         - calculators/hsl/var_hydrauliques.md
     - Lois d'ouvrages:
diff --git a/src/app/calculators/pente/pente.config.json b/src/app/calculators/pente/pente.config.json
new file mode 100644
index 000000000..69c014d2a
--- /dev/null
+++ b/src/app/calculators/pente/pente.config.json
@@ -0,0 +1,17 @@
+[
+    {
+        "id": "fs_pente",
+        "type": "fieldset",
+        "fields": [
+            "Z1",
+            "Z2",
+            "L",
+            "I"
+        ]
+    },
+    {
+        "type": "options",
+        "idCal": "I",
+        "help": "hsl/pente.html"
+    }
+]
\ No newline at end of file
diff --git a/src/app/calculators/pente/pente.en.json b/src/app/calculators/pente/pente.en.json
new file mode 100644
index 000000000..5c6b218b5
--- /dev/null
+++ b/src/app/calculators/pente/pente.en.json
@@ -0,0 +1,7 @@
+{
+    "fs_pente": "Length and slope",
+    "Z1": "Upstream elevation",
+    "Z2": "Downstream elevation",
+    "L": "Length",
+    "I": "Slope"
+}
\ No newline at end of file
diff --git a/src/app/calculators/pente/pente.fr.json b/src/app/calculators/pente/pente.fr.json
new file mode 100644
index 000000000..94ef7efa7
--- /dev/null
+++ b/src/app/calculators/pente/pente.fr.json
@@ -0,0 +1,7 @@
+{
+    "fs_pente": "Longueur et pente",
+    "Z1": "Cote amont",
+    "Z2": "Cote aval",
+    "L": "Longueur",
+    "I": "Pente"
+}
\ No newline at end of file
diff --git a/src/app/config.json b/src/app/config.json
index 39993d6b2..d7fa13874 100644
--- a/src/app/config.json
+++ b/src/app/config.json
@@ -38,7 +38,7 @@
                 "path": "surface-libre.jpg",
                 "credits": "David Dorchies / Irstea"
             },
-            "calculators": [ 2, 3, 4 ]
+            "calculators": [ 2, 3, 4, 20 ]
         },
         {
             "name": "HYDRAULIQUE_EN_CHARGE",
diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts
index 74a2e3100..8741f40e1 100644
--- a/src/app/services/formulaire.service.ts
+++ b/src/app/services/formulaire.service.ts
@@ -81,6 +81,7 @@ export class FormulaireService extends Observable {
         this.calculatorPaths[CalculatorType.MacroRugoCompound] = "macrorugo-compound";
         this.calculatorPaths[CalculatorType.Jet] = "jet";
         this.calculatorPaths[CalculatorType.Grille] = "grille";
+        this.calculatorPaths[CalculatorType.Pente] = "pente";
     }
 
     private get _intlService(): I18nService {
diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json
index 28cbff763..e070884cc 100644
--- a/src/locale/messages.en.json
+++ b/src/locale/messages.en.json
@@ -294,6 +294,8 @@
     "INFO_MENU_DIAGRAM_TITLE": "Modules diagram",
     "INFO_MACRORUGOCOMPOUND_TITRE": "Compound rock-ramp fishpasses (beta)",
     "INFO_MACRORUGOCOMPOUND_TITRE_COURT": "Compound RR",
+    "INFO_PENTE_TITRE": "Slope",
+    "INFO_PENTE_TITRE_COURT": "Slope",
     "INFO_MENU_EMPTY_SESSION_TITLE": "New session",
     "INFO_MENU_HELP_TITLE": "Help",
     "INFO_MENU_LOAD_SESSION_TITLE": "Load session",
diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json
index 5b901c41c..7f78962c3 100644
--- a/src/locale/messages.fr.json
+++ b/src/locale/messages.fr.json
@@ -293,6 +293,8 @@
     "INFO_MENU_DIAGRAM_TITLE": "Diagramme des modules",
     "INFO_MACRORUGOCOMPOUND_TITRE": "Passe à macro-rugosités complexe (beta)",
     "INFO_MACRORUGOCOMPOUND_TITRE_COURT": "M-Rugo complexe",
+    "INFO_PENTE_TITRE": "Pente",
+    "INFO_PENTE_TITRE_COURT": "Pente",
     "INFO_MENU_EMPTY_SESSION_TITLE": "Nouvelle session",
     "INFO_MENU_HELP_TITLE": "Aide",
     "INFO_MENU_LOAD_SESSION_TITLE": "Charger une session",
-- 
GitLab