Commit 751d5a8d authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

Fix nghyd#226

Showing with 33 additions and 18 deletions
+33 -18
......@@ -2,7 +2,6 @@ import { CalculatorType } from "../compute-node";
import { Nub } from "../index";
import { ParamCalculability } from "../param/param-definition";
import { ParallelStructure } from "../structure/parallel_structure";
import { StructureParams } from "../structure/structure";
import { StructureKiviParams } from "../structure/structure_kivi";
import { loiAdmissiblesCloisons, LoiDebit } from "../structure/structure_props";
import { Result } from "../util/result";
......@@ -23,13 +22,6 @@ export class Cloisons extends ParallelStructure {
return this._prms as CloisonsParams;
}
/**
* Is the cloison used in a PAB?
*/
get isInPAB(): boolean {
return (this.parent !== undefined);
}
public getLoisAdmissibles(): { [key: string]: LoiDebit[]; } {
return loiAdmissiblesCloisons;
}
......@@ -84,14 +76,7 @@ export class Cloisons extends ParallelStructure {
}
public adjustChildParameters(child: Nub) {
const prms = child.prms as StructureParams;
if (!this.isInPAB && prms.ZDV.visible) {
// Dans le contexte hors PAB
// Pour les seuils (i.e. Structures avec cote de radier de seuil)
// on remplace ZDV par h1 la charge sur le seuil
prms.h1.visible = true;
prms.ZDV.visible = false;
}
super.adjustChildParameters(child);
if (child.prms instanceof StructureKiviParams) {
// hide ZRAM for KIVI, in Cloisons and PAB context only
child.prms.ZRAM.visible = false;
......
......@@ -54,7 +54,7 @@ export class Pab extends Nub {
/**
* Last wall at downstream
*/
public downWall: ParallelStructure;
private _downWall: ParallelStructure;
constructor(prms: PabParams, downWall: ParallelStructure, dbg: boolean = false) {
super(prms, dbg);
......@@ -62,6 +62,17 @@ export class Pab extends Nub {
this._calcType = CalculatorType.Pab;
}
public get downWall() {
return this._downWall;
}
public set downWall(dw: ParallelStructure) {
this._downWall = dw;
if (dw) { // might be undefined
dw.parent = this; // important
}
}
/**
* Add Cloisons to the PAB from a cloison model
* @param cloisonModel Cloison model parametrised as first upstream basin
......
import { CalculatorType } from "../compute-node";
import { Nub } from "../nub";
import { Pab } from "../pab/pab";
import { ParamCalculability } from "../param/param-definition";
import { ParamsEquation } from "../param/params-equation";
import { Session } from "../session";
import { Result } from "../util/result";
import { ParallelStructureParams } from "./parallel_structure_params";
import { Structure } from "./structure";
import { Structure, StructureParams } from "./structure";
import { loiAdmissiblesOuvrages, LoiDebit } from "./structure_props";
export { ParallelStructureParams };
......@@ -38,6 +39,24 @@ export class ParallelStructure extends Nub {
return this._prms as ParallelStructureParams;
}
/**
* Is the Nub used in a PAB?
*/
get isInPAB(): boolean {
return (this.parent !== undefined && this.parent instanceof Pab);
}
public adjustChildParameters(child: Nub) {
const prms = child.prms as StructureParams;
if (!this.isInPAB && prms.ZDV.visible) {
// Dans le contexte hors PAB
// Pour les seuils (i.e. Structures avec cote de radier de seuil)
// on remplace ZDV par h1 la charge sur le seuil
prms.h1.visible = true;
prms.ZDV.visible = false;
}
}
/** Returns admissible LoiDebit grouped by StructureType */
public getLoisAdmissibles(): { [key: string]: LoiDebit[]; } {
return loiAdmissiblesOuvrages;
......
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