diff --git a/src/app/formulaire/definition/form-prebarrage.ts b/src/app/formulaire/definition/form-prebarrage.ts index f6bc246a71f0afbef840428da8f5f77db55b00ed..d791856acfe5a47a5c9780d4b88e4a5104dac066 100644 --- a/src/app/formulaire/definition/form-prebarrage.ts +++ b/src/app/formulaire/definition/form-prebarrage.ts @@ -1,4 +1,4 @@ -import { CalculatorType, PbBassin, PbCloison, IObservable, PreBarrage, VariatedDetails } from "jalhyd"; +import { CalculatorType, PbBassin, PbCloison, IObservable, PreBarrage, VariatedDetails, ParamDefinition } from "jalhyd"; import { FormulaireFixedVar } from "./form-fixedvar"; import { PbSchema } from "../elements/pb-schema"; @@ -235,15 +235,6 @@ export class FormulairePrebarrage extends FormulaireFixedVar { if (computedParam !== undefined) { this.pbResults.cloisonResults.calculatedParameter = computedParam; } - // if some parameter is variating, add id too (trick with PbResultsComponent - for (const s of this._selectedItem.structures) { - for (const p of s.parameterIterator) { - if (p.hasMultipleValues) { - const ngp = this.getParamFromSymbol(p.symbol); - this._pbResults.cloisonResults.addFixedParameter(ngp); - } - } - } // transmission des suffixes de cloisons calculés par l'algo de tri de PbSchemaComponent, // pour le sélecteur de conditions limites const pbs = this.kids[0] as PbSchema; @@ -260,10 +251,34 @@ export class FormulairePrebarrage extends FormulaireFixedVar { } } + /** + * Trouve le Ngparameter correspondant au paramètre "p", parmi tous les + * éléments du formulaire de PbCloison, qui peut contenir plusieurs + * structures ayant des paramètres de même nom + * @param param ParamDefinition + */ + public getCloisonParam(param: ParamDefinition): NgParameter { + for (const p of this.allFormElements) { + if (p instanceof NgParameter) { + if (p.paramDefinition === param) { + return p; + } + } + } + } + public addFixedParameters() { - if (this.wallForm !== undefined) { - for (const p of this.wallForm.getFixedParameters()) { - this._pbResults.cloisonResults.addFixedParameter(p); + if (this._selectedItem !== undefined && this._selectedItem instanceof PbCloison) { + for (const s of this._selectedItem.structures) { + for (const p of s.parameterIterator) { + // if some parameter is variating, add id too (trick with PbResultsComponent) + if (p.visible) { + const ngp = this.getCloisonParam(p); + if (ngp) { + this._pbResults.cloisonResults.addFixedParameter(ngp); + } + } + } } } } diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index e4f9d92bb891d1cd49b757d8195ad120a27cf721..689395becfe679c28d35c5ed6a2949e2f737d2e6 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -302,6 +302,7 @@ "INFO_LIB_STRUCTURE_SEUILTRIANGULAIRE": "Triangular weir", "INFO_LIB_STRUCTURE_SEUILTRIANGULAIRETRUNC": "Truncated triangular weir", "INFO_LIB_STRUCTURE_VANNERECTANGULAIRE": "Rectangular gate", + "INFO_LIB_STRUCTURE_N_COURT": "D", "INFO_LIB_TAU0": "Tractive force", "INFO_LIB_TOR": "Supercritical water line", "INFO_LIB_TOTAL": "Total", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index a20ca48295fdc743a1eee0d154aab7c5735ef8bf..847bae1ce70adacf735b5eac92e8db81f36b61a2 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -303,6 +303,7 @@ "INFO_LIB_STRUCTURE_SEUILTRIANGULAIRE": "Seuil triangulaire", "INFO_LIB_STRUCTURE_SEUILTRIANGULAIRETRUNC": "Seuil triangulaire tronqué", "INFO_LIB_STRUCTURE_VANNERECTANGULAIRE": "Vanne rectangulaire", + "INFO_LIB_STRUCTURE_N_COURT": "O", "INFO_LIB_TAU0": "Force tractrice", "INFO_LIB_TOR": "Ligne d'eau torrentielle", "INFO_LIB_TOTAL": "Total",