Skip to content
Snippets Groups Projects
Commit 95eff526 authored by François Grand's avatar François Grand
Browse files

fix: backwater curve: wrong Y value passed to generated parametric section,...

fix: backwater curve: wrong Y value passed to generated parametric section, remove button in select entries

refs #496
parent 26d55b17
No related branches found
No related tags found
2 merge requests!225Release v4.17.0,!178Resolve "Courbe de remous: visualiser les profils de sections"
Pipeline #139962 passed
......@@ -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
......
<div fxLayout="row wrap" fxLayoutGap="10px">
<p>{{label}}</p>
<button mat-raised-button color="accent" id="generate-cr-sp" (click)="generateCrSp()">
{{ uitextGenerateRuSp }}
</button>
</div>
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]);
}
}
<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
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...";
}
......
......@@ -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 };
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment