Commit ab82e028 authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Removed Lechapt-Calmon and SectionParametree dependencies from config, use...

Removed Lechapt-Calmon and SectionParametree dependencies from config, use hardcoded presets from model instead
parent 1a73ac2a
......@@ -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);
......
......@@ -7,194 +7,22 @@
{
"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_materials"
},
{
"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"
}
]
"unit": ""
},
{
"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"
}
]
"unit": ""
},
{
"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"
}
]
"unit": ""
}
]
},
......
......@@ -7,96 +7,43 @@
{
"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_available_sections"
},
{
"type": "input",
"id": "LargeurFond",
"unit": "m",
"nodeType": "SectionTrapeze",
"dep_exist": [
{
"refid": "select_section",
"refvalue": "select_section_trapez"
}
]
"nodeType": "SectionTrapeze"
},
{
"type": "input",
"id": "Fruit",
"nodeType": "SectionTrapeze",
"unit": "m/m",
"dep_exist": [
{
"refid": "select_section",
"refvalue": "select_section_trapez"
}
]
"unit": "m/m"
},
{
"type": "input",
"id": "LargeurBerge",
"unit": "m",
"nodeType": "SectionRectangle",
"dep_exist": [
{
"refid": "select_section",
"refvalue": "select_section_rect"
}
]
"nodeType": "SectionRectangle"
},
{
"type": "input",
"id": "D",
"unit": "m",
"nodeType": "SectionCercle",
"dep_exist": [
{
"refid": "select_section",
"refvalue": "select_section_circ"
}
]
"nodeType": "SectionCercle"
},
{
"type": "input",
"id": "k",
"unit": "",
"nodeType": "SectionPuissance",
"dep_exist": [
{
"refid": "select_section",
"refvalue": "select_section_puiss"
}
]
"nodeType": "SectionPuissance"
},
{
"type": "input",
"id": "LargeurBerge",
"unit": "m",
"nodeType": "SectionPuissance",
"dep_exist": [
{
"refid": "select_section",
"refvalue": "select_section_puiss"
}
]
"nodeType": "SectionPuissance"
}
]
},
......
......@@ -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() {
......
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) {
......
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);
}
}
}
......@@ -307,7 +307,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;
......
import { StructureType, LoiDebit, ComputeNodeType, MethodeResolution } from "jalhyd";
import { LechaptCalmon, acSection } from "jalhyd";
import { Field } from "./field";
import { SelectEntry } from "./select-entry";
......@@ -111,8 +111,29 @@ export class SelectField extends Field {
public parseConfig(field: {}, data?: {}) {
this._confId = field["id"];
const values = field["select"];
for (const v of values) {
const source = field["source"];
// ad-hoc cases
switch (source) {
case "lechapt_calmon_materials":
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++;
}
break;
case "acsection_available_sections":
for (const sec of acSection.availableSectionTypes) {
const e: SelectEntry = new SelectEntry("select_section_" + sec.id, sec.value);
console.log(">> adding entry", e);
this.addEntry(e);
}
break;
}
/* for (const v of values) {
let val: string;
if (v.enum) {
const tmp = v.enum.split(".");
......@@ -143,6 +164,6 @@ export class SelectField extends Field {
const id = v["id"];
const e: SelectEntry = new SelectEntry(id, val);
this.addEntry(e);
}
} */
}
}
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