diff --git a/README.md b/README.md index 2549eceba2a4da967f9cec15968303b6cf00ea02..624bb30d25d9c39fc3f4c6940b420b25021073c3 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,9 @@ Custom Material SVG Icons will only show up when the application is deployed on constructor(rL: number, rW: number, rA:number=undefined) { super(); - this._L = new ParamDefinition(this, ComputeNodeType.LechaptCalmon, 'L', ParamDomainValue.POS, rL); - this._W = new ParamDefinition(this, ComputeNodeType.LechaptCalmon, 'W', ParamDomainValue.POS, rW); - this._A = new ParamDefinition(this, ComputeNodeType.LechaptCalmon, 'A', ParamDomainValue.POS, rA); + this._L = new ParamDefinition(this, ComputeNodeType.LechaptCalmon, 'L', "m", ParamDomainValue.POS, rL); + this._W = new ParamDefinition(this, ComputeNodeType.LechaptCalmon, 'W', "m", ParamDomainValue.POS, rW); + this._A = new ParamDefinition(this, ComputeNodeType.LechaptCalmon, 'A', undefined, ParamDomainValue.POS, rA); this.addParamDefinition(this._L); this.addParamDefinition(this._W); diff --git a/e2e/cloisons.e2e-spec.ts b/e2e/cloisons.e2e-spec.ts index d3f0fc4f26f1eff749144525f1028177fb6988f2..3bbdbd921a3060c2fa8b553f4bcadd65d139d51e 100644 --- a/e2e/cloisons.e2e-spec.ts +++ b/e2e/cloisons.e2e-spec.ts @@ -37,7 +37,7 @@ describe("ngHyd − cloisons", () => { await browser.sleep(300); // 4. change LoiDebit - await calcPage.changeSelectValue(calcPage.getSelectById("select_loidebit1"), 1); + await calcPage.changeSelectValue(calcPage.getSelectById("select_loidebit"), 1); await browser.sleep(300); // 5. check number of inputs in CALC mode diff --git a/e2e/link-parallel-devices.e2e-spec.ts b/e2e/link-parallel-devices.e2e-spec.ts index d12fb0f7ba7e4c132ea9990dd34629463fca99f4..2b6c3ae58af51df8e54c85f145b0f0823a0ca848 100644 --- a/e2e/link-parallel-devices.e2e-spec.ts +++ b/e2e/link-parallel-devices.e2e-spec.ts @@ -21,14 +21,14 @@ describe("ngHyd − parallel structures with multiple linked parameters − ", ( await listPage.clickMenuEntryForCalcType(8); await calcPage.getAddStructureButton().click(); const nb1 = await calcPage.getAllLinkButtons().count(); - expect(nb1).toBe(10); // link buttons on children but not on parent + expect(nb1).toBe(8); // link buttons on children but not on parent // 2. check Passe à bassin: Cloisons await startPage.navigateTo(); await listPage.clickMenuEntryForCalcType(10); await calcPage.getAddStructureButton().click(); const nb2 = await calcPage.getAllLinkButtons().count(); - expect(nb2).toBe(4); // link buttons on children but not on parent + expect(nb2).toBe(6); // link buttons on children but not on parent // 3. check Lois de déversoirs dénoyés @@ -36,7 +36,7 @@ describe("ngHyd − parallel structures with multiple linked parameters − ", ( await listPage.clickMenuEntryForCalcType(9); await calcPage.getAddStructureButton().click(); const nb3 = await calcPage.getAllLinkButtons().count(); - expect(nb3).toBe(4); // link buttons on children but not on parent + expect(nb3).toBe(6); // link buttons on children but not on parent }); }); diff --git a/e2e/load-linked-params.e2e-spec.ts b/e2e/load-linked-params.e2e-spec.ts index a26bb90c8f644c37d553185c6567a343798e088f..d860655254a68b9b3250fc08d3c4896cf6d050e7 100644 --- a/e2e/load-linked-params.e2e-spec.ts +++ b/e2e/load-linked-params.e2e-spec.ts @@ -79,10 +79,6 @@ describe("ngHyd − load session with multiple linked parameters − ", () => { const lo_wv = await calcPage.getSelectValueText(lo_w); expect(lo_wv).toContain("Ouverture de vanne (Ouvrages, ouvrage 2)"); - const lo_cd = calcPage.getSelectById("2_linked_Cd"); - const lo_cdv = await calcPage.getSelectValueText(lo_cd); - expect(lo_cdv).toContain("Coefficient de débit (Ouvrages, ouvrage 1)"); - // 4. check Régime uniforme await navbar.clickCalculatorTab(3); await browser.sleep(500); diff --git a/e2e/load-save-session.e2e-spec.ts b/e2e/load-save-session.e2e-spec.ts index 4badbd4568284fea07dfffde76e7b70e91ce6968..54e7368084e1b2e135dec90d679bf1843fc46d33 100644 --- a/e2e/load-save-session.e2e-spec.ts +++ b/e2e/load-save-session.e2e-spec.ts @@ -59,7 +59,7 @@ describe("ngHyd − save and load sessions", () => { await listPage.clickMenuEntryForCalcType(2); // Section paramétrée await browser.sleep(500); - await calcPage.changeSelectValue(calcPage.getSelectById("select_section"), 2); // mode "circulaire" + await calcPage.changeSelectValue(calcPage.getSelectById("select_section"), 2); // mode "trapezoidal" await calcPage.getInputById("Ks").clear(); // coefficient de Strickler await browser.sleep(1000); @@ -83,7 +83,7 @@ describe("ngHyd − save and load sessions", () => { const fileContent = fs.readFileSync(filename, { encoding: "utf8" }); // tslint:disable-next-line:quotemark - expect(fileContent).toContain('"nodeType":3'); + expect(fileContent).toContain('"nodeType":1'); // tslint:disable-next-line:quotemark expect(fileContent).toContain('{"symbol":"Ks","mode":"SINGLE","value":42}'); }); diff --git a/jalhyd_branch b/jalhyd_branch index 1f7391f92b6a3792204e07e99f71f643cc35e7e1..4cc13e7cb71a58ec7660acfdd54c2b275f2529e5 100644 --- a/jalhyd_branch +++ b/jalhyd_branch @@ -1 +1 @@ -master +66-integrer-au-modele-un-maximum-d-informations-pour-alleger-la-configuration-des-modules-dans-nghyd diff --git a/protractor.conf.js b/protractor.conf.js index 1ef2cb870cc0a2576f82cebabb39908e8d47ef16..6c546c716abefb1a23c5b94b4a3228151b64cff8 100644 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -3,6 +3,11 @@ const { SpecReporter } = require('jasmine-spec-reporter'); +const path = require("path"); +const os = require("os"); + +const downloadsPath = path.resolve(os.homedir(), "Téléchargements"); + exports.config = { allScriptsTimeout: 11000, specs: [ @@ -16,7 +21,7 @@ exports.config = { download: { prompt_for_download: false, directory_upgrade: true, - default_directory: '/tmp/e2e-downloads' + // default_directory: '/tmp/e2e-downloads' }, }, }, @@ -35,5 +40,9 @@ exports.config = { }); jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); browser.manage().window().setSize(1600, 1000); + browser.driver.sendChromiumCommand('Page.setDownloadBehavior', { + behavior: 'allow', + downloadPath: downloadsPath + }); } }; diff --git a/src/app/calculators/cloisons/cloisons.config.json b/src/app/calculators/cloisons/cloisons.config.json index ea679624bfed8ac817ef405a9543b1d328dca705..e8104fbd0eeeff679e2a9dd8a71a1e6e889d8e84 100644 --- a/src/app/calculators/cloisons/cloisons.config.json +++ b/src/app/calculators/cloisons/cloisons.config.json @@ -3,43 +3,13 @@ "id": "fs_param_hydro", "type": "fieldset", "calcType": "Dever", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Q", - "symbol": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "Z1", - "option": "var", - "unit": "m" - }, - { - "type": "input", - "id": "LB", - "option": "var", - "unit": "m" - }, - { - "type": "input", - "id": "BB", - "option": "var", - "unit": "m" - }, - { - "type": "input", - "id": "PB", - "option": "var", - "unit": "m" - }, - { - "type": "input", - "id": "DH", - "unit": "m" - } + "Q", + "Z1", + "LB", + "BB", + "PB", + "DH" ] }, { @@ -49,189 +19,27 @@ "defaultNodeType": "StructureRectangle", "defaultStructType": "SeuilRectangulaire", "defaultLoiDebit": "WeirSubmergedLarinier", - "option": "cal", "fields": [ { "id": "select_ouvrage", "type": "select", - "select": [ - { - "id": "select_ouvrage_seuil_rect", - "enum": "StructureType.SeuilRectangulaire" - }, - { - "id": "select_ouvrage_orifice", - "enum": "StructureType.Orifice" - }, - { - "id": "select_ouvrage_seuil_triang", - "enum": "StructureType.SeuilTriangulaire" - }, - { - "id": "select_ouvrage_seuil_triangtrunc", - "enum": "StructureType.SeuilTriangulaireTrunc" - } - - ] - }, - { - "id": "select_loidebit1", - "type": "select", - "select": [ - { - "id": "select_loidebit1_fente", - "enum": "LoiDebit.WeirSubmergedLarinier" - }, - { - "id": "select_loidebit1_villemonte", - "enum": "LoiDebit.WeirVillemonte" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - } - ] - }, - { - "id": "select_loidebit2", - "type": "select", - "select": [ - { - "id": "select_loidebit2_orifice", - "enum": "LoiDebit.OrificeSubmerged" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_orifice" - } - ] + "source": "device_structure_type" }, { - "id": "select_loidebit3", + "id": "select_loidebit", "type": "select", - "select": [ - { - "id": "select_loidebit3_seuiltriang", - "enum": "LoiDebit.TriangularWeirFree" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - } - ] - }, - { - "id": "select_loidebit4", - "type": "select", - "select": [ - { - "id": "select_loidebit4_seuiltriangtrunc", - "enum": "LoiDebit.TriangularTruncWeirFree" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "h1", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "L", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - } - ] - }, - { - "type": "input", - "id": "Cd", - "unit": "", - "nodeType": "StructureRectangle" - }, - { - "type": "input", - "id": "S", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_loidebit2", - "refvalue": "select_loidebit2_orifice" - } - ] - }, - { - "type": "input", - "id": "alpha2", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "BT", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "ZT", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - } + "source": "device_loi_debit" + }, + "h1", + "L", + "CdWSL", + "CdWR", + "CdGR", + "CdT", + "S", + "alpha2", + "BT", + "ZT" ] }, { diff --git a/src/app/calculators/cloisons/cloisons.en.json b/src/app/calculators/cloisons/cloisons.en.json index 1eaf2a56d33257785d8ceef885d0e2d206caf3a8..983d797a5b453bb67c4a3bdf9f267245f4d18b4c 100644 --- a/src/app/calculators/cloisons/cloisons.en.json +++ b/src/app/calculators/cloisons/cloisons.en.json @@ -3,15 +3,21 @@ "ZR": "Upstream bed elevation", "PB": "Pool mean depth", "h1": "Head", - "select_ouvrage_seuil_triang": "Triangular weir", - "select_ouvrage_seuil_triangtrunc": "Truncated triangular weir", - "select_ouvrage_orifice": "Orifice", - "select_ouvrage_seuil_rect": "Rectangular weir", - "select_loidebit1_villemonte": "Villemonte 1947", - "select_loidebit1_fente": "Submerged slot (Larinier 1992)", - "select_loidebit2_orifice": "Submerged orifice", - "select_loidebit3_seuiltriang": "Free flow triangular weir", - "select_loidebit4_seuiltriangtrunc": "Free flow truncated triangular weir", + + "select_structure_SeuilTriangulaire": "Triangular weir", + "select_structure_SeuilTriangulaireTrunc": "Truncated triangular weir", + "select_structure_Orifice": "Orifice", + "select_structure_SeuilRectangulaire": "Rectangular weir", + + "select_loidebit_Orifice_OrificeSubmerged": "Submerged orifice", + + "select_loidebit_SeuilRectangulaire_WeirSubmergedLarinier": "Submerged slot (Larinier 1992)", + "select_loidebit_SeuilRectangulaire_WeirVillemonte": "Villemonte 1947", + + "select_loidebit_SeuilTriangulaire_TriangularWeirFree": "Free flow triangular weir", + + "select_loidebit_SeuilTriangulaireTrunc_TriangularTruncWeirFree": "Free flow truncated triangular weir", + "UNIT_PV": "W/m³", "UNIT_Q": "m³/s", "UNIT_YMOY": "m", diff --git a/src/app/calculators/cloisons/cloisons.fr.json b/src/app/calculators/cloisons/cloisons.fr.json index 4c2cbd9f7e9a7a27d2f33d6ad83872545a8168ef..f98900e228931e0956f512caddf4313bb46bc2d1 100644 --- a/src/app/calculators/cloisons/cloisons.fr.json +++ b/src/app/calculators/cloisons/cloisons.fr.json @@ -1,14 +1,20 @@ { "Q": "Débit total", - "select_ouvrage_seuil_triang": "Seuil triangulaire", - "select_ouvrage_seuil_triangtrunc": "Seuil triangulaire tronqué", - "select_ouvrage_orifice": "Orifice", - "select_ouvrage_seuil_rect": "Seuil rectangulaire", - "select_loidebit1_villemonte": "Villemonte 1947", - "select_loidebit1_fente": "Fente noyée (Larinier 1992)", - "select_loidebit2_orifice": "Orifice noyé", - "select_loidebit3_seuiltriang": "Déversoir triangulaire dénoyé", - "select_loidebit4_seuiltriangtrunc": "Déversoir triangulaire tronqué dénoyé", + + "select_structure_SeuilTriangulaire": "Seuil triangulaire", + "select_structure_SeuilTriangulaireTrunc": "Seuil triangulaire tronqué", + "select_structure_Orifice": "Orifice", + "select_structure_SeuilRectangulaire": "Seuil rectangulaire", + + "select_loidebit_Orifice_OrificeSubmerged": "Orifice noyé", + + "select_loidebit_SeuilRectangulaire_WeirSubmergedLarinier": "Fente noyée (Larinier 1992)", + "select_loidebit_SeuilRectangulaire_WeirVillemonte": "Villemonte 1947", + + "select_loidebit_SeuilTriangulaire_TriangularWeirFree": "Déversoir triangulaire dénoyé", + + "select_loidebit_SeuilTriangulaireTrunc_TriangularTruncWeirFree": "Déversoir triangulaire tronqué dénoyé", + "UNIT_PV": "W/m³", "UNIT_Q": "m³/s", "UNIT_YMOY": "m", diff --git a/src/app/calculators/cond_distri/cond_distri.config.json b/src/app/calculators/cond_distri/cond_distri.config.json index 7db50cfac26c96289f56bb398cd4a3b15ca47a66..87dce58d1a6fbaa6b37b615075bb1e00ccf5fa63 100644 --- a/src/app/calculators/cond_distri/cond_distri.config.json +++ b/src/app/calculators/cond_distri/cond_distri.config.json @@ -2,33 +2,12 @@ { "id": "fs_hydraulique", "type": "fieldset", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "D", - "unit": "m" - }, - { - "type": "input", - "id": "J", - "unit": "m" - }, - { - "type": "input", - "id": "Lg", - "unit": "m" - }, - { - "type": "input", - "id": "Nu", - "unit": "Pa·s" - } + "Q", + "D", + "J", + "Lg", + "Nu" ] }, { diff --git a/src/app/calculators/dever/dever.config.json b/src/app/calculators/dever/dever.config.json index 4bb14ec5eeaaab3bdfeb4f17752f6b98e07d0bb5..9b8b87dcdfb2fe7382695d6413712a11b518227b 100644 --- a/src/app/calculators/dever/dever.config.json +++ b/src/app/calculators/dever/dever.config.json @@ -3,31 +3,11 @@ "id": "fs_param_hydro", "type": "fieldset", "calcType": "Dever", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Q", - "symbol": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "Z1", - "unit": "m" - }, - { - "type": "input", - "id": "BR", - "option": "var", - "unit": "m" - }, - { - "type": "input", - "id": "ZR", - "option": "var", - "unit": "m" - } + "Q", + "Z1", + "BR", + "ZR" ] }, { @@ -37,166 +17,26 @@ "defaultNodeType": "StructureRectangle", "defaultStructType": "SeuilRectangulaire", "defaultLoiDebit": "WeirFree", - "option": "cal", "fields": [ { "id": "select_ouvrage", "type": "select", - "select": [ - { - "id": "select_ouvrage_seuil_rect", - "enum": "StructureType.SeuilRectangulaire" - }, - { - "id": "select_ouvrage_seuil_triang", - "enum": "StructureType.SeuilTriangulaire" - }, - { - "id": "select_ouvrage_seuil_triangtrunc", - "enum": "StructureType.SeuilTriangulaireTrunc" - } - ] - }, - { - "id": "select_loidebit1", - "type": "select", - "select": [ - { - "id": "select_loidebit1_seuildenoye", - "enum": "LoiDebit.WeirFree" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - } - ] - }, - { - "id": "select_loidebit3", - "type": "select", - "select": [ - { - "id": "select_loidebit3_seuiltriang", - "enum": "LoiDebit.TriangularWeirFree" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - } - ] + "source": "device_structure_type" }, { - "id": "select_loidebit4", + "id": "select_loidebit", "type": "select", - "select": [ - { - "id": "select_loidebit4_seuiltriangtrunc", - "enum": "LoiDebit.TriangularTruncWeirFree" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "ZDV", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "L", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - } - ] - }, - { - "type": "input", - "id": "Cd", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_seuildenoye" - }, - { - "refid": "select_loidebit3", - "refvalue": "select_loidebit3_seuiltriang" - }, - { - "refid": "select_loidebit3", - "refvalue": "select_loidebit4_seuiltriangtrunc" - } - ] - }, - { - "type": "input", - "id": "alpha2", - "unit": "°", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "BT", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "ZT", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - } + "source": "device_loi_debit" + }, + "ZDV", + "L", + "CdWSL", + "CdWR", + "CdGR", + "CdT", + "alpha2", + "BT", + "ZT" ] }, { diff --git a/src/app/calculators/dever/dever.en.json b/src/app/calculators/dever/dever.en.json index a488c994589b8290273a1544b82cae5d9e170b4b..9d4f6f0d5dafc5c1e6ee30588b1716bd4d6b5aad 100644 --- a/src/app/calculators/dever/dever.en.json +++ b/src/app/calculators/dever/dever.en.json @@ -2,14 +2,17 @@ "Q": "Total Flow", "ZR": "Upstream bed elevation", "BR": "Upstream bed width", - "select_ouvrage_seuil_rect": "Rectangular weir", - "select_ouvrage_seuil_triang": "Triangular weir", - "select_ouvrage_seuil_triangtrunc": "Truncated triangular weir", - "select_loidebit1_seuildenoye": "Free flow rectangular weir", - "select_loidebit3_seuiltriang": "Free flow triangular weir", - "select_loidebit4_seuiltriangtrunc": "Free flow truncated triangular weir", "L": "Width of the weir", "Cd": "Discharge coefficient", + + "select_structure_SeuilRectangulaire": "Rectangular weir", + "select_structure_SeuilTriangulaire": "Triangular weir", + "select_structure_SeuilTriangulaireTrunc": "Truncated triangular weir", + + "select_loidebit_SeuilRectangulaire_WeirFree": "Free flow rectangular weir", + "select_loidebit_SeuilTriangulaire_TriangularWeirFree": "Free flow triangular weir", + "select_loidebit_SeuilTriangulaireTrunc_TriangularTruncWeirFree": "Free flow truncated triangular weir", + "UNIT_CVQT": "m³/s", "UNIT_Q": "m³/s", "UNIT_EC": "m", diff --git a/src/app/calculators/dever/dever.fr.json b/src/app/calculators/dever/dever.fr.json index ec276acc334fedb4943fc0e8cf88b7e0cc3489b6..d4e462ff3c316c3480d2de67083d3dd5145ef6f7 100644 --- a/src/app/calculators/dever/dever.fr.json +++ b/src/app/calculators/dever/dever.fr.json @@ -2,14 +2,17 @@ "Q": "Débit total", "ZR": "Cote du lit amont", "BR": "Largeur du lit amont", - "select_ouvrage_seuil_rect": "Déversoir rectangulaire", - "select_ouvrage_seuil_triang": "Déversoir triangulaire", - "select_ouvrage_seuil_triangtrunc": "Déversoir triangulaire tronqué", - "select_loidebit1_seuildenoye": "Déversoir rectangulaire dénoyé", - "select_loidebit3_seuiltriang": "Déversoir triangulaire dénoyé", - "select_loidebit4_seuiltriangtrunc": "Déversoir triangulaire tronqué dénoyé", "L": "Largeur du déversoir", "Cd": "Coefficient de débit", + + "select_structure_SeuilRectangulaire": "Déversoir rectangulaire", + "select_structure_SeuilTriangulaire": "Déversoir triangulaire", + "select_structure_SeuilTriangulaireTrunc": "Déversoir triangulaire tronqué", + + "select_loidebit_SeuilRectangulaire_WeirFree": "Déversoir rectangulaire dénoyé", + "select_loidebit_SeuilTriangulaire_TriangularWeirFree": "Déversoir triangulaire dénoyé", + "select_loidebit_SeuilTriangulaireTrunc_TriangularTruncWeirFree": "Déversoir triangulaire tronqué dénoyé", + "UNIT_CVQT": "m³/s", "UNIT_Q": "m³/s", "UNIT_EC": "m", diff --git a/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json b/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json index 040f7335204fb24bc577383f1538326460cdc1f3..9d2e58903546c1b754a5d1a4e3d7b5cb7a05b44b 100644 --- a/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json +++ b/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json @@ -2,227 +2,25 @@ { "id": "fs_materiau", "type": "fieldset", - "option": "fix", "fields": [ { "id": "select_material", "type": "select", - "select": [ - { - "id": "select_material_0" - }, - { - "id": "select_material_1" - }, - { - "id": "select_material_2" - }, - { - "id": "select_material_3" - }, - { - "id": "select_material_4" - }, - { - "id": "select_material_5" - }, - { - "id": "select_material_6" - }, - { - "id": "select_material_7" - }, - { - "id": "select_material_8" - }, - { - "id": "select_material_9" - } - ] + "source": "lechapt_calmon_material" }, - { - "type": "input", - "id": "L", - "unit": "", - "dep_value": [ - { - "refid": "select_material", - "refvalue": "select_material_1", - "value": "1.863" - }, - { - "refid": "select_material", - "refvalue": "select_material_2", - "value": "1.601" - }, - { - "refid": "select_material", - "refvalue": "select_material_3", - "value": "1.40" - }, - { - "refid": "select_material", - "refvalue": "select_material_4", - "value": "1.16" - }, - { - "refid": "select_material", - "refvalue": "select_material_5", - "value": "1.1" - }, - { - "refid": "select_material", - "refvalue": "select_material_6", - "value": "1.049" - }, - { - "refid": "select_material", - "refvalue": "select_material_7", - "value": "1.01" - }, - { - "refid": "select_material", - "refvalue": "select_material_8", - "value": "0.916" - }, - { - "refid": "select_material", - "refvalue": "select_material_9", - "value": "0.971" - } - ] - }, - { - "type": "input", - "id": "M", - "unit": "", - "dep_value": [ - { - "refid": "select_material", - "refvalue": "select_material_1", - "value": "2" - }, - { - "refid": "select_material", - "refvalue": "select_material_2", - "value": "1.975" - }, - { - "refid": "select_material", - "refvalue": "select_material_3", - "value": "1.96" - }, - { - "refid": "select_material", - "refvalue": "select_material_4", - "value": "1.93" - }, - { - "refid": "select_material", - "refvalue": "select_material_5", - "value": "1.89" - }, - { - "refid": "select_material", - "refvalue": "select_material_6", - "value": "1.86" - }, - { - "refid": "select_material", - "refvalue": "select_material_7", - "value": "1.84" - }, - { - "refid": "select_material", - "refvalue": "select_material_8", - "value": "1.78" - }, - { - "refid": "select_material", - "refvalue": "select_material_9", - "value": "1.81" - } - ] - }, - { - "type": "input", - "id": "N", - "unit": "", - "dep_value": [ - { - "refid": "select_material", - "refvalue": "select_material_1", - "value": "5.33" - }, - { - "refid": "select_material", - "refvalue": "select_material_2", - "value": "5.25" - }, - { - "refid": "select_material", - "refvalue": "select_material_3", - "value": "5.19" - }, - { - "refid": "select_material", - "refvalue": "select_material_4", - "value": "5.11" - }, - { - "refid": "select_material", - "refvalue": "select_material_5", - "value": "5.01" - }, - { - "refid": "select_material", - "refvalue": "select_material_6", - "value": "4.93" - }, - { - "refid": "select_material", - "refvalue": "select_material_7", - "value": "4.88" - }, - { - "refid": "select_material", - "refvalue": "select_material_8", - "value": "4.78" - }, - { - "refid": "select_material", - "refvalue": "select_material_9", - "value": "4.81" - } - ] - } + "L", + "M", + "N" ] }, { "id": "fs_hydraulique", "type": "fieldset", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "D", - "unit": "m" - }, - { - "type": "input", - "id": "J", - "unit": "m" - }, - { - "type": "input", - "id": "Lg", - "unit": "m" - } + "Q", + "D", + "J", + "Lg" ] }, { diff --git a/src/app/calculators/macrorugo/macrorugo.config.json b/src/app/calculators/macrorugo/macrorugo.config.json index 253a4a98459c3873721397c19728aee73102fcdb..b7df1196a0e29c22ffedc81c4961163f7d8a3f38 100644 --- a/src/app/calculators/macrorugo/macrorugo.config.json +++ b/src/app/calculators/macrorugo/macrorugo.config.json @@ -2,77 +2,30 @@ { "id": "fs_hydraulique_fix", "type": "fieldset", - "option": "var", "fields": [ - { - "type": "input", - "id": "ZF1", - "unit": "m" - }, - { - "type": "input", - "id": "L", - "unit": "m" - }, - { - "type": "input", - "id": "Ks", - "unit": "m" - } + "ZF1", + "L", + "Ks" ] }, { "id": "fs_hydraulique_cal", "type": "fieldset", - "option": "cal", "fields": [ - { - "type": "input", - "id": "B", - "unit": "m" - }, - { - "type": "input", - "id": "If", - "unit": "m/m" - }, - { - "type": "input", - "id": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "Y", - "unit": "m" - }, - { - "type": "input", - "id": "C", - "unit": "" - } + "B", + "If", + "Q", + "Y", + "C" ] }, { "id": "fs_bloc", "type": "fieldset", - "option": "var", "fields": [ - { - "type": "input", - "id": "PBD", - "unit": "m" - }, - { - "type": "input", - "id": "PBH", - "unit": "m" - }, - { - "type": "input", - "id": "Cd0", - "unit": "" - } + "PBD", + "PBH", + "Cd0" ] }, { diff --git a/src/app/calculators/pab-chute/pab-chute.config.json b/src/app/calculators/pab-chute/pab-chute.config.json index aa5107384c95f8835420d9c8326d403694d4f72d..6289d41842ec98ef0000cafa0b1c0ba00ee613f1 100644 --- a/src/app/calculators/pab-chute/pab-chute.config.json +++ b/src/app/calculators/pab-chute/pab-chute.config.json @@ -2,23 +2,10 @@ { "id": "fs_chute", "type": "fieldset", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Z1", - "unit": "m" - }, - { - "type": "input", - "id": "Z2", - "unit": "m" - }, - { - "type": "input", - "id": "DH", - "unit": "m" - } + "Z1", + "Z2", + "DH" ] }, { diff --git a/src/app/calculators/pab-dimensions/pab-dimensions.config.json b/src/app/calculators/pab-dimensions/pab-dimensions.config.json index a199a643e2bbc121ee4aecfe009231d85a13b773..3f455962c46a454a2b7811e806b50b460a7bb8d4 100644 --- a/src/app/calculators/pab-dimensions/pab-dimensions.config.json +++ b/src/app/calculators/pab-dimensions/pab-dimensions.config.json @@ -2,28 +2,11 @@ { "id": "fs_dimensions", "type": "fieldset", - "option": "cal", "fields": [ - { - "type": "input", - "id": "L", - "unit": "m" - }, - { - "type": "input", - "id": "W", - "unit": "m" - }, - { - "type": "input", - "id": "Y", - "unit": "m" - }, - { - "type": "input", - "id": "V", - "unit": "m³" - } + "L", + "W", + "Y", + "V" ] }, { diff --git a/src/app/calculators/pab-nombre/pab-nombre.config.json b/src/app/calculators/pab-nombre/pab-nombre.config.json index 972eeac610b36ad73ef432148aa3202e3f2ee266..8a267c93d7bb4113946be4ffcea3160c9916303d 100644 --- a/src/app/calculators/pab-nombre/pab-nombre.config.json +++ b/src/app/calculators/pab-nombre/pab-nombre.config.json @@ -2,23 +2,10 @@ { "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" - } + "DHT", + "N", + "DH" ] }, { diff --git a/src/app/calculators/pab-puissance/pab-puissance.config.json b/src/app/calculators/pab-puissance/pab-puissance.config.json index 9e2e8159564bcf6e7687776f87efa6d1729aecde..7432a9c63191e651692cd80f9b7b660231b9ff47 100644 --- a/src/app/calculators/pab-puissance/pab-puissance.config.json +++ b/src/app/calculators/pab-puissance/pab-puissance.config.json @@ -2,28 +2,11 @@ { "id": "fs_puissance", "type": "fieldset", - "option": "cal", "fields": [ - { - "type": "input", - "id": "DH", - "unit": "m" - }, - { - "type": "input", - "id": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "V", - "unit": "m³" - }, - { - "type": "input", - "id": "PV", - "unit": "W/m³" - } + "DH", + "Q", + "V", + "PV" ] }, { diff --git a/src/app/calculators/pab/pab.config.json b/src/app/calculators/pab/pab.config.json index d477bc7af1a31bac68cacae5b905ff559617395e..edca91704834dc3734eec3bbe0282c36eebbbb77 100644 --- a/src/app/calculators/pab/pab.config.json +++ b/src/app/calculators/pab/pab.config.json @@ -3,24 +3,10 @@ "id": "fs_param_hydro", "type": "fieldset", "calcType": "Pab", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "Z1", - "unit": "m" - }, - { - "type": "input", - "id": "Z2", - "unit": "m", - "option": "var" - } + "Q", + "Z1", + "Z2" ] }, { diff --git a/src/app/calculators/parallel-structures/parallel-structures.config.json b/src/app/calculators/parallel-structures/parallel-structures.config.json index 07272c3a1b2a1f970f89ac76dc3155b04749538c..02cb7d17f833d036698c759236748f0a5bad1c61 100644 --- a/src/app/calculators/parallel-structures/parallel-structures.config.json +++ b/src/app/calculators/parallel-structures/parallel-structures.config.json @@ -3,24 +3,10 @@ "id": "fs_param_hydro", "type": "fieldset", "calcType": "ParallelStructure", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Q", - "symbol": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "Z1", - "unit": "m" - }, - { - "type": "input", - "id": "Z2", - "unit": "m" - } + "Q", + "Z1", + "Z2" ] }, { @@ -30,350 +16,31 @@ "defaultNodeType": "StructureRectangle", "defaultStructType": "VanneRectangulaire", "defaultLoiDebit": "GateCem88v", - "option": "cal", "fields": [ { "id": "select_ouvrage", "type": "select", - "select": [ - { - "id": "select_ouvrage_vanne_rect", - "enum": "StructureType.VanneRectangulaire" - }, - { - "id": "select_ouvrage_seuil_rect", - "enum": "StructureType.SeuilRectangulaire" - }, - { - "id": "select_ouvrage_seuil_triang", - "enum": "StructureType.SeuilTriangulaire" - }, - { - "id": "select_ouvrage_seuil_triangtrunc", - "enum": "StructureType.SeuilTriangulaireTrunc" - } - ] - }, - { - "id": "select_loidebit1", - "type": "select", - "select": [ - { - "id": "select_loidebit1_cem88d", - "enum": "LoiDebit.WeirCem88d" - }, - { - "id": "select_loidebit1_cem88v", - "enum": "LoiDebit.WeirCem88v" - }, - { - "id": "select_loidebit1_seuildenoye", - "enum": "LoiDebit.WeirFree" - }, - { - "id": "select_loidebit1_cunge80", - "enum": "LoiDebit.WeirCunge80" - }, - { - "id": "select_loidebit1_villemonte", - "enum": "LoiDebit.WeirVillemonte" - }, - { - "id": "select_loidebit1_kivi", - "enum": "LoiDebit.KIVI" - }, - { - "id": "select_loidebit1_fente", - "enum": "LoiDebit.WeirSubmergedLarinier" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - } - ] - }, - { - "id": "select_loidebit2", - "type": "select", - "select": [ - { - "id": "select_loidebit2_cem88v", - "enum": "LoiDebit.GateCem88v" - }, - { - "id": "select_loidebit2_cem88d", - "enum": "LoiDebit.GateCem88d" - }, - { - "id": "select_loidebit2_vannedenoye", - "enum": "LoiDebit.RectangularOrificeFree" - }, - { - "id": "select_loidebit2_vannenoye", - "enum": "LoiDebit.RectangularOrificeSubmerged" - }, - { - "id": "select_loidebit2_cunge80", - "enum": "LoiDebit.GateCunge80" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_vanne_rect" - } - ] + "source": "device_structure_type" }, { - "id": "select_loidebit3", + "id": "select_loidebit", "type": "select", - "select": [ - { - "id": "select_loidebit3_seuiltriang", - "enum": "LoiDebit.TriangularWeirFree" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - } - ] - }, - { - "id": "select_loidebit4", - "type": "select", - "select": [ - { - "id": "select_loidebit4_seuiltriangtrunc", - "enum": "LoiDebit.TriangularTruncWeirFree" - } - ], - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "ZDV", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_vanne_rect" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "L", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_vanne_rect" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_rect" - }, - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_kivi" - } - ] - }, - { - "type": "input", - "id": "W", - "nodeType": "StructureRectangle", - "unit": "m", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_vanne_rect" - } - ] - }, - { - "type": "input", - "id": "CdWSL", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_fente" - } - ] - }, - { - "type": "input", - "id": "CdWR", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_seuildenoye" - }, - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_cem88d" - }, - { - "refid": "select_loidebit2", - "refvalue": "select_loidebit2_cem88d" - }, - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_villemonte" - } - ] - }, - { - "type": "input", - "id": "CdGR", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_cunge80" - }, - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_cem88v" - }, - { - "refid": "select_loidebit2", - "refvalue": "select_loidebit2_vannedenoye" - }, - { - "refid": "select_loidebit2", - "refvalue": "select_loidebit2_vannenoye" - }, - { - "refid": "select_loidebit2", - "refvalue": "select_loidebit2_cunge80" - }, - { - "refid": "select_loidebit2", - "refvalue": "select_loidebit2_cem88v" - } - ] - }, - { - "type": "input", - "id": "CdT", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "alpha", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_kivi" - } - ] - }, - { - "type": "input", - "id": "beta", - "unit": "", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_kivi" - } - ] - }, - { - "type": "input", - "id": "ZRAM", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_loidebit1", - "refvalue": "select_loidebit1_kivi" - } - ] - }, - { - "type": "input", - "id": "alpha2", - "unit": "°", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triang" - }, - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "BT", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - }, - { - "type": "input", - "id": "ZT", - "unit": "m", - "nodeType": "StructureRectangle", - "dep_exist": [ - { - "refid": "select_ouvrage", - "refvalue": "select_ouvrage_seuil_triangtrunc" - } - ] - } + "source": "device_loi_debit" + }, + "S", + "ZDV", + "L", + "W", + "CdWSL", + "CdWR", + "CdGR", + "CdT", + "alpha", + "beta", + "ZRAM", + "alpha2", + "BT", + "ZT" ] }, { diff --git a/src/app/calculators/parallel-structures/parallel-structures.en.json b/src/app/calculators/parallel-structures/parallel-structures.en.json index 84154f2febe14963072c072d625d339063fd0e57..df9a1d99a656287f0649e247678c32fc634993a8 100644 --- a/src/app/calculators/parallel-structures/parallel-structures.en.json +++ b/src/app/calculators/parallel-structures/parallel-structures.en.json @@ -1,26 +1,32 @@ { "Q": "Total Flow", - "select_ouvrage_vanne_circ": "Circular gate", - "select_ouvrage_vanne_rect": "Rectangular gate", - "select_ouvrage_seuil_rect": "Rectangular weir", - "select_ouvrage_seuil_triang": "Triangular weir", - "select_ouvrage_seuil_triangtrunc": "Truncated triangular weir", - "select_ouvrage_seuil_trap": "Trapezoidal weir", - "select_ouvrage_vanne_trap": "trapezoidal gate", "W": "Gate opening", - "select_loidebit1_seuildenoye": "Free flow weir", - "select_loidebit1_cunge80": "Cunge 80", - "select_loidebit1_cem88d": "Weir/Orifice Cemagref 88", - "select_loidebit1_cem88v": "Weir/Undershot gate Cemagref 88", - "select_loidebit1_fente": "Submerged slot (Larinier 1992)", - "select_loidebit1_kivi": "Kindsvater-Carter and Villemonte", - "select_loidebit1_villemonte": "Villemonte 1957", - "select_loidebit2_vannedenoye": "Free flow gate", - "select_loidebit2_vannenoye": "Submerged gate", - "select_loidebit2_cunge80": "Cunge 80", - "select_loidebit2_cem88d": "Weir/Orifice Cemagref 88", - "select_loidebit2_cem88v": "Weir/Undershot gate Cemagref 88", - "select_loidebit3_seuiltriang": "Triangular weir (Villemonte)", - "select_loidebit4_seuiltriangtrunc": "Truncated triangular weir (Villemonte)", + + "select_structure_Orifice": "Orifice", + "select_structure_VanneRectangulaire": "Rectangular gate", + "select_structure_SeuilRectangulaire": "Rectangular weir", + "select_structure_SeuilTriangulaire": "Triangular weir", + "select_structure_SeuilTriangulaireTrunc": "Truncated triangular weir", + + "select_loidebit_Orifice_OrificeSubmerged": "Submerged orifice", + + "select_loidebit_VanneRectangulaire_GateCem88d": "Weir/Orifice Cemagref 88", + "select_loidebit_VanneRectangulaire_GateCem88v": "Weir/Undershot gate Cemagref 88", + "select_loidebit_VanneRectangulaire_GateCunge80": "Cunge 80", + "select_loidebit_VanneRectangulaire_RectangularOrificeFree": "Free flow gate", + "select_loidebit_VanneRectangulaire_RectangularOrificeSubmerged": "Submerged gate", + + "select_loidebit_SeuilTriangulaire_TriangularWeirFree": "Triangular weir (Villemonte)", + + "select_loidebit_SeuilTriangulaireTrunc_TriangularTruncWeirFree": "Truncated triangular weir (Villemonte)", + + "select_loidebit_SeuilRectangulaire_WeirCem88d": "Weir/Orifice Cemagref 88", + "select_loidebit_SeuilRectangulaire_WeirCem88v": "Weir/Undershot gate Cemagref 88", + "select_loidebit_SeuilRectangulaire_WeirSubmergedLarinier": "Submerged slot (Larinier 1992)", + "select_loidebit_SeuilRectangulaire_WeirVillemonte": "Villemonte 1957", + "select_loidebit_SeuilRectangulaire_WeirFree": "Free flow weir", + "select_loidebit_SeuilRectangulaire_KIVI": "Kindsvater-Carter and Villemonte", + "select_loidebit_SeuilRectangulaire_WeirCunge80": "Cunge 80", + "UNIT_Q": "m³/s" } diff --git a/src/app/calculators/parallel-structures/parallel-structures.fr.json b/src/app/calculators/parallel-structures/parallel-structures.fr.json index 7b765db33b58a06d5691027e54494db1490a835c..992f033e1f78d947bbfaed5935f59e758311441b 100644 --- a/src/app/calculators/parallel-structures/parallel-structures.fr.json +++ b/src/app/calculators/parallel-structures/parallel-structures.fr.json @@ -1,25 +1,32 @@ { "Q": "Débit total", - "select_ouvrage_vanne_circ": "Vanne circulaire", - "select_ouvrage_vanne_rect": "Vanne rectangulaire", - "select_ouvrage_seuil_rect": "Seuil rectangulaire", - "select_ouvrage_seuil_triang": "Seuil triangulaire", - "select_ouvrage_seuil_triangtrunc": "Seuil triangulaire tronqué", - "select_ouvrage_seuil_trap": "Seuil trapézoïdal", - "select_ouvrage_vanne_trap": "Vanne trapézoïdale", - "select_loidebit1_seuildenoye": "Seuil dénoyé", - "select_loidebit1_cunge80": "Cunge 80", - "select_loidebit1_cem88d": "Déversoir/Orifice Cemagref 88", - "select_loidebit1_cem88v": "Déversoir/Vanne de fond Cemagref 88", - "select_loidebit1_fente": "Fente noyée (Larinier 1992)", - "select_loidebit1_kivi": "Kindsvater-Carter et Villemonte", - "select_loidebit1_villemonte": "Villemonte 1957", - "select_loidebit2_vannedenoye": "Vanne dénoyé", - "select_loidebit2_vannenoye": "Vanne noyé", - "select_loidebit2_cunge80": "Cunge 80", - "select_loidebit2_cem88d": "Déversoir/Orifice Cemagref 88", - "select_loidebit2_cem88v": "Déversoir/Vanne de fond Cemagref 88", - "select_loidebit3_seuiltriang": "Déversoir triangulaire (Villemonte)", - "select_loidebit4_seuiltriangtrunc": "Déversoir triangulaire tronqué (Villemonte)", + "W": "Ouverture de vanne", + + "select_structure_Orifice": "Orifice", + "select_structure_SeuilRectangulaire": "Seuil rectangulaire", + "select_structure_SeuilTriangulaire": "Seuil triangulaire", + "select_structure_SeuilTriangulaireTrunc": "Seuil triangulaire tronqué", + "select_structure_VanneRectangulaire": "Vanne rectangulaire", + + "select_loidebit_Orifice_OrificeSubmerged": "Orifice noyé", + + "select_loidebit_VanneRectangulaire_GateCem88d": "Déversoir/Orifice Cemagref 88", + "select_loidebit_VanneRectangulaire_GateCem88v": "Déversoir/Vanne de fond Cemagref 88", + "select_loidebit_VanneRectangulaire_GateCunge80": "Cunge 80", + "select_loidebit_VanneRectangulaire_RectangularOrificeFree": "Vanne dénoyée", + "select_loidebit_VanneRectangulaire_RectangularOrificeSubmerged": "Vanne noyée", + + "select_loidebit_SeuilTriangulaire_TriangularWeirFree": "Déversoir triangulaire (Villemonte)", + + "select_loidebit_SeuilTriangulaireTrunc_TriangularTruncWeirFree": "Déversoir triangulaire tronqué (Villemonte)", + + "select_loidebit_SeuilRectangulaire_WeirCem88d": "Déversoir/Orifice Cemagref 88", + "select_loidebit_SeuilRectangulaire_WeirCem88v": "Déversoir/Vanne de fond Cemagref 88", + "select_loidebit_SeuilRectangulaire_WeirSubmergedLarinier": "Fente noyée (Larinier 1992)", + "select_loidebit_SeuilRectangulaire_WeirVillemonte": "Villemonte 1957", + "select_loidebit_SeuilRectangulaire_WeirFree": "Seuil dénoyé", + "select_loidebit_SeuilRectangulaire_KIVI": "Kindsvater-Carter et Villemonte", + "select_loidebit_SeuilRectangulaire_WeirCunge80": "Cunge 80", + "UNIT_Q": "m³/s" -} \ No newline at end of file +} diff --git a/src/app/calculators/regime-uniforme/regime-uniforme.config.json b/src/app/calculators/regime-uniforme/regime-uniforme.config.json index ddd0c099aae18b9ec09bac2be70d0570513f1dac..3633e1aa733fa01c4ca01ae195b554533fc8d66e 100644 --- a/src/app/calculators/regime-uniforme/regime-uniforme.config.json +++ b/src/app/calculators/regime-uniforme/regime-uniforme.config.json @@ -2,141 +2,34 @@ { "id": "fs_section", "type": "fieldset", - "option": "cal", "fields": [ { "id": "select_section", "type": "select", - "select": [ - { - "id": "select_section_trapez", - "enum": "ComputeNodeType.SectionTrapeze" - }, - { - "id": "select_section_rect", - "enum": "ComputeNodeType.SectionRectangle" - }, - { - "id": "select_section_circ", - "enum": "ComputeNodeType.SectionCercle" - }, - { - "id": "select_section_puiss", - "enum": "ComputeNodeType.SectionPuissance" - } - ] + "source": "acsection_section" }, - { - "type": "input", - "id": "LargeurFond", - "nodeType": "SectionTrapeze", - "unit": "m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_trapez" - } - ] - }, - { - "type": "input", - "id": "Fruit", - "nodeType": "SectionTrapeze", - "unit": "m/m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_trapez" - } - ] - }, - { - "type": "input", - "id": "LargeurBerge", - "nodeType": "SectionRectangle", - "unit": "m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_rect" - } - ] - }, - { - "type": "input", - "id": "D", - "nodeType": "SectionCercle", - "unit": "m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_circ" - } - ] - }, - { - "type": "input", - "id": "k", - "nodeType": "SectionPuissance", - "unit": "", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_puiss" - } - ] - }, - { - "type": "input", - "id": "LargeurBerge", - "nodeType": "SectionPuissance", - "unit": "m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_puiss" - } - ] - } + "LargeurFond", + "Fruit", + "LargeurBerge", + "D", + "k" ] }, { "id": "fs_bief", "type": "fieldset", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Ks", - "unit": "m1/3s-1" - }, - { - "type": "input", - "id": "If", - "unit": "m/m" - }, - { - "type": "input", - "id": "YB", - "unit": "m" - } + "Ks", + "If", + "YB" ] }, { "id": "fs_hydraulique", "type": "fieldset", - "option": "cal", "fields": [ - { - "type": "input", - "id": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "Y", - "unit": "m" - } + "Q", + "Y" ] }, { diff --git a/src/app/calculators/remous/remous.config.json b/src/app/calculators/remous/remous.config.json index 8fcdf1c4d171b8d9293ff1c1c96ae76a11d172f0..a6110791b37fdf4b95b76ba4b44693c5e2827918 100644 --- a/src/app/calculators/remous/remous.config.json +++ b/src/app/calculators/remous/remous.config.json @@ -2,184 +2,48 @@ { "id": "fs_section", "type": "fieldset", - "option": "fix", "fields": [ { "id": "select_section", "type": "select", - "select": [ - { - "id": "select_section_trapez", - "enum": "ComputeNodeType.SectionTrapeze" - }, - { - "id": "select_section_rect", - "enum": "ComputeNodeType.SectionRectangle" - }, - { - "id": "select_section_circ", - "enum": "ComputeNodeType.SectionCercle" - }, - { - "id": "select_section_puiss", - "enum": "ComputeNodeType.SectionPuissance" - } - ] + "source": "acsection_section" }, - { - "type": "input", - "id": "LargeurFond", - "nodeType": "SectionTrapeze", - "unit": "m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_trapez" - } - ] - }, - { - "type": "input", - "id": "Fruit", - "nodeType": "SectionTrapeze", - "unit": "m/m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_trapez" - } - ] - }, - { - "type": "input", - "id": "LargeurBerge", - "nodeType": "SectionRectangle", - "unit": "m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_rect" - } - ] - }, - { - "type": "input", - "id": "D", - "nodeType": "SectionCercle", - "unit": "m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_circ" - } - ] - }, - { - "type": "input", - "id": "k", - "nodeType": "SectionPuissance", - "unit": "", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_puiss" - } - ] - }, - { - "type": "input", - "id": "LargeurBerge", - "nodeType": "SectionPuissance", - "unit": "m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_puiss" - } - ] - } + "LargeurFond", + "Fruit", + "LargeurBerge", + "D", + "k" ] }, { "id": "fs_bief", "type": "fieldset", - "option": "fix", "fields": [ - { - "type": "input", - "id": "Ks", - "unit": "m1/3s-1" - }, - { - "type": "input", - "id": "Long", - "unit": "m" - }, - { - "type": "input", - "id": "If", - "unit": "m/m" - }, - { - "type": "input", - "id": "YB", - "unit": "m" - } + "Ks", + "Long", + "If", + "YB" ] }, { "id": "fs_condlim", "type": "fieldset", - "option": "fix", "fields": [ - { - "type": "input", - "id": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "Yaval", - "unit": "m" - }, - { - "type": "input", - "id": "Yamont", - "unit": "m" - } + "Q", + "Yaval", + "Yamont" ] }, { "id": "fs_param_calc", "type": "fieldset", - "option": "fix", "fields": [ - { - "type": "input", - "id": "Dx", - "unit": "m" - }, - { - "type": "input", - "id": "Pr" - }, + "Dx", + "Pr", { "id": "select_resolution", "type": "select", - "select": [ - { - "id": "select_resolution_trap", - "enum": "MethodeResolution.Trapezes" - }, - { - "id": "select_resolution_rk4", - "enum": "MethodeResolution.RungeKutta4" - }, - { - "id": "select_resolution_euler", - "enum": "MethodeResolution.EulerExplicite" - } - ] + "source": "remous_methode_resolution" } ] }, @@ -190,71 +54,7 @@ { "id": "select_target", "type": "select", - "select": [ - { - "id": "select_target_none" - }, - { - "id": "select_target_Hs", - "value": "Hs" - }, - { - "id": "select_target_Hsc", - "value": "Hsc" - }, - { - "id": "select_target_B", - "value": "B" - }, - { - "id": "select_target_P", - "value": "P" - }, - { - "id": "select_target_S", - "value": "S" - }, - { - "id": "select_target_R", - "value": "R" - }, - { - "id": "select_target_V", - "value": "V" - }, - { - "id": "select_target_Fr", - "value": "Fr" - }, - { - "id": "select_target_Yf", - "value": "Yf" - }, - { - "id": "select_target_Yt", - "value": "Yt" - }, - { - "id": "select_target_Yco", - "value": "Yco" - }, - { - "id": "select_target_J", - "value": "J" - }, - { - "id": "select_target_I-J", - "value": "I-J" - }, - { - "id": "select_target_Imp", - "value": "Imp" - }, - { - "id": "select_target_Tau0", - "value": "Tau0" - } - ] + "source": "remous_target" } ] }, diff --git a/src/app/calculators/section-param/section-param.config.json b/src/app/calculators/section-param/section-param.config.json index b9076cd68548e6755940373269128f880a51c341..fd31b8be35fd8fee848c165a1cb49c650a551900 100644 --- a/src/app/calculators/section-param/section-param.config.json +++ b/src/app/calculators/section-param/section-param.config.json @@ -2,141 +2,34 @@ { "id": "fs_section", "type": "fieldset", - "option": "var", "fields": [ { "id": "select_section", "type": "select", - "select": [ - { - "id": "select_section_trapez", - "enum": "ComputeNodeType.SectionTrapeze" - }, - { - "id": "select_section_rect", - "enum": "ComputeNodeType.SectionRectangle" - }, - { - "id": "select_section_circ", - "enum": "ComputeNodeType.SectionCercle" - }, - { - "id": "select_section_puiss", - "enum": "ComputeNodeType.SectionPuissance" - } - ] + "source": "acsection_section" }, - { - "type": "input", - "id": "LargeurFond", - "unit": "m", - "nodeType": "SectionTrapeze", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_trapez" - } - ] - }, - { - "type": "input", - "id": "Fruit", - "nodeType": "SectionTrapeze", - "unit": "m/m", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_trapez" - } - ] - }, - { - "type": "input", - "id": "LargeurBerge", - "unit": "m", - "nodeType": "SectionRectangle", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_rect" - } - ] - }, - { - "type": "input", - "id": "D", - "unit": "m", - "nodeType": "SectionCercle", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_circ" - } - ] - }, - { - "type": "input", - "id": "k", - "unit": "", - "nodeType": "SectionPuissance", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_puiss" - } - ] - }, - { - "type": "input", - "id": "LargeurBerge", - "unit": "m", - "nodeType": "SectionPuissance", - "dep_exist": [ - { - "refid": "select_section", - "refvalue": "select_section_puiss" - } - ] - } + "LargeurBerge", + "LargeurFond", + "Fruit", + "D", + "k" ] }, { "id": "fs_bief", "type": "fieldset", - "option": "var", "fields": [ - { - "type": "input", - "id": "Ks", - "unit": "m1/3s-1" - }, - { - "type": "input", - "id": "If", - "unit": "m/m" - }, - { - "type": "input", - "id": "YB", - "unit": "m" - } + "Ks", + "If", + "YB" ] }, { "id": "fs_hydraulique", "type": "fieldset", - "option": "var", "fields": [ - { - "type": "input", - "id": "Q", - "unit": "m³/s" - }, - { - "type": "input", - "id": "Y", - "unit": "m" - } + "Q", + "Y" ] }, { diff --git a/src/app/calculators/section-param/section-param.en.json b/src/app/calculators/section-param/section-param.en.json index d4675575f86931d5e087f8eb17494b3bba4821ff..765b149799791b5853a7af3da286c61bb85f4a8d 100644 --- a/src/app/calculators/section-param/section-param.en.json +++ b/src/app/calculators/section-param/section-param.en.json @@ -23,26 +23,6 @@ "Y": "Draft", "fs_param_calc": "Calculation parameters", "Pr": "Display accuracy", - "fs_computed_var": "Data to compute", - "select_target": "Choice of the data to compute", - "select_target_Hs": "Specific head (m)", - "select_target_Hsc": "Critical head (m)", - "select_target_B": "Surface width (m)", - "select_target_P": "Wetted perimeter (m)", - "select_target_S": "Wetted area (m2)", - "select_target_R": "Hydraulic radius (m)", - "select_target_V": "Average speed (m/s)", - "select_target_Fr": "Froude number", - "select_target_Yc": "Critical depth (m)", - "select_target_Yn": "Normal depth (m)", - "select_target_Yf": "Subcritical depth (m)", - "select_target_Yt": "Supercritical depth (m)", - "select_target_Yco": "Conjugate depth (m)", - "select_target_J": "Head loss (m)", - "select_target_I-J": "Linear variation of specific head (m/m)", - "select_target_Imp": "Impulse (N)", - "select_target_Tau0": "Tractive force (Pa)", - "Hs": "Charge spécifique", "Hsc": "Charge critique", "B": "Largeur au miroir", diff --git a/src/app/calculators/section-param/section-param.fr.json b/src/app/calculators/section-param/section-param.fr.json index 4ad30ced91d9932b3de40fcb8b4df992fe15df72..aa95a54529589a7da99c5ec17112b67bcf89ad3a 100644 --- a/src/app/calculators/section-param/section-param.fr.json +++ b/src/app/calculators/section-param/section-param.fr.json @@ -22,26 +22,6 @@ "Y": "Tirant d'eau", "fs_param_calc": "Paramètres de calcul", "Pr": "Précision de calcul", - "fs_computed_var": "Donnée à calculer", - "select_target": "Choix de la donnée à calculer", - "select_target_Hs": "La charge spécifique (m)", - "select_target_Hsc": "La charge critique (m)", - "select_target_B": "La largeur au miroir (m)", - "select_target_P": "Le périmètre mouillé (m)", - "select_target_S": "La surface mouillée (m2)", - "select_target_R": "Le rayon hydraulique (m)", - "select_target_V": "La vitesse moyenne (m/s)", - "select_target_Fr": "Le Froude", - "select_target_Yc": "Le tirant d'eau critique (m)", - "select_target_Yn": "Le tirant d'eau normal (m)", - "select_target_Yf": "Le tirant d'eau fluvial (m)", - "select_target_Yt": "Le tirant d'eau torrentiel (m)", - "select_target_Yco": "Le tirant d'eau conjugué (m)", - "select_target_J": "La perte de charge (m)", - "select_target_I-J": "Variation linéaire de l'énergie spécifique (m/m)", - "select_target_Imp": "Impulsion (N)", - "select_target_Tau0": "La force tractrice (Pa)", - "Hs": "Charge spécifique", "Hsc": "Charge critique", "B": "Largeur au miroir", diff --git a/src/app/components/base-param-input/base-param-input.component.ts b/src/app/components/base-param-input/base-param-input.component.ts index 4c31d115f57d1680dc8dc8c005c555ff03983ba3..447a9900eb45365d3cd5cf4fe83f0d141598a97b 100644 --- a/src/app/components/base-param-input/base-param-input.component.ts +++ b/src/app/components/base-param-input/base-param-input.component.ts @@ -12,9 +12,9 @@ import { NgParameter } from "../../formulaire/ngparam"; export class NgBaseParam extends Observable { private _param: ParamDefinition; - constructor(symb: string, d: ParamDomain | ParamDomainValue, val: number) { + constructor(symb: string, d: ParamDomain | ParamDomainValue, val: number, unit?: string) { super(); - this._param = new ParamDefinition(null, symb, d, val); + this._param = new ParamDefinition(null, symb, d, unit, val); } public get param() { diff --git a/src/app/formulaire/definition/concrete/form-courbe-remous.ts b/src/app/formulaire/definition/concrete/form-courbe-remous.ts index 319f155d20a9b066f38f2e5758e866410990b927..dad046d4cbfda50bf62fc6168d96175acf8fb338 100644 --- a/src/app/formulaire/definition/concrete/form-courbe-remous.ts +++ b/src/app/formulaire/definition/concrete/form-courbe-remous.ts @@ -25,7 +25,7 @@ export class FormulaireCourbeRemous extends FormulaireBase { this._formCompute = new FormComputeCourbeRemous(this, this._formSection, (this._formResult as FormResultRemous)); // default properties this._props["methodeResolution"] = MethodeResolution.Trapezes; - this._props["varCalc"] = undefined; // important + this._props["varCalc"] = ""; // important } protected parseOptions(json: {}) { diff --git a/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts b/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts index 524994ec460f9f63168ee3a077c9a7dcd2821351..2d7376222fe62969a44de421762eb8617f72a098 100644 --- a/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts +++ b/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts @@ -1,4 +1,4 @@ -import { Observer } from "jalhyd"; +import { LechaptCalmon, Observer } from "jalhyd"; import { SelectField } from "../../select-field"; import { FormulaireBase } from "./form-base"; import { NgParamInputComponent } from "../../../components/ngparam-input/ngparam-input.component"; @@ -24,7 +24,15 @@ export class FormulaireLechaptCalmon extends FormulaireBase implements Observer // en cas de changement de valeur du select de matériau, effacement des résultats et MAJ des champs L,M,N if (sender instanceof SelectField) { if (data.action === "select") { + if (data.value._value !== "") { + (this.currentNub as LechaptCalmon).applyMaterialPreset(data.value._value); + } + // update GUI + this.getParamFromSymbol("L").notifyValueModified(this); + this.getParamFromSymbol("M").notifyValueModified(this); + this.getParamFromSymbol("N").notifyValueModified(this); this.reset(); + } } if (sender instanceof NgParamInputComponent) { diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts index f10ec866230967f6ff0de706f26f982265ec6356..ebeb77d4a6d1c17a928c961b960272c3a1f7bbd2 100644 --- a/src/app/formulaire/definition/form-definition.ts +++ b/src/app/formulaire/definition/form-definition.ts @@ -196,35 +196,6 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs this.kids.push(tab); } - public parseDependencies(json: {}) { - // tslint:disable-next-line:forin - for (const conf_index in json) { - const conf = json[conf_index]; - const type: string = conf["type"]; - - switch (type) { - // field set - case "fieldset": - case "template_container": - for (const k of this.kids) { - if (k.id === conf["id"]) { - k.parseDependencies(conf); - break; - } - } - break; - - case "fieldset_template": - for (const k of this.kids) { - if (k instanceof FieldsetContainer) { - k.parseDependencies(conf); - } - } - break; - } - } - } - /** * 1ère passe d'analyse de la configuration */ @@ -290,7 +261,6 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs } this.completeParse(this._jsonConfig); - this.parseDependencies(this._jsonConfig); } public hasParameter(symbol: string): boolean { @@ -381,8 +351,6 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs */ public reset() { this.resetResults([], undefined, true); - this.applyDependencies(); - // prévenir les composants qu'il faut détecter les changements this.notifyReset(); } @@ -407,12 +375,6 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs return select.getValue().label; } - public applyDependencies() { - for (const fe of this.topFormElements) { - fe.applyDependencies(); - } - } - public abstract resetResults(visited: string[], symbol?: string, forceResetAllDependencies?: boolean); public abstract doCompute(); public abstract get hasResults(): boolean; diff --git a/src/app/formulaire/dependency/dependency-condition.ts b/src/app/formulaire/dependency/dependency-condition.ts deleted file mode 100644 index 876e46426f2bbf57e5c796dc3e66a847f601322d..0000000000000000000000000000000000000000 --- a/src/app/formulaire/dependency/dependency-condition.ts +++ /dev/null @@ -1,16 +0,0 @@ -export enum DependencyConditionType { - HasValue, IsVariable, IsDisplayed -} - -export class DependencyCondition { - constructor(private _type: DependencyConditionType) { - } - - public get type() { - return this._type; - } - - public toString(): string { - return "cond=" + DependencyConditionType[this._type]; - } -} diff --git a/src/app/formulaire/dependency/dependency.ts b/src/app/formulaire/dependency/dependency.ts deleted file mode 100644 index fe7426f55bed6b9e75365cce30b1a5e9c1aad49a..0000000000000000000000000000000000000000 --- a/src/app/formulaire/dependency/dependency.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { FormulaireElement } from "../formulaire-element"; -import { DependencyCondition } from "./dependency-condition"; - -/** - * Dépendance entre un élément maître et un élément esclave - * Si le maître vérifie une condition (masterCondition), alors la dépendance est appliquée à l'élément esclave, - * cad que son affichage, sa valeur, ... sont modifiés - */ -export abstract class Dependency { - private _slave: FormulaireElement; - - private _masterId: string; - - private _masterCondition: DependencyCondition; - - constructor(s: FormulaireElement, mid: string, mc: DependencyCondition) { - this._slave = s; - this._masterId = mid; - this._masterCondition = mc; - } - - private getMasterElement(id: string): FormulaireElement { - let parentNode = this._slave.parent; - while (parentNode !== undefined) { - const res: FormulaireElement = parentNode.getFormulaireNodeById(id) as FormulaireElement; - if (res !== undefined) { - return res; - } - parentNode = parentNode.parent; - } - } - - protected get masterElement(): FormulaireElement { - return this.getMasterElement(this._masterId); - } - - public get masterCondition(): DependencyCondition { - return this._masterCondition; - } - - public apply() { - const master: FormulaireElement = this.masterElement; - if (master && master.verifiesDependency(this)) { - this._slave.applyDependency(this); - } - } - - public toString(): string { - return "slave=" + this._slave.toString() + "\n mid=" + this._masterId + "\n " + this._masterCondition.toString(); - } -} diff --git a/src/app/formulaire/dependency/existence-dependency-condition.ts b/src/app/formulaire/dependency/existence-dependency-condition.ts deleted file mode 100644 index 0ec4ce094f9bf2670e355bdd94d44ca8dd57cdd2..0000000000000000000000000000000000000000 --- a/src/app/formulaire/dependency/existence-dependency-condition.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { DependencyCondition, DependencyConditionType } from "./dependency-condition"; - - -export class ExistenceDependencyCondition extends DependencyCondition { - constructor() { - super(DependencyConditionType.IsDisplayed); - } -} diff --git a/src/app/formulaire/dependency/existence-dependency.ts b/src/app/formulaire/dependency/existence-dependency.ts deleted file mode 100644 index 2f1a17f24e70b83f76a8a86853bc13e0f4bd6166..0000000000000000000000000000000000000000 --- a/src/app/formulaire/dependency/existence-dependency.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Dependency } from "./dependency"; -import { FormulaireElement } from "../formulaire-element"; - -/** - * dépendance déterminant l'affichage de l'élément esclave - */ -export class ExistenceDependency extends Dependency { - /** - * true : l'élément slave est affiché si le master est affiché - * false : l'élément slave est affiché si le master n'est pas affiché - */ - // private _direct: boolean; - - public toString() { - return "existdep\n " + super.toString(); - } -} diff --git a/src/app/formulaire/dependency/value-dependency-condition.ts b/src/app/formulaire/dependency/value-dependency-condition.ts deleted file mode 100644 index b0e3095688779361b463d3c59edf7a7fee71214f..0000000000000000000000000000000000000000 --- a/src/app/formulaire/dependency/value-dependency-condition.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { DependencyCondition, DependencyConditionType } from "./dependency-condition"; - - -export class ValueDependencyCondition extends DependencyCondition { - constructor(private _value: any) { - super(DependencyConditionType.HasValue); - } - - public get value(): any { - return this._value; - } - - public toString(): string { - return super.toString() + " " + this._value; - } -} diff --git a/src/app/formulaire/dependency/value-dependency.ts b/src/app/formulaire/dependency/value-dependency.ts deleted file mode 100644 index b94f9fc9bb6acda3ac142ca06a4047f4c13e9aca..0000000000000000000000000000000000000000 --- a/src/app/formulaire/dependency/value-dependency.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Dependency } from "./dependency"; -import { FormulaireElement } from "../formulaire-element"; -import { ValueDependencyCondition } from "./value-dependency-condition"; - -/** - * dépendance déterminant la valeur de l'élément esclave - */ -export class ValueDependency extends Dependency { - public slaveValue: any; - - constructor(slave: FormulaireElement, masterId: string, masterValue: any) { - super(slave, masterId, new ValueDependencyCondition(masterValue)); - } - - public toString() { - return "valdep\n " + super.toString() + "\n slave val " + this.slaveValue; - } -} diff --git a/src/app/formulaire/field.ts b/src/app/formulaire/field.ts index 3bdbef3c0a504e0364f48ced8fffdaaebc1cccc1..5982118c59dcda5894ab51b17594c191ca9d5fd8 100644 --- a/src/app/formulaire/field.ts +++ b/src/app/formulaire/field.ts @@ -1,44 +1,7 @@ import { FormulaireElement } from "./formulaire-element"; -import { ValueDependency } from "./dependency/value-dependency"; -import { Dependency } from "./dependency/dependency"; -import { isNumber } from "util"; export abstract class Field extends FormulaireElement { public abstract getValue(): any; public abstract setValue(sender: any, val: any): void; - - private parse_value_dependencies(json: {}) { - for (const di in json) { - const d = json[di]; - const masterValue = d["refvalue"]; - const dep = new ValueDependency(this, d["refid"], masterValue); - dep.slaveValue = d["value"]; - this._dependencies.push(dep); - } - } - - public parseDependencies(json: {}) { - super.parseDependencies(json); - - const dep = json["dep_value"]; - if (dep !== undefined) { - this.parse_value_dependencies(dep); - } - } - - /** - * applique une dépendance dont la condition a été vérifiée - */ - public applyDependency(d: Dependency) { - if (d instanceof ValueDependency) { - if (isNumber(d.slaveValue)) { - this.setValue(this, +d.slaveValue); - } else { - this.setValue(this, d.slaveValue); - } - } else { - super.applyDependency(d); - } - } } diff --git a/src/app/formulaire/fieldset.ts b/src/app/formulaire/fieldset.ts index 4f08999ccab374a223b46390d493f6a578aea144..061ea09f2a592e2bca7062619aa2016de8500a33 100644 --- a/src/app/formulaire/fieldset.ts +++ b/src/app/formulaire/fieldset.ts @@ -114,45 +114,41 @@ export class FieldSet extends FormulaireElement implements Observer { * @param node_type_filter filtre sur le type de noeud (input créé si undefined ou égal) * @param default_radio_config config du radio fixé/à varier/à calculer */ - private parse_input(json: {}, default_radio_config: string): NgParameter { + private parse_input(json: {}): NgParameter { const input_id: string = json["id"]; - let res: NgParameter; - - const nt: string = json["nodeType"]; - const nodeType: ComputeNodeType = nt ? ComputeNodeType[nt] : this.getPropValue("nodeType"); - - if (nodeType === this.getPropValue("nodeType")) { // si le nodeType du paramètre est le même que celui du fieldset - let nubParam: ParamDefinition; - try { - nubParam = this.getNubParamFromSymbol(input_id); - } catch (e) { - console.error(`FieldSet::parse_input : cannot find param from symbol ${input_id}`); - } - if (nubParam) { + let nubParam: ParamDefinition; + try { + nubParam = this.getNubParamFromSymbol(input_id); + if (nubParam.visible) { res = new NgParameter(nubParam, this); + res.parseConfig(json); } + } catch (e) { + // parameter does not exist in Nub, it's normal, simply do not show it (silent fail) } - - if (res) { - res.parseConfig(json, { "radioConfig": default_radio_config }); - } - return res; } private parseFields() { const fields = this._jsonConfig["fields"]; for (const field_index in fields) { - const field = fields[field_index]; + let field = fields[field_index]; + // detect short input syntax + if (typeof field === "string") { + field = { + "id": field + }; + } + const type = field["type"] || "input"; // "input" by default let param: Field; - switch (field["type"]) { + switch (type) { case "input": - const default_radio_config = this._jsonConfig["option"]; - param = this.parse_input(field, default_radio_config); - // tslint:disable-next-line:max-line-length - if (param) { // potentiellement undefined car certaines définitions de FieldSet comportent des paramètres qui ne sont pas tous affichés en même temps (cf. ouvrages //) + param = this.parse_input(field); + // potentiellement undefined car certaines définitions de FieldSet comportent des paramètres + // qui ne sont pas tous affichés en même temps (cf. ouvrages //) + if (param) { this.addField(param); } break; @@ -192,7 +188,6 @@ export class FieldSet extends FormulaireElement implements Observer { public updateFields() { this.clearFields(); this.parseFields(); - this.parseDependencies(this._jsonConfig); this.updateLocalisation(); // MAJ des selects avec les valeurs actuelles des propriétés @@ -205,11 +200,11 @@ export class FieldSet extends FormulaireElement implements Observer { const st: StructureType = this.getPropValue("structureType"); switch (st) { case StructureType.SeuilRectangulaire: - this.setSelectValueFromProperty("select_loidebit1", "loiDebit"); + this.setSelectValueFromProperty("select_loidebit", "loiDebit"); break; case StructureType.VanneRectangulaire: - this.setSelectValueFromProperty("select_loidebit2", "loiDebit"); + this.setSelectValueFromProperty("select_loidebit", "loiDebit"); break; } break; @@ -227,9 +222,6 @@ export class FieldSet extends FormulaireElement implements Observer { break; } - - // fin MAJ selects - this.applyDependencies(); } /** @@ -239,8 +231,9 @@ export class FieldSet extends FormulaireElement implements Observer { const selectField: SelectField = this.getFormulaireNodeById(selectId) as SelectField; if (selectField) { const propVal: any = this.getPropValue(propertyKey); - const selectElement = selectField.getSelectedEntryFromValue(propVal); // @TODO juste setValue() ? + const selectElement = selectField.getSelectedEntryFromValue(propVal); try { + console.log("Setting select value", selectElement); selectField.setValue(selectElement); } catch (e) { console.error(`setSelectValueFromProperty: cannot set value ${propVal} on <select> ${selectId}`); @@ -292,31 +285,6 @@ export class FieldSet extends FormulaireElement implements Observer { this.updateFields(); } - public parseDependencies(json: {}) { - super.parseDependencies(json); - - for (const k1 in json) { - if (k1 === "fields") { - const fields = json[k1]; - for (const k2 in fields) { - const field = fields[k2]; - switch (field["type"]) { - case "input": - case "select": - case "check": - for (const k of this.kids) { - if (k.id === field["id"]) { - k.parseDependencies(field); - break; - } - } - break; - } - } - } - } - } - public getNodeParameter(symbol: string): NgParameter { for (const p of this.kids) { if (p instanceof NgParameter) { diff --git a/src/app/formulaire/formulaire-element.ts b/src/app/formulaire/formulaire-element.ts index 1bd652334908494703ac6004a9e45b28634030c4..dab5ab0cb6ff2fa1c4052dbcce7c8cca0a0dd144 100644 --- a/src/app/formulaire/formulaire-element.ts +++ b/src/app/formulaire/formulaire-element.ts @@ -1,9 +1,5 @@ import { FormulaireNode } from "./formulaire-node"; import { StringMap } from "../stringmap"; -import { Dependency } from "./dependency/dependency"; -import { DependencyCondition, DependencyConditionType } from "./dependency/dependency-condition"; -import { ValueDependencyCondition } from "./dependency/value-dependency-condition"; -import { ExistenceDependency } from "./dependency/existence-dependency"; import { DeepFormulaireElementIterator } from "./form-iterator/deep-element-iterator"; import { I18nService } from "../services/internationalisation/internationalisation.service"; import { ServiceFactory } from "../services/service-factory"; @@ -29,8 +25,6 @@ export abstract class FormulaireElement extends FormulaireNode { private intlService: I18nService; - protected _dependencies: Dependency[] = []; - public static removePrefix(s: string, prefix: string): string { if (s.startsWith(prefix)) { const l = prefix.length; @@ -81,101 +75,6 @@ export abstract class FormulaireElement extends FormulaireNode { return res; } - /** - * analyse les dépendances d'existence - * @param json configuration de la dépendance - */ - private parse_existence_dependencies(json: {}) { - for (const di in json) { - if (json.hasOwnProperty(di)) { - const d = json[di]; - const rv = d["refvalue"]; - let mc: DependencyCondition; - if (rv !== undefined) { - mc = new ValueDependencyCondition(rv); - } else { - const cond = d["cond"]; - if (cond !== undefined) { - switch (cond) { - case "isvar": - mc = new DependencyCondition(DependencyConditionType.IsVariable); - break; - - case "isdisp": - mc = new DependencyCondition(DependencyConditionType.IsDisplayed); - break; - - default: - throw new Error( - "Formulaire.parse_existence_dependencies() : type de condition '" + cond + "' non pris en charge" - ); - } - } else { - throw new Error("Formulaire.parse_existence_dependencies() : infos de dépendance manquantes/non prises en charge"); - } - } - const dep = new ExistenceDependency(this, d["refid"], mc); - this._dependencies.push(dep); - } - } - } - - /** - * analyse les dépendances (existence/valeur) - * @param json configuration de la dépendance - * @param parentNode node parent dans lequel rechercher l'élément master (dont l'existence dépend) - */ - public parseDependencies(json: {}) { - const dep = json["dep_exist"]; - if (dep !== undefined) { - this.parse_existence_dependencies(dep); - } - } - - public verifiesDependency(d: Dependency): boolean { - if (d.masterCondition.type === DependencyConditionType.IsDisplayed) { - return this._isDisplayed; - } - } - - /** - * applique une dépendance dont la condition a été vérifiée - */ - public applyDependency(d: Dependency) { - if (d instanceof ExistenceDependency) { - this.isDisplayed = true; - } - } - - private prepareExistenceDependencies() { - // si des FormulaireElement sont présents dans des ExistenceDependency, on met leur membre isDisplayed à false - - for (const d of this._dependencies) { - if (d instanceof ExistenceDependency) { - this.isDisplayed = false; - break; - } - } - } - - public applyDependencies() { - this.prepareExistenceDependencies(); - - for (const d of this._dependencies) { - d.apply(); - } - - for (const k of this.getKids()) { - k.applyDependencies(); - } - } - - public printDependencies() { - for (const d of this._dependencies) { - console.log(d.toString()); - } - } - /** * Updates localisation for this element: first the label then all the element's children * @param loc calculator-specific localised messages map diff --git a/src/app/formulaire/formulaire-node.ts b/src/app/formulaire/formulaire-node.ts index 918c6d8da06ddab9dacd36d950cd3edee4bc09e7..b1406fec955349c7a7795df37e819b207015e69a 100644 --- a/src/app/formulaire/formulaire-node.ts +++ b/src/app/formulaire/formulaire-node.ts @@ -115,13 +115,6 @@ export abstract class FormulaireNode implements IObservable { public abstract parseConfig(json: {}, data?: {}); - /** - * analyse les dépendances (existence/valeur) - * @param json configuration de la dépendance - * @param parentNode nod parent dans lequel rechercher l'élément master (dont l'existence dépend) - */ - public abstract parseDependencies(json: {}); - // interface IObservable /** diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts index 5cc95c11f161b07a4163b135652b31de10783a5d..c10a48d45996f9e5fb0155b417e6fd312e5a8580 100644 --- a/src/app/formulaire/ngparam.ts +++ b/src/app/formulaire/ngparam.ts @@ -4,9 +4,6 @@ import { Interval, ParamDefinition, ParamDomain, ParamValueMode, INumberIterator import { sprintf } from "sprintf-js"; import { InputField } from "./input-field"; -import { Dependency } from "./dependency/dependency"; -import { DependencyConditionType } from "./dependency/dependency-condition"; -import { ValueDependencyCondition } from "./dependency/value-dependency-condition"; import { ServiceFactory } from "../services/service-factory"; import { FormulaireNode } from "./formulaire-node"; @@ -264,20 +261,19 @@ export class NgParameter extends InputField implements Observer { return this._paramDef.valuesIterator; } - private static getRadioConfig(s: string) { - if (s === "fix") { - return ParamRadioConfig.FIX; - } - - if (s === "var") { - return ParamRadioConfig.VAR; - } - - if (s === "cal") { - return ParamRadioConfig.CAL; + /** + * Reads radio config from parameter calculability + */ + private getRadioConfig() { + switch (this.paramDefinition.calculability) { + case ParamCalculability.FIXED: + return ParamRadioConfig.FIX; + case ParamCalculability.FREE: + return ParamRadioConfig.VAR; + case ParamCalculability.DICHO: + case ParamCalculability.EQUATION: + return ParamRadioConfig.CAL; } - - throw new Error("invalid parameter radio configuration " + s); } /** @@ -307,7 +303,7 @@ export class NgParameter extends InputField implements Observer { /** * notification envoyée après la modification de la valeur du paramètre */ - private notifyValueModified(sender: any) { + public notifyValueModified(sender: any) { let val: number; if (this._paramDef.valueMode === ParamValueMode.SINGLE) { val = this._paramDef.singleValue; @@ -441,35 +437,10 @@ export class NgParameter extends InputField implements Observer { return this._paramDef.checkStep(step); } - public parseConfig(json: {}, data?: {}) { - const radioConfig: string = json["option"] || data["radioConfig"]; - + public parseConfig(json: {}) { this._confId = json["id"]; - this.unit = json["unit"]; - const val: number = json["value"]; - if (val) { - this.setValue(this, +val); - } - this.radioConfig = NgParameter.getRadioConfig(radioConfig); - } - - public verifiesDependency(d: Dependency): boolean { - if (super.verifiesDependency(d)) { - return true; - } - switch (d.masterCondition.type) { - case DependencyConditionType.HasValue: { - const mc: ValueDependencyCondition = <ValueDependencyCondition>d.masterCondition; - return this.getValue() === mc.value; - } - - case DependencyConditionType.IsVariable: - return this.radioState === ParamRadioConfig.VAR; - - default: - throw new Error("NgParameter.verifiesDependency() : type de condition '" - + DependencyConditionType[d.masterCondition.type] + "' non pris en charge"); - } + this.unit = this.paramDefinition.unit; + this.radioConfig = this.getRadioConfig(); } // interface Observer diff --git a/src/app/formulaire/pab-table.ts b/src/app/formulaire/pab-table.ts index 9464eeef8ba8baaacf454afd9e3eb201b5c3e103..a31529bc573e56b4712c33cf3e4338216fbff768 100644 --- a/src/app/formulaire/pab-table.ts +++ b/src/app/formulaire/pab-table.ts @@ -16,8 +16,6 @@ export class PabTable extends FormulaireElement { super(parent); } - public parseDependencies(json: {}) { } // implements abstract method of FormulaireNode - public parseConfig(json: {}) { this._confId = json["id"]; } diff --git a/src/app/formulaire/select-field.ts b/src/app/formulaire/select-field.ts index 77178478bf22597c5060798051675df1bb4f724f..07f944d0917eae2fbc659694c394be4b1cfabe4d 100644 --- a/src/app/formulaire/select-field.ts +++ b/src/app/formulaire/select-field.ts @@ -1,12 +1,10 @@ -import { StructureType, LoiDebit, ComputeNodeType, MethodeResolution } from "jalhyd"; +import { LechaptCalmon, acSection, CourbeRemous, Nub, ParallelStructure, StructureType, LoiDebit } from "jalhyd"; import { Field } from "./field"; import { SelectEntry } from "./select-entry"; -import { Dependency } from "./dependency/dependency"; -import { DependencyConditionType } from "./dependency/dependency-condition"; -import { ValueDependencyCondition } from "./dependency/value-dependency-condition"; import { StringMap } from "../stringmap"; import { FormulaireNode } from "./formulaire-node"; +import { FormulaireDefinition } from "./definition/form-definition"; export class SelectField extends Field { @@ -86,22 +84,6 @@ export class SelectField extends Field { } } - public verifiesDependency(d: Dependency): boolean { - if (super.verifiesDependency(d)) { - return true; - } - - switch (d.masterCondition.type) { - case DependencyConditionType.HasValue: - const mc: ValueDependencyCondition = <ValueDependencyCondition>d.masterCondition; - return this._selectedEntry.id === mc.value; - - default: - throw new Error("SelectField.verifiesDependency() : type de condition '" - + DependencyConditionType[d.masterCondition.type] + "' non pris en charge"); - } - } - public updateLocalisation(loc: StringMap) { super.updateLocalisation(loc); for (const e of this._entries) { @@ -111,38 +93,61 @@ export class SelectField extends Field { public parseConfig(field: {}, data?: {}) { this._confId = field["id"]; - const values = field["select"]; - for (const v of values) { - let val: string; - if (v.enum) { - const tmp = v.enum.split("."); - switch (tmp[0]) { - case "ComputeNodeType": - val = ComputeNodeType[tmp[1]]; - break; - - case "StructureType": - val = StructureType[tmp[1]]; - break; - - case "LoiDebit": - val = LoiDebit[tmp[1]]; - break; - - case "MethodeResolution": - val = MethodeResolution[tmp[1]]; - break; - - default: - throw new Error(`type d'enum ${tmp[0]} non pris en charge`); + const source = field["source"]; + const nub: Nub = (this.parentForm as FormulaireDefinition).currentNub; + // ad-hoc cases + switch (source) { + + case "lechapt_calmon_material": + this.addEntry(new SelectEntry("select_material_empty", "")); + let i = 0; + for (const mat of LechaptCalmon.materials) { + const e: SelectEntry = new SelectEntry("select_material_" + (i + 1), i); + this.addEntry(e); + i++; } - } else if (v.value) { - val = v.value; - } + break; - const id = v["id"]; - const e: SelectEntry = new SelectEntry(id, val); - this.addEntry(e); + case "acsection_section": + for (const sec of acSection.availableSectionTypes) { + const e: SelectEntry = new SelectEntry("select_section_" + sec.id, sec.value); + this.addEntry(e); + } + break; + + case "remous_methode_resolution": + for (const mr of CourbeRemous.availableMethodeResolution) { + const e: SelectEntry = new SelectEntry("select_resolution_" + mr.id, mr.value); + this.addEntry(e); + } + break; + + case "remous_target": + this.addEntry(new SelectEntry("select_target_none", "")); + for (const at of CourbeRemous.availableTargets) { + const e: SelectEntry = new SelectEntry("select_target_" + at, at); + this.addEntry(e); + } + break; + + case "device_structure_type": + for (const st in (nub as ParallelStructure).getLoisAdmissibles()) { + const e: SelectEntry = new SelectEntry("select_structure_" + st, StructureType[st]); + this.addEntry(e); + } + break; + + case "device_loi_debit": + // get current structure type from appropriate Nub child + const child = nub.getChildren()[this.parent.indexAsKid()]; + const cst = child.properties.getPropValue("structureType"); + const la = (nub as ParallelStructure).getLoisAdmissibles(); + const stName = StructureType[cst]; + for (const ld of la[stName]) { + const e: SelectEntry = new SelectEntry("select_loidebit_" + stName + "_" + LoiDebit[ld], ld); + this.addEntry(e); + } + break; } } } diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts index 0b499b5d895036c7bcc44e8e9f6525f8afa95862..97016de31a93512fa5f8082189bb358580ad8321 100644 --- a/src/app/services/formulaire/formulaire.service.ts +++ b/src/app/services/formulaire/formulaire.service.ts @@ -394,7 +394,6 @@ export class FormulaireService extends Observable { return f; }).then(fi => { - fi.applyDependencies(); this.notifyObservers({ "action": "createForm", "form": fi