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

Added skeleton for MacrorugoCompound

parent 5f65e072
No related branches found
No related tags found
1 merge request!57WIP: Resolve "Ajout du module "Passe à macro-rugosités complexe""
Showing with 150 additions and 1 deletion
......@@ -274,6 +274,8 @@ Custom Material SVG Icons will only show up when the application is deployed on
5. **Si une nouvelle classe a été créée à l'étape 2**, dans la méthode _FormulaireService.newFormulaire()_, compléter le _switch_ pour fournir la classe à instancier.
6. Dans `config.json`, ajouter si nécessaire le numéro de CalculatorType à un ou plusieurs thèmes afin de classer le module sur la page de liste; dans le cas contraire le nouveau module apparaîtra dans une section "Autres"
# Create PDF from documentation
```sh
......
[
{
"id": "fs_hydraulique",
"type": "fieldset",
"fields": [
"Z1",
"DH"
]
},
{
"id": "fs_pass",
"type": "fieldset",
"fields": [
"If",
"Ks",
"C"
]
},
{
"id": "fs_bloc",
"type": "fieldset",
"fields": [
"PBD",
"PBH",
"Cd0"
]
},
{
"id": "fs_pass_type",
"type": "fieldset",
"fields": [
{
"id": "select_pass_type",
"type": "select",
"source": "mrc_pass_type"
}
]
},
{
"type": "options",
"idCal": "Q",
"help": "pam/macrorugo-compound"
}
]
\ No newline at end of file
{
"fs_hydraulique": "Hydraulic parameters",
"fs_pass": "Fish pass parameters",
"fs_bloc": "Blocks parameters",
"fs_pass_type": "Pass type",
"select_pass_type": "Pass type",
"If": "Slope",
"Ks": "Bottom roughness",
"C": "Block concentration",
"PBD": "Diameter",
"PBH": "Height",
"Cd0": "Shape (1 for round, 2 for square)",
"select_pass_type_0": "Multiple aprons",
"select_pass_type_1": "Inclined apron"
}
\ No newline at end of file
{
"fs_hydraulique": "Paramètres hydrauliques",
"fs_pass": "Paramètres de la passe",
"fs_bloc": "Paramètres des blocs",
"fs_pass_type": "Type de passe",
"select_pass_type": "Type de passe",
"If": "Pente",
"Ks": "Rugosité de fond",
"C": "Concentration de blocs",
"PBD": "Diamètre",
"PBH": "Hauteur",
"Cd0": "Forme (1 pour rond, 2 pour carré)",
"select_pass_type_0": "Radiers multiples",
"select_pass_type_1": "Radier incliné"
}
\ No newline at end of file
......@@ -119,6 +119,15 @@ export class CalculatorListComponent implements OnInit {
}
}
}
// @TODO on ajoute un ouvrage après l'ouverture du module de calcul "passe à macrorugosités complexe"
/* if (f instanceof FormulaireMacrorugoCompound) {
for (const e of f.allFormElements) {
if (e instanceof FieldsetContainer) {
e.addFromTemplate(0);
break;
}
}
} */
});
}
......
......@@ -24,7 +24,7 @@
"title": "Passe à poisson sur le petit Buech, seuil de Chiala ou des Savoillons",
"credits": "Catherine Tailleux / Irstea"
},
"calculators": [ 11 ]
"calculators": [ 11, 17 ]
},
{
"name": "HYDRAULIQUE_A_SURFACE_LIBRE",
......
// import { Pab } from "jalhyd";
import { FormulaireBase } from "./form-base";
import { FormResultFixedVar } from "../form-result-fixedvar";
import { FormComputeFixedVar } from "../form-compute-fixedvar";
/**
* Formulaire pour les passes à macrorugosités complexes
*/
export class FormulaireMacrorugoCompound extends FormulaireBase {
constructor() {
super();
this._formResult = new FormResultFixedVar(this);
// default properties
this._props["inclinedApron"] = "1";
// remove obsolete observer set by super()
this.removeObserver(this._formCompute);
this._formCompute = new FormComputeFixedVar(this, (this._formResult as FormResultFixedVar));
}
/* public get pabNub(): Pab {
return this.currentNub as Pab;
} */
}
......@@ -227,6 +227,9 @@ export class FieldSet extends FormulaireElement implements Observer {
this.setSelectValueFromProperty("select_target", "varCalc");
break;
case "fs_pass_type": // macro-rugo complexe
this.setSelectValueFromProperty("select_pass_type", "inclinedApron");
break;
}
}
......@@ -243,6 +246,7 @@ export class FieldSet extends FormulaireElement implements Observer {
}
const selectElement = selectField.getSelectedEntryFromValue(propVal);
try {
console.log(`setting propval ${propVal} (propKey ${propertyKey}) on select ${selectId}`, selectElement, selectField);
selectField.setValue(selectElement);
} catch (e) {
console.error(`setSelectValueFromProperty: cannot set value ${propVal} on <select> ${selectId}`);
......@@ -358,6 +362,9 @@ export class FieldSet extends FormulaireElement implements Observer {
case "select_target": // courbes de remous, variable à calculer
this.setPropValue("varCalc", data.value.value);
break;
case "select_pass_type": // macro-rugo complexe
this.setPropValue("inclinedApron", data.value.value);
break;
}
break;
}
......
......@@ -157,6 +157,11 @@ export class SelectField extends Field {
this.addEntry(e);
}
break;
case "mrc_pass_type": // macrorugo complexe: type de radier
this.addEntry(new SelectEntry(this._entriesBaseId + "0", "0"));
this.addEntry(new SelectEntry(this._entriesBaseId + "1", "1"));
break;
}
}
}
......@@ -35,6 +35,7 @@ import { FieldsetContainer } from "../..//formulaire/fieldset-container";
import { ApplicationSetupService } from "../app-setup/app-setup.service";
import { NotificationsService } from "../notifications/notifications.service";
import { FormulairePab } from "../../formulaire/definition/concrete/form-pab";
import { FormulaireMacrorugoCompound } from "../../formulaire/definition/concrete/form-macrorugo-compound";
@Injectable()
export class FormulaireService extends Observable {
......@@ -75,6 +76,7 @@ export class FormulaireService extends Observable {
this.calculatorPaths[CalculatorType.Cloisons] = "cloisons";
this.calculatorPaths[CalculatorType.MacroRugo] = "macrorugo";
this.calculatorPaths[CalculatorType.Pab] = "pab";
this.calculatorPaths[CalculatorType.MacroRugoCompound] = "macrorugo-compound";
}
private get _intlService(): I18nService {
......@@ -299,6 +301,10 @@ export class FormulaireService extends Observable {
f = new FormulairePab();
break;
case CalculatorType.MacroRugoCompound:
f = new FormulaireMacrorugoCompound();
break;
default:
f = new FormulaireBase();
}
......@@ -394,6 +400,18 @@ export class FormulaireService extends Observable {
f.pabNub.downWall = newDownWall;
}
// @TODO add aprons for existing Aprons if needed
// (when loading session only)
/* if (f.currentNub instanceof MacrorugoCompound) {
for (const struct of f.currentNub.structures) {
for (const e of f.allFormElements) {
if (e instanceof FieldsetContainer) { // @TODO manage many containers one day ?
e.addFromTemplate(0, undefined, struct);
}
}
}
} */
return f;
}).then(fi => {
......
......@@ -261,6 +261,8 @@
"INFO_LOIDEBIT_WeirVillemonte": "Notch (Villemonte 1957)",
"INFO_MACRORUGO_TITRE_COURT": "Rock-ramp",
"INFO_MACRORUGO_TITRE": "Rock-ramp fishpasses (beta)",
"INFO_MACRORUGOCOMPOUND_TITRE": "Compound rock-ramp fishpasses (beta)",
"INFO_MACRORUGOCOMPOUND_TITRE_COURT": "Compound RR",
"INFO_MENU_EMPTY_SESSION_TITLE": "New session",
"INFO_MENU_HELP_TITLE": "Help",
"INFO_MENU_LOAD_SESSION_TITLE": "Load session",
......
......@@ -260,6 +260,8 @@
"INFO_LOIDEBIT_WeirVillemonte": "Échancrure (Villemonte 1957)",
"INFO_MACRORUGO_TITRE_COURT": "Macro-rugo.",
"INFO_MACRORUGO_TITRE": "Passe à macro-rugosités (beta)",
"INFO_MACRORUGOCOMPOUND_TITRE": "Passe à macro-rugosités complexe (beta)",
"INFO_MACRORUGOCOMPOUND_TITRE_COURT": "M-Rugo complexe",
"INFO_MENU_EMPTY_SESSION_TITLE": "Nouvelle session",
"INFO_MENU_HELP_TITLE": "Aide",
"INFO_MENU_LOAD_SESSION_TITLE": "Charger une session",
......
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