Commit 7fbdbd75 authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Added skeleton for MacrorugoCompound

parent 5f65e072
...@@ -274,6 +274,8 @@ Custom Material SVG Icons will only show up when the application is deployed on ...@@ -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. 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 # Create PDF from documentation
```sh ```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 { ...@@ -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 @@ ...@@ -24,7 +24,7 @@
"title": "Passe à poisson sur le petit Buech, seuil de Chiala ou des Savoillons", "title": "Passe à poisson sur le petit Buech, seuil de Chiala ou des Savoillons",
"credits": "Catherine Tailleux / Irstea" "credits": "Catherine Tailleux / Irstea"
}, },
"calculators": [ 11 ] "calculators": [ 11, 17 ]
}, },
{ {
"name": "HYDRAULIQUE_A_SURFACE_LIBRE", "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 { ...@@ -227,6 +227,9 @@ export class FieldSet extends FormulaireElement implements Observer {
this.setSelectValueFromProperty("select_target", "varCalc"); this.setSelectValueFromProperty("select_target", "varCalc");
break; 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 { ...@@ -243,6 +246,7 @@ export class FieldSet extends FormulaireElement implements Observer {
} }
const selectElement = selectField.getSelectedEntryFromValue(propVal); const selectElement = selectField.getSelectedEntryFromValue(propVal);
try { try {
console.log(`setting propval ${propVal} (propKey ${propertyKey}) on select ${selectId}`, selectElement, selectField);
selectField.setValue(selectElement); selectField.setValue(selectElement);
} catch (e) { } catch (e) {
console.error(`setSelectValueFromProperty: cannot set value ${propVal} on <select> ${selectId}`); console.error(`setSelectValueFromProperty: cannot set value ${propVal} on <select> ${selectId}`);
...@@ -358,6 +362,9 @@ export class FieldSet extends FormulaireElement implements Observer { ...@@ -358,6 +362,9 @@ export class FieldSet extends FormulaireElement implements Observer {
case "select_target": // courbes de remous, variable à calculer case "select_target": // courbes de remous, variable à calculer
this.setPropValue("varCalc", data.value.value); this.setPropValue("varCalc", data.value.value);
break; break;
case "select_pass_type": // macro-rugo complexe
this.setPropValue("inclinedApron", data.value.value);
break;
} }
break; break;
} }
......
...@@ -157,6 +157,11 @@ export class SelectField extends Field { ...@@ -157,6 +157,11 @@ export class SelectField extends Field {
this.addEntry(e); this.addEntry(e);
} }
break; 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"; ...@@ -35,6 +35,7 @@ import { FieldsetContainer } from "../..//formulaire/fieldset-container";
import { ApplicationSetupService } from "../app-setup/app-setup.service"; import { ApplicationSetupService } from "../app-setup/app-setup.service";
import { NotificationsService } from "../notifications/notifications.service"; import { NotificationsService } from "../notifications/notifications.service";
import { FormulairePab } from "../../formulaire/definition/concrete/form-pab"; import { FormulairePab } from "../../formulaire/definition/concrete/form-pab";
import { FormulaireMacrorugoCompound } from "../../formulaire/definition/concrete/form-macrorugo-compound";
@Injectable() @Injectable()
export class FormulaireService extends Observable { export class FormulaireService extends Observable {
...@@ -75,6 +76,7 @@ export class FormulaireService extends Observable { ...@@ -75,6 +76,7 @@ export class FormulaireService extends Observable {
this.calculatorPaths[CalculatorType.Cloisons] = "cloisons"; this.calculatorPaths[CalculatorType.Cloisons] = "cloisons";
this.calculatorPaths[CalculatorType.MacroRugo] = "macrorugo"; this.calculatorPaths[CalculatorType.MacroRugo] = "macrorugo";
this.calculatorPaths[CalculatorType.Pab] = "pab"; this.calculatorPaths[CalculatorType.Pab] = "pab";
this.calculatorPaths[CalculatorType.MacroRugoCompound] = "macrorugo-compound";
} }
private get _intlService(): I18nService { private get _intlService(): I18nService {
...@@ -299,6 +301,10 @@ export class FormulaireService extends Observable { ...@@ -299,6 +301,10 @@ export class FormulaireService extends Observable {
f = new FormulairePab(); f = new FormulairePab();
break; break;
case CalculatorType.MacroRugoCompound:
f = new FormulaireMacrorugoCompound();
break;
default: default:
f = new FormulaireBase(); f = new FormulaireBase();
} }
...@@ -394,6 +400,18 @@ export class FormulaireService extends Observable { ...@@ -394,6 +400,18 @@ export class FormulaireService extends Observable {
f.pabNub.downWall = newDownWall; 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; return f;
}).then(fi => { }).then(fi => {
......
...@@ -261,6 +261,8 @@ ...@@ -261,6 +261,8 @@
"INFO_LOIDEBIT_WeirVillemonte": "Notch (Villemonte 1957)", "INFO_LOIDEBIT_WeirVillemonte": "Notch (Villemonte 1957)",
"INFO_MACRORUGO_TITRE_COURT": "Rock-ramp", "INFO_MACRORUGO_TITRE_COURT": "Rock-ramp",
"INFO_MACRORUGO_TITRE": "Rock-ramp fishpasses (beta)", "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_EMPTY_SESSION_TITLE": "New session",
"INFO_MENU_HELP_TITLE": "Help", "INFO_MENU_HELP_TITLE": "Help",
"INFO_MENU_LOAD_SESSION_TITLE": "Load session", "INFO_MENU_LOAD_SESSION_TITLE": "Load session",
......
...@@ -260,6 +260,8 @@ ...@@ -260,6 +260,8 @@
"INFO_LOIDEBIT_WeirVillemonte": "Échancrure (Villemonte 1957)", "INFO_LOIDEBIT_WeirVillemonte": "Échancrure (Villemonte 1957)",
"INFO_MACRORUGO_TITRE_COURT": "Macro-rugo.", "INFO_MACRORUGO_TITRE_COURT": "Macro-rugo.",
"INFO_MACRORUGO_TITRE": "Passe à macro-rugosités (beta)", "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_EMPTY_SESSION_TITLE": "Nouvelle session",
"INFO_MENU_HELP_TITLE": "Aide", "INFO_MENU_HELP_TITLE": "Aide",
"INFO_MENU_LOAD_SESSION_TITLE": "Charger une session", "INFO_MENU_LOAD_SESSION_TITLE": "Charger une session",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment