Commit 0566244b authored by Grand Francois's avatar Grand Francois
Browse files

ticket #36 : courbes de remous : transformation des abscisses string[] -> number[]

Showing with 17 additions and 15 deletions
+17 -15
...@@ -419,13 +419,13 @@ export class CourbeRemous extends Nub { ...@@ -419,13 +419,13 @@ export class CourbeRemous extends Nub {
return res; return res;
} }
private logArray(a: string[]) { private logArray(a: any[]) {
let s = "["; let s = "[";
let first = true; let first = true;
for (let e of a) { for (let e of a) {
if (!first) if (!first)
s += ","; s += ",";
s += +e; s += String(e);
first = false; first = false;
} }
s += "]"; s += "]";
...@@ -766,18 +766,20 @@ export class CourbeRemous extends Nub { ...@@ -766,18 +766,20 @@ export class CourbeRemous extends Nub {
this.debug(JSON.stringify(crbPartielle)); this.debug(JSON.stringify(crbPartielle));
// Définition des abscisses // Définition des abscisses
let trX: string[] = []; let trX: number[] = [];
if (nFlu != 0) if (nFlu != 0)
trX = Object.keys(crbFlu); trX = Object.keys(crbFlu).map(k => +k);
if (nTor != 0) if (nTor != 0) {
trX = trX.concat(Object.keys(crbTor)); const kTor = Object.keys(crbTor).map(k => +k);
trX = trX.concat(kTor);
}
// this.debug("trX=" + trX); // this.debug("trX=" + trX);
trX.sort((a, b) => { trX.sort((a, b) => {
if (+a > +b) return 1; if (a > b) return 1;
if (+a < +b) return -1; if (a < b) return -1;
return 0; return 0;
}); });
// this.debug("trX tri=" + trX); // this.debug("trX tri=" + trX);
...@@ -797,15 +799,15 @@ export class CourbeRemous extends Nub { ...@@ -797,15 +799,15 @@ export class CourbeRemous extends Nub {
if (val_a_cal != undefined && (nFlu != 0 || nTor != 0)) { if (val_a_cal != undefined && (nFlu != 0 || nTor != 0)) {
for (let rX of trX) { for (let rX of trX) {
let rY = undefined; let rY = undefined;
let hasFlu: boolean = crbFlu[+rX] != undefined; let hasFlu: boolean = crbFlu[rX] != undefined;
let hasTor: boolean = crbTor[+rX] != undefined; let hasTor: boolean = crbTor[rX] != undefined;
if (hasFlu && !hasTor) if (hasFlu && !hasTor)
rY = crbFlu[+rX]; rY = crbFlu[rX];
if (hasTor) if (hasTor)
if (!hasFlu || (hasFlu && crbFlu[+rX] == crbTor[+rX])) if (!hasFlu || (hasFlu && crbFlu[rX] == crbTor[rX]))
rY = crbTor[+rX]; rY = crbTor[rX];
if (rY != undefined) { if (rY != undefined) {
// tRes[+rX] = this.Sn.Calc(val_a_cal, rY); // tRes[+rX] = this.Sn.Calc(val_a_cal, rY);
...@@ -814,8 +816,8 @@ export class CourbeRemous extends Nub { ...@@ -814,8 +816,8 @@ export class CourbeRemous extends Nub {
res.addLog(rVar.log); res.addLog(rVar.log);
return res; return res;
} }
tRes[+rX] = rVar.vCalc; tRes[rX] = rVar.vCalc;
this.debug('X=' + rX + ' Calc(' + val_a_cal + ', Y=' + rY + ')=' + tRes[+rX]); this.debug('X=' + rX + ' Calc(' + val_a_cal + ', Y=' + rY + ')=' + tRes[rX]);
} }
} }
......
Supports Markdown
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