Skip to content
Snippets Groups Projects
Commit f84dd896 authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #189 ajout du module Passe à bassin - nombre de bassins

simplification des chemins de configuration des modules
parent da51251f
No related branches found
No related tags found
1 merge request!42Resolve "Ajout des modules PAB "chute" et "nombre de bassins""
[
{
"id": "fs_nombre",
"type": "fieldset",
"option": "cal",
"fields": [
{
"type": "input",
"id": "DHT",
"unit": "m"
},
{
"type": "input",
"id": "N",
"unit": ""
},
{
"type": "input",
"id": "DH",
"unit": "m"
}
]
},
{
"type": "options",
"idCal": "N",
"help": "pab/nombre"
}
]
\ No newline at end of file
{
"fs_nombre": "Basin dimensions",
"DHT": "Total fall",
"N": "Number of basins",
"DH": "Fall between basins"
}
\ No newline at end of file
{
"fs_nombre": "Dimensions du bassin",
"DHT": "Chute totale",
"N": "Nombre de bassins",
"DH": "Chute entre bassins"
}
\ No newline at end of file
......@@ -13,7 +13,7 @@
"title": "Passe à poisson sur le Lez, entre Bollène et Suze",
"credits": "Hervé Capra / Irstea"
},
"calculators": [ 5, 6, 10, 9 ]
"calculators": [ 5, 6, 10, 9, 12, 13 ]
},
{
"name": "PASSE_NATURELLE",
......
......@@ -25,6 +25,9 @@ import { NotificationsService } from "../notifications/notifications.service";
@Injectable()
export class FormulaireService extends Observable {
private calculatorPaths = {};
/** list of known forms */
private _formulaires: FormulaireDefinition[];
......@@ -32,7 +35,6 @@ export class FormulaireService extends Observable {
/** to avoid loading language files multiple times */
private languageCache = {};
constructor(
private i18nService: I18nService,
private appSetupService: ApplicationSetupService,
......@@ -42,6 +44,22 @@ export class FormulaireService extends Observable {
) {
super();
this._formulaires = [];
// register calculator config paths here
this.calculatorPaths[CalculatorType.ConduiteDistributrice] = "cond_distri";
this.calculatorPaths[CalculatorType.LechaptCalmon] = "lechapt-calmon";
this.calculatorPaths[CalculatorType.SectionParametree] = "section-param";
this.calculatorPaths[CalculatorType.RegimeUniforme] = "regime-uniforme";
this.calculatorPaths[CalculatorType.CourbeRemous] = "remous";
this.calculatorPaths[CalculatorType.PabChute] = "pab-chute";
this.calculatorPaths[CalculatorType.PabDimensions] = "pab-dimensions";
this.calculatorPaths[CalculatorType.PabNombre] = "pab-nombre";
this.calculatorPaths[CalculatorType.PabPuissance] = "pab-puissance";
this.calculatorPaths[CalculatorType.Structure] = "ouvrages";
this.calculatorPaths[CalculatorType.ParallelStructure] = "parallel-structures";
this.calculatorPaths[CalculatorType.Dever] = "dever";
this.calculatorPaths[CalculatorType.Cloisons] = "cloisons";
this.calculatorPaths[CalculatorType.MacroRugo] = "macrorugo";
}
private get _intlService(): I18nService {
......@@ -172,13 +190,6 @@ export class FormulaireService extends Observable {
private newFormulaire(ct: CalculatorType, jsonState?: {}): FormulaireDefinition {
let f: FormulaireDefinition;
switch (ct) {
case CalculatorType.ConduiteDistributrice:
case CalculatorType.PabChute:
case CalculatorType.PabDimensions:
case CalculatorType.PabPuissance:
case CalculatorType.MacroRugo:
f = new FormulaireBase();
break;
case CalculatorType.LechaptCalmon:
f = new FormulaireLechaptCalmon();
......@@ -203,7 +214,7 @@ export class FormulaireService extends Observable {
break;
default:
throw new Error(`FormulaireService.newFormulaire() : type de module de calcul ${CalculatorType[ct]} non pris en charge`);
f = new FormulaireBase();
}
f.defaultProperties["calcType"] = ct;
......@@ -338,53 +349,10 @@ export class FormulaireService extends Observable {
}
public getConfigPathPrefix(ct: CalculatorType): string {
if (ct === undefined) {
throw new Error("FormulaireService.getConfigPathPrefix() : CalculatorType is undefined");
}
switch (ct) {
case CalculatorType.ConduiteDistributrice:
return "app/calculators/cond_distri/cond_distri.";
case CalculatorType.LechaptCalmon:
return "app/calculators/lechapt-calmon/lechapt-calmon.";
case CalculatorType.SectionParametree:
return "app/calculators/section-param/section-param.";
case CalculatorType.RegimeUniforme:
return "app/calculators/regime-uniforme/regime-uniforme.";
case CalculatorType.CourbeRemous:
return "app/calculators/remous/remous.";
case CalculatorType.PabDimensions:
return "app/calculators/pab-dimensions/pab-dimensions.";
case CalculatorType.PabPuissance:
return "app/calculators/pab-puissance/pab-puissance.";
case CalculatorType.Structure:
return "app/calculators/ouvrages/ouvrages.";
case CalculatorType.ParallelStructure:
return "app/calculators/parallel-structures/parallel-structures.";
case CalculatorType.Dever:
return "app/calculators/dever/dever.";
case CalculatorType.Cloisons:
return "app/calculators/cloisons/cloisons.";
case CalculatorType.MacroRugo:
return "app/calculators/macrorugo/macrorugo.";
case CalculatorType.PabChute:
return "app/calculators/pab-chute/pab-chute.";
default:
throw new Error("FormulaireService.getConfigPathPrefix() : valeur de CalculatorType " + ct + " non implémentée");
if (! this.calculatorPaths.hasOwnProperty(ct)) {
throw new Error("FormulaireService.getConfigPathPrefix() : valeur de CalculatorType " + ct + " non implémentée");
}
return "app/calculators/" + this.calculatorPaths[ct] + "/" + this.calculatorPaths[ct] + ".";
}
/**
......
......@@ -80,6 +80,7 @@
"INFO_EXTRARES_LIB_B": "Surface width (m)",
"INFO_EXTRARES_LIB_CV": "Cv: Velocity coefficient",
"INFO_EXTRARES_LIB_CVQT": "CV.QT: Corrected discharge (m³/s)",
"INFO_EXTRARES_LIB_DHR": "DHR : Residual fall (m)",
"INFO_EXTRARES_LIB_EC": "EC: Kinetic energy (m)",
"INFO_EXTRARES_LIB_ENUM_MACRORUGOFLOWTYPE": "Flow type",
"INFO_EXTRARES_LIB_FLU": "Subcritical water line",
......@@ -156,9 +157,11 @@
"INFO_OPTION_NONE_F": "None",
"INFO_OUVRAGE": "Structure",
"INFO_PABCHUTE_TITRE": "Fish ladder: fall",
"INFO_PABCHUTE_TITRE_COURT": "FL: fall",
"INFO_PABCHUTE_TITRE_COURT": "FL: fall between basins",
"INFO_PABDIMENSIONS_TITRE": "Fish ladder: dimensions",
"INFO_PABDIMENSIONS_TITRE_COURT": "FL: dimensions",
"INFO_PABNOMBRE_TITRE": "Fish ladder : number of basins",
"INFO_PABNOMBRE_TITRE_COURT": "FL : number",
"INFO_PABPUISSANCE_TITRE": "Fish ladder: dissipated power",
"INFO_PABPUISSANCE_TITRE_COURT": "FL: diss. power",
"INFO_PARALLELSTRUCTURE_TITRE": "Parallel structures",
......
......@@ -80,6 +80,7 @@
"INFO_EXTRARES_LIB_B": "Largeur au miroir (m)",
"INFO_EXTRARES_LIB_CV": "Cv: Coefficient de vitesse d'approche",
"INFO_EXTRARES_LIB_CVQT": "CV.QT: Débit corrigé (m³/s)",
"INFO_EXTRARES_LIB_DHR": "DHR: Chute résiduelle (m)",
"INFO_EXTRARES_LIB_EC": "EC: Énergie cinétique (m)",
"INFO_EXTRARES_LIB_ENUM_MACRORUGOFLOWTYPE": "Type d'écoulement",
"INFO_EXTRARES_LIB_FLU": "Ligne d'eau fluviale",
......@@ -155,10 +156,12 @@
"INFO_OPTION_NONE": "Aucun",
"INFO_OPTION_NONE_F": "Aucune",
"INFO_OUVRAGE": "Ouvrage",
"INFO_PABCHUTE_TITRE": "Passe à bassin : chute",
"INFO_PABCHUTE_TITRE": "Passe à bassin : chute entre bassins",
"INFO_PABCHUTE_TITRE_COURT": "PAB : chute",
"INFO_PABDIMENSIONS_TITRE": "Passe à bassin : dimensions",
"INFO_PABDIMENSIONS_TITRE_COURT": "PAB : dimensions",
"INFO_PABNOMBRE_TITRE": "Passe à bassin : nombre de bassins",
"INFO_PABNOMBRE_TITRE_COURT": "PAB : nombre",
"INFO_PABPUISSANCE_TITRE": "Passe à bassin : puissance dissipée",
"INFO_PABPUISSANCE_TITRE_COURT": "PAB : puissance",
"INFO_PARALLELSTRUCTURE_TITRE": "Lois d'ouvrages",
......
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