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

Espece: load predefined species criteria #248

parent 453381e8
No related branches found
No related tags found
No related merge requests found
......@@ -953,6 +953,33 @@ export class Espece extends Nub implements Observer {
}
}
}
/**
* Load ICE tables values into parameters, for a given species
* (used in GUI for loading predefined species)
*/
public loadPredefinedSpecies(sp: FishSpecies) {
let found: boolean;
// for each param
for (const p of this.prms) {
if (p.symbol !== "OK") {
// reset current value
p.singleValue = undefined;
// whatever the pass type (criteria are supposed to apply to 1 pass type only)
found = false;
for (const pt of Object.keys(this.presets)) {
const preset = this.presets[pt];
if (! found && preset !== undefined && preset[sp] !== undefined && preset[sp][p.symbol] !== undefined) {
found = true;
// if (preset[sp][p.symbol] !== undefined) console.log(`-> setting ${p.symbol} to ${preset[sp][p.symbol]}`);
// apply preset
p.singleValue = preset[sp][p.symbol];
}
}
}
}
}
/** Parameters other than OK are just settings here, nothing can vary or be calculated */
protected setParametersCalculability(): void {
for (const p of this._prms) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment