Commit 874bbfa6 authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

PAB: improved addChild postprocessing for deserialization

Showing with 20 additions and 10 deletions
+20 -10
......@@ -71,6 +71,8 @@ export class Pab extends Nub {
this._downWall = dw;
if (dw) { // might be undefined
dw.parent = this; // important
// postprocessing
this.adjustDownwallParameters(this.downWall);
}
}
......@@ -90,21 +92,12 @@ export class Pab extends Nub {
for (let i = 0; i < n; i++) {
const cl: Cloisons = Session.getInstance().unserialiseSingleNub(serialisedCloisonModel).nub as Cloisons;
const p = cl.prms;
for (const st of cl.structures) {
if (st.prms.h1.visible) {
// Set ZDV from h1 for rectangular weirs
st.prms.ZDV.singleValue = this.prms.Z1.currentValue - st.prms.h1.currentValue;
// Set parameter visibility for ZDV and h1 in PAB context
st.prms.ZDV.visible = true;
st.prms.h1.visible = false;
}
}
p.ZRMB.singleValue = ZRMB - i * DH;
p.ZRAM.singleValue = ZRAM - i * DH;
// Set Structure ZDVs
for (const st of cl.structures) {
if (st.isZDVcalculable) {
st.prms.ZDV.singleValue = st.prms.ZDV.currentValue - i * DH;
st.prms.ZDV.singleValue = (this.prms.Z1.currentValue - st.prms.h1.currentValue) - i * DH;
if (st.getParameter("ZT") !== undefined) {
const stTT = st as StructureTriangularTruncWeirFree;
stTT.prms.ZT.singleValue = stTT.prms.ZT.currentValue - i * DH;
......@@ -266,6 +259,23 @@ export class Pab extends Nub {
child.prms.Z1.visible = false;
child.prms.PB.visible = false;
child.prms.DH.visible = false;
for (const st of child.structures) {
if (st.prms.h1.visible) {
// Set parameter visibility for ZDV and h1 in PAB context
st.prms.ZDV.visible = true;
st.prms.h1.visible = false;
}
}
}
/**
* Remove visibility of downwall hydraulic parameters, for serialisation
* @param dw
*/
protected adjustDownwallParameters(dw: ParallelStructure) {
dw.prms.Q.visible = false;
dw.prms.Z1.visible = false;
dw.prms.Z2.visible = false;
}
private calcCloisonZ1(cl: ParallelStructure, Z: number): number {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment