Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cassiopee/nghyd
1 result
Show changes
Showing
with 342 additions and 42 deletions
......@@ -213,6 +213,11 @@
{{ uitextExportAllPbResults }}
</button>
<button mat-raised-button color="accent" id="generate-backwater-curve" *ngIf="isPAM"
(click)="generateBackwaterInPAM()" [disabled]="!generateCrPamEnabled">
{{ uitextGenerateBackwaterInPAM }}
</button>
<mat-card-content>
<calc-results id="resultsComp" [formulaire]="formulaire" (afterViewChecked)="onCalcResultsViewChecked()"></calc-results>
</mat-card-content>
......
......@@ -25,7 +25,9 @@ import {
PbCloison,
Espece,
VariatedDetails,
ParallelStructure
ParallelStructure,
MacrorugoRemous,
Props
} from "jalhyd";
import { generateValuesCombination, getUnformattedIthResult, getUnformattedIthValue } from "../../util/util";
......@@ -318,6 +320,10 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
return this.intlService.localizeText("INFO_CALCULATOR_RESULTS_EXPORT_ALL_PB_RESULTS");
}
public get uitextGenerateBackwaterInPAM() {
return this.intlService.localizeText("INFO_MACRORUGO_GENERATE_BACKWATER_CURVE");
}
public get uitextLoadPredefinedEspece(): string {
return this.intlService.localizeText("INFO_CALCULATOR_LOAD_PREDEFINED_ESPECE");
}
......@@ -578,7 +584,6 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
res = res && pstr.getChildren().length > 0;
break;
}
res = res && this._formulaire.currentNub.isComputable();
}
......@@ -700,6 +705,16 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
return this.is(CalculatorType.MacroRugoCompound);
}
// true if current Nub is MacroRugoRemous
public get isMRR() {
return this.is(CalculatorType.MacrorugoRemous);
}
// true if current Nub is MacroRugoCompound
public get isPAM() {
return this.is(CalculatorType.MacroRugo);
}
// true if current Nub is PreBarrage
public get isPB() {
return this.is(CalculatorType.PreBarrage);
......@@ -727,7 +742,7 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
// true if CourbeRemous results are present
public get hasCourbeRemousResults() {
return this.is(CalculatorType.CourbeRemous) && this.hasResults;
return (this.is(CalculatorType.CourbeRemous) || this.is(CalculatorType.MacrorugoRemous)) && this.hasResults;
}
// true if current Nub is PAR
......@@ -750,7 +765,7 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
return this.is(CalculatorType.SectionParametree);
}
// true if current Nub is PAR
// true if current Nub is CourbeRemous
public get isRemous() {
return this.is(CalculatorType.CourbeRemous);
}
......@@ -997,8 +1012,7 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
*/
public get courbeRemousPoints(): any[] {
if (this.hasCourbeRemousResults) {
const crForm = this._formulaire as FormulaireCourbeRemous;
for (const r of crForm.results) {
for (const r of this._formulaire.results) {
if (r instanceof RemousResults) {
return r.points;
}
......@@ -1016,6 +1030,10 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
);
}
public get generateCrPamEnabled(): boolean {
return this.hasResults && this.allParamsAreFixed() && !this._formulaire.currentNub.result.hasErrorMessages();
}
public get uitextGenerateParSimulationTitle(): string {
const parCalage = (this._formulaire.currentNub as Par);
if (!this.hasResults || parCalage.result.hasErrorMessages()) {
......@@ -1255,6 +1273,14 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe
this.router.navigate(["/calculator", f.uid]);
}
public async generateBackwaterInPAM() {
const nub = Session.getInstance().createSessionNub(
new Props({ calcType: CalculatorType.MacrorugoRemous, nubMacroRugo: this.formulaire.currentNub.uid})
) as MacrorugoRemous;
const f: FormulaireDefinition = await this.formulaireService.createFormulaire(CalculatorType.MacrorugoRemous, nub);
this.router.navigate(["/calculator", f.uid]);
}
/**
* Opens a modal that allows to choose a predefined Espece
* and load its values in current Espece module
......
<mat-form-field>
<mat-select [id]="selectId" [placeholder]="label" [(value)]="selectedValue" [multiple]="isMultiple">
<mat-select [id]="selectId" [placeholder]="label" [(value)]="selectedValue" [multiple]="isMultiple" (selectionChange) ="onValueChange($event)">
<mat-select-trigger *ngIf="isMultiple">
{{ selectedValue && selectedValue[0] ? entryLabel(selectedValue[0]) : '' }}
<span *ngIf="selectedValue?.length > 1" class="multiple-selection-label">
......@@ -11,7 +11,7 @@
</mat-option>
</mat-select>
<button mat-button *ngIf="showClearButton" matSuffix mat-icon-button aria-label="Clear"
(click)="selectedValue=[]; $event.stopPropagation()">
(click)="emptySelectedList($event)">
<mat-icon>close</mat-icon>
</button>
<div *ngIf="enableHelpButton" class="overlap-select">
......@@ -23,3 +23,6 @@
<div *ngIf="messageWhenEmpty" class="message-when-empty">
{{ messageWhenEmpty }}
</div>
<div *ngIf="errorMessage" class="select-error-message">
{{ errorMessage }}
</div>
......@@ -86,9 +86,11 @@
[class.select]="isSelect(cell)" [attr.rowspan]="rowSpan(cell)" [attr.colspan]="colSpan(cell)"
[title]="cellTitle(cell)">
<input matInput *ngIf="isNumberInput(cell)" step="0.00000000000001" type="number" required
[ngModel]="getCellValue(cell)" (ngModelChange)="setCellValue(cell,$event)"
(input)="inputValueChanged($event, cell)">
<input matInput *ngIf="isNumberInput(cell)" type="text" required
[ngModel]="getCellValue(cell)" (ngModelChange)="setCellValue(cell,$event)"
(input)="inputValueChanged($event, cell)" (keypress) ="invalidNANInputValue($event)"
pattern="^-?[0-9]*\.?[0-9]*$" inputmode="numeric"
>
<mat-select #selectWidget *ngIf="isSelect(cell)" [value]="cell.modelValue"
(selectionChange)="loiDebitSelected($event, cell)">
......
......@@ -1385,15 +1385,27 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni
}
public getCellValue(cell) {
if(typeof cell.model.singleValue === "string") {
cell.model.singleValue = +cell.model.singleValue;
}
return round(cell.model.singleValue, this.nDigits);
}
public setCellValue(cell, event) {
try {
cell.model.singleValue = event
cell.modelValidity = undefined;
} catch (error) {
cell.modelValidity = false;
public setCellValue(cell, $event) {
if($event !== "-" && $event !== "") {
try {
cell.model.singleValue = $event;
cell.modelValidity = undefined;
} catch (error) {
cell.modelValidity = false
}
}
}
public invalidNANInputValue(e: any) {
var rgx = /^-?[0-9]*\.?[0-9]*$/;
if(e.key.match(rgx) === null) {
e.preventDefault();
}
}
......
......@@ -187,13 +187,7 @@ export class RemousResultsComponent extends ResultsComponentDirective implements
* Retourne un peudo-paramètre variable représentant toutes les abscisses possibles
*/
private get abscissaePseudoParameter(): ParamDefinition {
const param = new ParamDefinition(undefined, "", ParamDomainValue.POS_NULL);
param.setValues(
0,
this._remousResults.Long,
this._remousResults.Dx
);
return param;
return this._remousResults.xValues;
}
/**
......
import { Component } from "@angular/core";
import { Component, EventEmitter, Output } from "@angular/core";
import { IObservable, Observer } from "jalhyd";
import { I18nService } from "../../services/internationalisation.service";
import { ChartType } from "../../results/chart-type";
......@@ -16,6 +16,9 @@ import { decodeHtml } from "../../util/util";
export class ChartTypeSelectComponent implements IObservable {
private _select: SelectFieldChartType;
@Output()
private valueChanged = new EventEmitter();
constructor(private intlService: I18nService) {
this._select = new SelectFieldChartType(undefined, this.intlService);
this._select.afterParseConfig(); // fill entries, set default value
......@@ -53,6 +56,10 @@ export class ChartTypeSelectComponent implements IObservable {
return this._select.messageWhenEmpty;
}
public get errorMessage(): string {
return undefined;
}
public get enableHelpButton(): boolean {
return false;
}
......@@ -65,6 +72,10 @@ export class ChartTypeSelectComponent implements IObservable {
return this._select.multiple;
}
public onValueChange($event) {
this.selectedValue = $event.value
this.valueChanged.emit(this.selectedValue)
}
// interface IObservable
/**
......
......@@ -18,3 +18,8 @@ mat-form-field {
color: #af1280; // like mat-error
font-weight: 500;
}
.select-error-message {
color: #af1280; // like mat-error
font-weight: 500;
}
import { Component, Input, OnInit } from "@angular/core";
import { Component, DoCheck, EventEmitter, Input, OnInit, Output } from "@angular/core";
import { SelectField } from "../../formulaire/elements/select/select-field";
import { SelectEntry } from "../../formulaire/elements/select/select-entry";
......@@ -21,17 +21,23 @@ export class SelectFieldLineComponent implements OnInit {
@Input()
private _select: SelectField;
/**
* événément de changement de valeur d'un select
*/
@Output()
private valueChanged = new EventEmitter();
public constructor(
private i18nService: I18nService,
private appSetupService: ApplicationSetupService
) {}
public get selectId() {
return this._select.id;
}
public get isMultiple(): boolean {
return this._select.multiple;
return this._select.multiple;
}
public get entries(): SelectEntry[] {
......@@ -45,6 +51,13 @@ export class SelectFieldLineComponent implements OnInit {
return this._select.messageWhenEmpty;
}
public get errorMessage(): string {
if (this._select.errorMessage !== undefined) {
return this.i18nService.localizeMessage(this._select.errorMessage);
}
}
protected entryLabel(entry: SelectEntry): string {
return decodeHtml(entry.label);
}
......@@ -53,10 +66,35 @@ export class SelectFieldLineComponent implements OnInit {
return this._select.getValue();
}
public onValueChange($event: any) {
this.selectedValue = $event.value
this.valueChanged.emit(this.selectedValue)
}
public emptySelectedList($event:any) {
this.selectedValue = [];
this.valueChanged.emit(this.selectedValue)
$event.stopPropagation();
}
public get isValid(): boolean {
return (this._select.getValue() !== undefined);
if(this._select.errorMessage !== undefined) {
return false;
}
if(this._select.getValue() !== undefined) {
if(Object.keys(this._select.getValue()).length > 0) {
return true;
}
else {
return false
}
}
else {
return false
}
}
public set selectedValue(v: SelectEntry | SelectEntry[]) {
this._select.setValue(v);
}
......
......@@ -31,7 +31,7 @@
"path": "passe-naturelle.jpg",
"credits": "S. Richard / OFB"
},
"calculators": [ 11, 17, 27 ]
"calculators": [ 11, 17, 27, 37, 38 ]
},
{
"name": "VERIFICATION",
......
{"header":{"source":"jalhyd","format_version":"1.3","created":"2024-01-12T16:25:01.546Z"},"settings":{"precision":1e-7,"maxIterations":100,"displayPrecision":3},"documentation":"# Exemple de passe « naturelle » à enrochement en rangées périodiques\n\nCet exemple illustre [les deux solutions proposées dans la documentation pour modéliser ce type de passe](assets/docs/fr/calculators/pab/passe_rangees_periodiques.html). \n\nIl est inspiré du dispositif équipant le barrage de la Bessette sur la Diège (commune de Mestes, 19). \n\n![Photo de la passe à enrochements en rangées périodiques du seuil de la Bessette à Diège](assets/docs/fr/calculators/pab/passe_rangees_periodiques_photo.png)\n\n_Crédit photo: OFB / Sylvain Richard_\n\nLe profil des cloisons est le suivant, avec 4 portions déversantes (dont une pseudo-fente) :\n\n![Coupe passe à enrochements en rangées périodiques](assets/docs/fr/calculators/pab/passe_rangees_periodiques_coupe.png)\n\n","session":[{"uid":"cHV0cm","props":{"calcType":"Cloisons","nullparams":true},"meta":{"title":"Rampe enrochements rangée périodiques (rangée amont)"},"children":[{"uid":"cXlreH","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"h1","mode":"SINGLE","value":0.48},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"a3pvcT","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"h1","mode":"SINGLE","value":0.73},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"bWI2Zn","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"h1","mode":"SINGLE","value":0.08},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"Q","mode":"CALCUL"},{"symbol":"Z1","mode":"SINGLE","value":100.33},{"symbol":"LB","mode":"SINGLE","value":4},{"symbol":"BB","mode":"SINGLE","value":3.2},{"symbol":"PB","mode":"SINGLE","value":0.95},{"symbol":"DH","mode":"SINGLE","value":0.2}]},{"uid":"NWZ1MH","props":{"calcType":"PreBarrage","nullparams":true},"meta":{"title":"Rampe enrochements rangée périodiques (pré-barrage)"},"children":[{"uid":"azE4a2","props":{"calcType":"PbBassin"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":12.8},{"symbol":"ZF","mode":"SINGLE","value":99.18}]},{"uid":"aDgxej","props":{"calcType":"PbCloison","upstreamBasin":"","downstreamBasin":"azE4a2"},"children":[{"uid":"eGVpZm","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.85},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"N3Iwc3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.6},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"cWJsYn","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100.25},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[]},{"uid":"N3Fxcm","props":{"calcType":"PbBassin"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":12.8},{"symbol":"ZF","mode":"SINGLE","value":98.98}]},{"uid":"b2k1ZT","props":{"calcType":"PbBassin"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":12.8},{"symbol":"ZF","mode":"SINGLE","value":98.78}]},{"uid":"a2NhNG","props":{"calcType":"PbBassin"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":12.8},{"symbol":"ZF","mode":"SINGLE","value":98.58}]},{"uid":"bDBtdH","props":{"calcType":"PbBassin"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":12.8},{"symbol":"ZF","mode":"SINGLE","value":98.38}]},{"uid":"MWRvd2","props":{"calcType":"PbBassin"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":12.8},{"symbol":"ZF","mode":"SINGLE","value":98.18}]},{"uid":"ZjJ1MW","props":{"calcType":"PbBassin"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":12.8},{"symbol":"ZF","mode":"SINGLE","value":97.98}]},{"uid":"Z2M4ZX","props":{"calcType":"PbCloison","upstreamBasin":"azE4a2","downstreamBasin":"N3Fxcm"},"children":[{"uid":"YmFlMW","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.65},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"OGR5d3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.4},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"eTQ1eG","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100.05},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[]},{"uid":"OGM4NW","props":{"calcType":"PbCloison","upstreamBasin":"N3Fxcm","downstreamBasin":"b2k1ZT"},"children":[{"uid":"a2tpY3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.45},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"cjN4NG","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.2},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"enRpYj","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.85},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[]},{"uid":"dTBnYm","props":{"calcType":"PbCloison","upstreamBasin":"b2k1ZT","downstreamBasin":"a2NhNG"},"children":[{"uid":"eTVsMn","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.25},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"dXoycD","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"eWE2Y3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.65},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[]},{"uid":"NTEweG","props":{"calcType":"PbCloison","upstreamBasin":"a2NhNG","downstreamBasin":"bDBtdH"},"children":[{"uid":"Z3ZncT","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.05},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"OHBxeD","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.8},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"a2xuNj","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.45},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[]},{"uid":"MmZuMD","props":{"calcType":"PbCloison","upstreamBasin":"bDBtdH","downstreamBasin":"MWRvd2"},"children":[{"uid":"dXhycT","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.85},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"Mmg3b3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.6},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"N2tmZ3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.25},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[]},{"uid":"MGR0aT","props":{"calcType":"PbCloison","upstreamBasin":"MWRvd2","downstreamBasin":"ZjJ1MW"},"children":[{"uid":"dnBwYW","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.65},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"ejhvM3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.4},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"ZTRqc2","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.05},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[]},{"uid":"Mnp5NT","props":{"calcType":"PbCloison","upstreamBasin":"ZjJ1MW","downstreamBasin":""},"children":[{"uid":"eDV4Z2","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.45},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"empvY3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.2},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"bGVid2","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.85},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[]}],"parameters":[{"symbol":"Q","mode":"CALCUL"},{"symbol":"Z1","mode":"LISTE","values":[100.05,100.08,100.33],"extensionStrategy":0},{"symbol":"Z2","mode":"LISTE","values":[98.46,98.53,98.73],"extensionStrategy":0}]},{"uid":"MTA0Zz","props":{"calcType":"Pab","nullparams":true},"meta":{"title":"Rampe enrochements rangée périodiques (passe à bassins)"},"children":[{"uid":"eXp2Z2","props":{"calcType":"Cloisons","nullparams":true},"children":[{"uid":"ZnBxcD","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.85},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"bnI3cz","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.6},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"dTNvdz","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100.25},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":4},{"symbol":"BB","mode":"SINGLE","value":3.2},{"symbol":"ZRMB","mode":"SINGLE","value":99.17999999999999},{"symbol":"ZRAM","mode":"SINGLE","value":"99.28"},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"MDBxMH","props":{"calcType":"Cloisons","nullparams":true},"children":[{"uid":"bTdjdj","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.64999999999999},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"b2VtNG","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.39999999999999},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"YjRuMz","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100.05},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":4},{"symbol":"BB","mode":"SINGLE","value":3.2},{"symbol":"ZRMB","mode":"SINGLE","value":98.97999999999999},{"symbol":"ZRAM","mode":"SINGLE","value":"99.08"},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"eXNjd2","props":{"calcType":"Cloisons","nullparams":true},"children":[{"uid":"cDVqbD","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.44999999999999},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"b2g0NG","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.19999999999999},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"b3k3am","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.85},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":4},{"symbol":"BB","mode":"SINGLE","value":3.2},{"symbol":"ZRMB","mode":"SINGLE","value":98.77999999999999},{"symbol":"ZRAM","mode":"SINGLE","value":"98.88"},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"ZHQybn","props":{"calcType":"Cloisons","nullparams":true},"children":[{"uid":"YzZ2c2","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.25},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"cTdtY3","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"dGR5cz","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.65},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":4},{"symbol":"BB","mode":"SINGLE","value":3.2},{"symbol":"ZRMB","mode":"SINGLE","value":98.58},{"symbol":"ZRAM","mode":"SINGLE","value":"98.68"},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"aTI5eD","props":{"calcType":"Cloisons","nullparams":true},"children":[{"uid":"emxncT","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.05},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"YWQ3cz","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.8},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"OHBmZT","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.45},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":4},{"symbol":"BB","mode":"SINGLE","value":3.2},{"symbol":"ZRMB","mode":"SINGLE","value":98.38},{"symbol":"ZRAM","mode":"SINGLE","value":"98.48"},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"djlrcm","props":{"calcType":"Cloisons","nullparams":true},"children":[{"uid":"dWV2Zz","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.85},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"M2g2en","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.6},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"c3MxcT","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.25},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":4},{"symbol":"BB","mode":"SINGLE","value":3.2},{"symbol":"ZRMB","mode":"SINGLE","value":98.17999999999999},{"symbol":"ZRAM","mode":"SINGLE","value":"98.28"},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"bTc5b2","props":{"calcType":"Cloisons","nullparams":true},"children":[{"uid":"NnNoeX","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.64999999999999},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"ZDc1aW","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.39999999999999},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"dTVuYz","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":99.05},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":4},{"symbol":"BB","mode":"SINGLE","value":3.2},{"symbol":"ZRMB","mode":"SINGLE","value":97.97999999999999},{"symbol":"ZRAM","mode":"SINGLE","value":"98.08"},{"symbol":"QA","mode":"SINGLE","value":0}]}],"parameters":[{"symbol":"Q","mode":"CALCUL","value":1.208},{"symbol":"Z1","mode":"LISTE","values":[100.05,100.08,100.33],"extensionStrategy":0},{"symbol":"Z2","mode":"LISTE","values":[98.46,98.53,98.73],"extensionStrategy":0}],"downWall":{"uid":"aHBpem","props":{"calcType":"CloisonAval"},"children":[{"uid":"OHJ6en","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.44999999999999},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"dHJvZz","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.19999999999999},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"bHEwcj","props":{"calcType":"Structure","loiDebit":"WeirCem88d","structureType":"SeuilRectangulaire","nullparams":true},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98.85},{"symbol":"L","mode":"SINGLE","value":1.6},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"ZRAM","mode":"SINGLE","value":"97.88"}]}}]}
\ No newline at end of file
......@@ -487,7 +487,7 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
}
}
else if (sender instanceof SessionSettings) {
// reset results if a session setting (max iterations, compute precision) has been modified
// reset results if a session setting (max iterations, compute precision) has bsseen modified
this.reset();
}
}
......
import { RemousResults } from "app/results/remous-results";
import { acSection, CourbeRemous, CourbeRemousParams, MacroRugo, MacrorugoRemous, Props, Result, Session } from "jalhyd";
import { IObservable, MacrorugoRemousParams, Nub, Verificateur} from "jalhyd/build/internal_modules";
import { FormulaireFixedVar } from "./form-fixedvar";
import { SelectField } from "../elements/select/select-field";
export class FormulaireMacrorugoRemous extends FormulaireFixedVar {
public initNub(props?: Props) {
// scan session, find first PAM
let pam: MacroRugo;
for (const n of Session.getInstance().getAllNubs()) {
if (n instanceof MacroRugo) {
pam = n;
break;
}
}
if (pam !== undefined) {
props.setPropValue("nubMacroRugo", pam.uid);
}
return super.initNub(props);
}
/** résultats de courbes de remous */
private _remousResults: RemousResults;
private resultYn: Result;
private resultYc: Result;
constructor() {
super();
this._remousResults = new RemousResults(this);
this.updateCalcResults();
this._props["varCalc"] = ""; // important
}
protected compute() {
this.reaffectResultComponents();
}
protected reaffectResultComponents() {
const mrr = this.currentNub as MacrorugoRemous;
mrr.syncSectionMacroRugo();
// variable supplémentaire à calculer
this._remousResults.extraParamSymbol = mrr.getPropValue("varCalc");
// calcul
this._remousResults.result = mrr.CalcSerie();
const prmMRR = mrr.prms as MacrorugoRemousParams;
this._remousResults.parameters = prmMRR;
// calcul
this._remousResults.result = mrr.CalcSerie();
const sect: acSection = mrr.Sn;
this.resultYn = sect.CalcSection("Yn"); // hauteur normale
this.resultYc = sect.CalcSection("Yc"); // hauteur critique
// données du graphique
this._remousResults.hauteurNormale = this.resultYn.resultElement;
this._remousResults.hauteurCritique = this.resultYc.resultElement;
if (this._remousResults.extraParamSymbol) {
this._remousResults.extraChart = !["Hs", "Hsc", "Ycor", "Ycon"].includes(this._remousResults.extraParamSymbol);
} else {
this._remousResults.extraChart = false;
}
this.updateCalcResults();
}
protected updateCalcResults() {
this._calcResults = [];
if (this._remousResults) {
// ensure help links are propagated
this._remousResults.helpLinks = this.helpLinks;
this._calcResults.push(this._remousResults);
}
}
// interface Observer
public update(sender: IObservable, data: any, props?: Props) {
// copied from FormDefinition, to avoid calling super.update() that would trigger an unwanted this.refreshFieldsets();
if (sender instanceof Nub) {
switch (data.action) {
case "resultUpdated":
// forward Nub results update notification to FormCompute objects
this.reaffectResultComponents();
break;
}
}
// copied from FormFixedVar, to avoid calling super.update()
if (data.action === "propertyChange") {
this.reset();
}
if (sender instanceof SelectField) {
this.reset(); // reset results
if (sender.id === "select_target_pam" && data.action === "select") {
this._currentNub.setPropValue("nubMacroRugo",data.value.value);
}
}
}
public resetFormResults() {
this._remousResults.reset();
this.updateCalcResults();
}
public get hasResults(): boolean {
return this._remousResults.hasResults;
}
}
......@@ -356,7 +356,7 @@ export class FormulairePrebarrage extends FormulaireFixedVar {
if(withChildren) {
prmIt = this.currentNub.parameterIterator;
} else {
prmIt = new ParamDefinitionIterator(this.currentNub.prms);
prmIt = this.currentNub.prms.iterator;
}
const uids: string[] = [];
for (const p of prmIt) {
......
......@@ -11,6 +11,7 @@ import { SelectFieldSearchedParam } from "./select-field-searched-param";
import { SelectFieldSpeciesList } from "./select-field-species-list";
import { SelectFieldTargetPass } from "./select-field-target-pass";
import { SelectFieldNubProperty } from "./select-field-nub-prop";
import { SelectFieldTargetPam } from "./select-field-target-pam";
export class SelectFieldFactory {
/**
......@@ -57,6 +58,9 @@ export class SelectFieldFactory {
case "select_upstream_basin":
return new SelectFieldUpstreamBasin(parent);
case "select_target_pam":
return new SelectFieldTargetPam(parent);
case "select_divingjetsupported":
case "select_gridprofile":
case "select_gridtype":
......
......@@ -16,6 +16,7 @@ import { SelectField } from "./select-field";
export class SelectFieldSpeciesList extends SelectField {
constructor(parent: FormulaireNode) {
super(parent);
this._messageWhenEmpty = "INFO_VERIF_SELECT_SPECIES_FIRST";
this._multiple = true;
}
......
import { ServiceFactory } from "app/services/service-factory";
import { decodeHtml } from "../../../util/util";
import { CalculatorType, MacrorugoRemous, Message, MessageCode, Session } from "jalhyd";
import { SelectField } from "./select-field";
import { FormulaireNode } from "../formulaire-node";
import { SelectEntry } from "./select-entry";
import { VERSION } from "@angular/core";
// Courbe de remous dans une passe à macro-rugo.
export class SelectFieldTargetPam extends SelectField {
constructor(parent: FormulaireNode) {
super(parent);
this._associatedProperty = "nubMacroRugo";
this._messageWhenEmpty = "INFO_MACRORUGOREMOUS_CREATE_PAM_FIRST";
}
protected populate() {
const fs = ServiceFactory.formulaireService;
// find all rock-ramp fishpass forms
const macroForms: any[] = fs.formulaires.filter((element, index, self) =>
element.calculatorType === CalculatorType.MacroRugo
);
for (const cn of macroForms) {
const calc = cn.calculatorName;
this.addEntry(this.createOrGetEntry(this._entriesBaseId + cn.uid, cn.uid, decodeHtml(calc)));
}
}
protected initSelectedValue() {
const MrUID = this.nub.getPropValue("nubMacroRugo")
if (MrUID !== undefined) {
this.setValueFromId(this._entriesBaseId + MrUID);
}
}
public updateLocalisation() {
// do not override localisation done in populate()
// ie. avoid what is done by SelectField.updateLocalisation()
}
public get errorMessage(): Message {
const v = this.getValue();
if (v instanceof SelectEntry) {
const nubUid = v.value;
const nub = Session.getInstance().findNubByUid(nubUid);
if (nub.resultHasMultipleValues()) {
return new Message(MessageCode.ERROR_MACRORUGOREMOUS_VARIATED_TARGET_PAM);
}
else {
return undefined;
}
}
}
}
......@@ -4,7 +4,7 @@ import { arraysAreEqual } from "../../../util/util";
import { FormulaireNode } from "../formulaire-node";
import { ServiceFactory } from "app/services/service-factory";
import { FormulaireDefinition } from "../../definition/form-definition";
import { enumValueFromString, Nub } from "jalhyd";
import { enumValueFromString, Message, Nub } from "jalhyd";
export abstract class SelectField extends Field {
......@@ -80,9 +80,10 @@ export abstract class SelectField extends Field {
const valueChanged = (
(previousSelectedEntry === undefined && v !== undefined)
|| (
previousSelectedEntry !== undefined && v !== undefined &&
!Array.isArray(previousSelectedEntry)
&& !Array.isArray(v)
&& previousSelectedEntry.id !== v.id
&& previousSelectedEntry?.id !== v?.id
)
|| (
Array.isArray(previousSelectedEntry)
......@@ -292,14 +293,23 @@ export abstract class SelectField extends Field {
return this._entriesBaseId;
}
public isEmptySelectField() {
return this._selectedEntry !== undefined && Object.keys(this._selectedEntry).length === 0;
}
public get messageWhenEmpty(): string {
let msg: string;
if (this._selectedEntry === undefined && this._messageWhenEmpty) {
if ((this._selectedEntry === undefined && this._messageWhenEmpty) || this.isEmptySelectField()) {
msg = ServiceFactory.i18nService.localizeText(this._messageWhenEmpty);
}
return msg;
}
public get errorMessage(): Message {
return undefined;
}
public get multiple(): boolean {
return this._multiple;
}
......
......@@ -83,6 +83,13 @@ export class RemousResults extends CalculatorResults {
this._hasTor = false;
this._hasExtra = false;
this._extraChart = false;
// série de valeurs de X
this._xValues = new ParamDefinition(
undefined,
"ABSCISSE",
ParamDomainValue.POS_NULL
);
}
public set parameters(p: CourbeRemousParams) {
......@@ -100,13 +107,6 @@ export class RemousResults extends CalculatorResults {
// pas d'espace
this._Dx = nub.getParameter("Dx").singleValue;
// série de valeurs de X
this._xValues = new ParamDefinition(
p,
"ABSCISSE",
ParamDomainValue.POS_NULL
);
// cote de fond amont
this._ZF1 = nub.getParameter("ZF1").singleValue;
......@@ -122,6 +122,10 @@ export class RemousResults extends CalculatorResults {
return this._varResults;
}
public get xValues(): ParamDefinition {
return this._xValues;
}
public get result(): Result {
return this._result;
}
......
/* eslint-disable @typescript-eslint/member-ordering */
import { Injectable } from "@angular/core";
import { decode } from "he";
......@@ -59,6 +60,8 @@ import { FormulairePrebarrage } from "../formulaire/definition/form-prebarrage";
import { ServiceFactory } from "./service-factory";
import { FormulairePressureLoss } from "app/formulaire/definition/form-pressureloss";
import { getNubResultUnit } from "jalhyd";
import { FormulaireMacrorugoRemous } from "app/formulaire/definition/form-macrorugo-remous";
// import { FormulaireMacrorugo } from "app/formulaire/definition/form-macrorugo";
@Injectable()
export class FormulaireService extends Observable {
......@@ -344,6 +347,10 @@ export class FormulaireService extends Observable {
f = new FormulairePressureLoss();
break;
case CalculatorType.MacrorugoRemous:
f = new FormulaireMacrorugoRemous();
break;
default:
f = new FormulaireFixedVar();
}
......@@ -866,8 +873,12 @@ export class FormulaireService extends Observable {
if (this.currentForm.currentNub instanceof SectionNub) {
const sn: SectionNub = this.currentForm.currentNub;
if (sn instanceof RegimeUniforme || sn instanceof CourbeRemous) {
// change _If visibility to copy section
sn.section.prms.If.visible = true;
// copy section
const serialisedSection = sn.section.serialise();
// Reinitialize _If visibility
sn.section.prms.If.visible = false;
const sectionCopy: acSection = Session.getInstance().unserialiseSingleNub(serialisedSection, false).nub as acSection;
if (Y !== undefined) {
sectionCopy.prms.Y.singleValue = Y;
......