diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 702dabc0ef9947f28672536888fe7ea722e6a48a..43b3b0b91b72b838c22cffdef3cef002145c3ab4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -123,7 +123,6 @@ import { DialogConfirmLoadSessionURLComponent } from "./components/dialog-confir import { StructureFieldsetContainerComponent } from "./components/structure-fieldset-container/structure-fieldset-container.component"; import { BasinFieldsetContainerComponent } from "./components/basin-fieldset-container/basin-fieldset-container.component"; import { PrebarrageService } from "./services/prebarrage.service"; -import { SectionDetailsEntryComponent } from "./components/section-details-entry/section-details-entry.component"; import { SelectSectionDetailsComponent } from "./components/select-section-details/select-section-details.component"; const appRoutes: Routes = [ @@ -260,7 +259,6 @@ const appRoutes: Routes = [ SessionPropertiesComponent, VarResultsComponent, VerificateurResultsComponent, - SectionDetailsEntryComponent, SelectSectionDetailsComponent ], providers: [ // services diff --git a/src/app/components/section-details-entry/section-details-entry.component.html b/src/app/components/section-details-entry/section-details-entry.component.html deleted file mode 100644 index 7ce439984e6a0f67f9b4b14fe389e24747e1e259..0000000000000000000000000000000000000000 --- a/src/app/components/section-details-entry/section-details-entry.component.html +++ /dev/null @@ -1,6 +0,0 @@ -<div fxLayout="row wrap" fxLayoutGap="10px"> - <p>{{label}}</p> - <button mat-raised-button color="accent" id="generate-cr-sp" (click)="generateCrSp()"> - {{ uitextGenerateRuSp }} - </button> -</div> diff --git a/src/app/components/section-details-entry/section-details-entry.component.scss b/src/app/components/section-details-entry/section-details-entry.component.scss deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/app/components/section-details-entry/section-details-entry.component.ts b/src/app/components/section-details-entry/section-details-entry.component.ts deleted file mode 100644 index 477c7486fc9e90fdd9f48ca73b6925d12e9c8d01..0000000000000000000000000000000000000000 --- a/src/app/components/section-details-entry/section-details-entry.component.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { Router } from '@angular/router'; -import { FormulaireDefinition } from 'app/formulaire/definition/form-definition'; -import { FormulaireService } from 'app/services/formulaire.service'; -import { I18nService } from 'app/services/internationalisation.service'; -import { fv } from 'app/util'; -import { formattedValue } from 'jalhyd'; - -/** - * Bouton d'ouverture des détails de section hydraulique pour chaque point du graphe de "courbes de remous". - * Utilisé comme entrées d'un select. - */ -@Component({ - selector: 'section-details-entry', - templateUrl: './section-details-entry.component.html', - styleUrls: ['./section-details-entry.component.scss'] -}) -export class SectionDetailsEntryComponent { - private _point: any; - - @Input() - private set point(p: any) { - this._point = p; - } - - constructor( - private intlService: I18nService, - private formulaireService: FormulaireService, - private router: Router - ) { } - - public get label(): string { - if (this._point === undefined) { - return undefined; - } - return "x : " + formattedValue(this._point.x, 1) + " y : " + fv(this._point.y); - } - - public get uitextGenerateRuSp() { - return this.intlService.localizeText("INFO_CALCULATOR_RESULTS_GENERATE_RU_SP"); - } - - /** - * Génère une SectionParametree à partir du module en cours - */ - public async generateCrSp() { - const f: FormulaireDefinition = await this.formulaireService.generateParametricSectionForm(this._point.y); - - // calculate form - f.doCompute(); - - // go to new form - this.router.navigate(["/calculator", f.uid]); - } -} diff --git a/src/app/components/select-section-details/select-section-details.component.html b/src/app/components/select-section-details/select-section-details.component.html index bbb74ee25b91ece762b95183b714fe0c3ddbb5b8..4b3a06f5c1202f3ba8f91a0d2a21e8022944c2c7 100644 --- a/src/app/components/select-section-details/select-section-details.component.html +++ b/src/app/components/select-section-details/select-section-details.component.html @@ -1,5 +1,5 @@ -<mat-select [placeholder]="uitextPlaceholder"> - <mat-option *ngFor="let p of points"> - <section-details-entry [point]=p></section-details-entry> +<mat-select [placeholder]="uitextPlaceholder" (selectionChange)="generateCrSp($event.value)"> + <mat-option *ngFor="let p of points" [value]="p"> + {{ pointLabel(p) }} </mat-option> </mat-select> \ No newline at end of file diff --git a/src/app/components/select-section-details/select-section-details.component.ts b/src/app/components/select-section-details/select-section-details.component.ts index 811e73291f5331e47be238b7e08b555ed78dc173..58516fc2d8705a05eb088dd781123b6c26fd776c 100644 --- a/src/app/components/select-section-details/select-section-details.component.ts +++ b/src/app/components/select-section-details/select-section-details.component.ts @@ -1,4 +1,9 @@ import { Component, Input } from '@angular/core'; +import { Router } from '@angular/router'; +import { FormulaireDefinition } from 'app/formulaire/definition/form-definition'; +import { FormulaireService } from 'app/services/formulaire.service'; +import { fv } from 'app/util'; +import { formattedValue } from 'jalhyd'; /** * liste déroulante de boutons de génération de formulaire "section paramétrée" @@ -25,8 +30,27 @@ export class SelectSectionDetailsComponent { } constructor( + private formulaireService: FormulaireService, + private router: Router ) { } + public pointLabel(p: any): string { + return "x : " + formattedValue(p.x, 1) + " y : " + fv(p.z); + } + + /** + * Génère une SectionParametree à partir du module en cours + */ + public async generateCrSp(p: any) { + const f: FormulaireDefinition = await this.formulaireService.generateParametricSectionForm(p.y); + + // calculate form + f.doCompute(); + + // go to new form + this.router.navigate(["/calculator", f.uid]); + } + public get uitextPlaceholder() { return "Générer une section paramétrée pour..."; } diff --git a/src/app/results/remous-results.ts b/src/app/results/remous-results.ts index 6b64caaf8a177c49e3e4951f6d0de1cc4f926158..20f412f132a1cb9bd3ee68b07880316975754a30 100644 --- a/src/app/results/remous-results.ts +++ b/src/app/results/remous-results.ts @@ -15,6 +15,12 @@ export class RemousResults extends CalculatorResults { /** pas de discrétisation */ private _Dx: number; + /** cote de fond amont */ + private _ZF1: number; + + /** cote de fond aval */ + private _ZF2: number; + /** longueur du bief */ private _Long: number; @@ -80,17 +86,19 @@ export class RemousResults extends CalculatorResults { } public set parameters(p: CourbeRemousParams) { + const nub = p.parent as Nub; + // pente du fond - this._penteFond = (p.parent as Nub).getParameter("If").singleValue; + this._penteFond = nub.getParameter("If").singleValue; // hauteur de berge - this._hautBerge = (p.parent as Nub).getParameter("YB").singleValue; + this._hautBerge = nub.getParameter("YB").singleValue; // longueur du bief - this._Long = (p.parent as Nub).getParameter("Long").singleValue; + this._Long = nub.getParameter("Long").singleValue; // pas d'espace - this._Dx = (p.parent as Nub).getParameter("Dx").singleValue; + this._Dx = nub.getParameter("Dx").singleValue; // série de valeurs de X this._xValues = new ParamDefinition( @@ -98,6 +106,12 @@ export class RemousResults extends CalculatorResults { "ABSCISSE", ParamDomainValue.POS_NULL ); + + // cote de fond amont + this._ZF1 = nub.getParameter("ZF1").singleValue; + + // cote de fond aval + this._ZF2 = nub.getParameter("ZF2").singleValue; } public get log(): cLog { @@ -125,10 +139,21 @@ export class RemousResults extends CalculatorResults { private updatePoints() { this._points = this._result.resultElements.map((re) => { - let Y = re.getValue("flu"); - if (Y === undefined) - Y = re.getValue("tor"); - return { x: re.getValue("X"), y: Y }; + const X = re.getValue("X"); + + // cote de fond + const k = X / this._Long; + const Zf = (this._ZF2 - this._ZF1) * k + this._ZF1; + + // cote de l'eau + let Z = re.getValue("flu"); + if (Z === undefined) + Z = re.getValue("tor"); + + // tirant d'eau + const Y = Z - Zf; + + return { x: X, y: Y, z: Z }; }); }