From 052907397588524330a994bdcd433eb6e4f87f11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Fri, 10 Mar 2023 09:17:08 +0100
Subject: [PATCH] refactor: Remous: make Z1,Z2 optionally undefined

refs #343
---
 src/open-channel/remous.ts        | 10 ++++++++++
 src/open-channel/remous_params.ts |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/open-channel/remous.ts b/src/open-channel/remous.ts
index 7c20f500..2e2f15a8 100644
--- a/src/open-channel/remous.ts
+++ b/src/open-channel/remous.ts
@@ -547,6 +547,16 @@ export class CourbeRemous extends SectionNub {
         return this._prms as CourbeRemousParams;
     }
 
+    public isComputable(): boolean {
+        if (super.isComputable()) {
+            // au moins Z1 ou Z2 doit être défini
+            const z1 = this.prms.Z1;
+            const z2 = this.prms.Z2;
+            return z1.isDefined || z2.isDefined;
+        }
+        return false;
+    }
+
     /**
      * Retourne la cote de fond à l'abscisse x
      * @param x abscisse en m (0 = amont)
diff --git a/src/open-channel/remous_params.ts b/src/open-channel/remous_params.ts
index 940346fc..6e86a08f 100644
--- a/src/open-channel/remous_params.ts
+++ b/src/open-channel/remous_params.ts
@@ -1,4 +1,4 @@
-import { ParamDefinition, ParamFamily } from "../internal_modules";
+import { ParamDefinition, ParamDomain, ParamFamily } from "../internal_modules";
 import { ParamDomainValue } from "../internal_modules";
 import { ParamsEquation } from "../internal_modules";
 
-- 
GitLab