From efe57c52961ac5c6f7de187fc08981a1697c4f8d Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Thu, 9 May 2019 10:21:02 +0200
Subject: [PATCH] Serialisation of PabCloisons

---
 src/pab/pab_cloisons.ts | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/pab/pab_cloisons.ts b/src/pab/pab_cloisons.ts
index ab61bbfb..2e0edc24 100644
--- a/src/pab/pab_cloisons.ts
+++ b/src/pab/pab_cloisons.ts
@@ -77,6 +77,25 @@ export class PabCloisons extends Cloisons {
         this._children = modelCloisons ? modelCloisons.structures : [];
     }
 
+    /**
+     * Returns an object representation of the Nub's current state
+     */
+    public objectRepresentation() {
+        const ret: any = {
+            uid: this.uid,
+            props: this.properties.props,
+            parameters: []
+        };
+
+        // ! do not iterate over local parameters (would copy the parameters of the Cloisons used as model),
+        // just serialise QA
+        ret.parameters.push(this.prms.QA.objectRepresentation());
+
+        // ! do not iterate over children Nubs (would copy the children of the Cloisons used as model)
+
+        return ret;
+    }
+
     /**
      * paramétrage de la calculabilité des paramètres
      */
-- 
GitLab