summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-10-28 14:50:40 +0100
committerErich Eckner <git@eckner.net>2019-10-28 14:50:40 +0100
commit263032e8907c17f38ce0b23d99f72333d903bbc4 (patch)
treede6a2a576e8d103a91fe4ec7ca31e64127fe90e4
parent80317676d331751345b450e9757f35a991e9d001 (diff)
downloadepost-263032e8907c17f38ce0b23d99f72333d903bbc4.tar.xz
epostunit.pas: ausdehnungsParameterErkannt neu und verwendet
-rw-r--r--epostunit.pas242
1 files changed, 68 insertions, 174 deletions
diff --git a/epostunit.pas b/epostunit.pas
index 0ef4b6b..44b6427 100644
--- a/epostunit.pas
+++ b/epostunit.pas
@@ -130,6 +130,7 @@ type
function xScale: extended;
function tScale: extended;
function dichtenParameterErkannt(sT: boolean; s: string; var bekannteBefehle: tMyStringList; threads,xMin,xMax,tMin,tMax: longint): boolean;
+ function ausdehnungsParameterErkannt(sT: boolean; s: string; wessenSkala: tWerte; var bekannteBefehle: tMyStringList; var xMin,xMax,tMin,tMax: longint): boolean;
function kont2disk(senkrecht: boolean; x: extended): longint; overload; inline;
function kont2disk(dir: char; x: extended): longint; overload;
function kont2diskFak(senkrecht: boolean; x: extended): extended; overload; inline;
@@ -1332,11 +1333,13 @@ begin
vorlagen.gamma:=exprToFloat(false,s);
continue;
end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
+ if istDasBefehl('tMin:',s,bekannteBefehle,true) or
+ istDasBefehl('yMin:',s,bekannteBefehle,true) then begin
vorlagen.tStart:=exprToFloat(false,s);
continue;
end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
+ if istDasBefehl('tMax:',s,bekannteBefehle,true) or
+ istDasBefehl('yMax:',s,bekannteBefehle,true) then begin
vorlagen.tStop:=exprToFloat(false,s);
continue;
end;
@@ -2340,6 +2343,32 @@ begin
result:=false;
end;
+function tWerte.ausdehnungsParameterErkannt(sT: boolean; s: string; wessenSkala: tWerte; var bekannteBefehle: tMyStringList; var xMin,xMax,tMin,tMax: longint): boolean;
+begin
+ result:=true;
+ if not assigned(wessenSkala) then
+ wessenSkala:=self;
+ if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
+ xMin:=wessenSkala.kont2disk('x',wessenSkala.exprToFloat(sT,s));
+ exit;
+ end;
+ if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
+ xMax:=wessenSkala.kont2disk('x',wessenSkala.exprToFloat(sT,s));
+ exit;
+ end;
+ if istDasBefehl('tMin:',s,bekannteBefehle,true) or
+ istDasBefehl('yMin:',s,bekannteBefehle,true) then begin
+ tMin:=wessenSkala.kont2disk('t',wessenSkala.exprToFloat(sT,s));
+ exit;
+ end;
+ if istDasBefehl('tMax:',s,bekannteBefehle,true) or
+ istDasBefehl('yMax:',s,bekannteBefehle,true) then begin
+ tMax:=wessenSkala.kont2disk('t',wessenSkala.exprToFloat(sT,s));
+ exit;
+ end;
+ result:=false;
+end;
+
function tWerte.kont2disk(senkrecht: boolean; x: extended): longint;
begin
result:=kont2disk(char(ord('x')+byte(senkrecht)),x);
@@ -2750,38 +2779,13 @@ begin
exit;
end;
if istDasBefehl('Ende',s,bekannteBefehle,false) then break;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- if length(liKo)=0 then begin
- gibAus('xMin kann erst gesetzt werden, wenn wenigstens eine Komponente bekannt ist',3);
- exit;
- end;
- xMin:=liKo[0].werte.kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- if length(liKo)=0 then begin
- gibAus('xMax kann erst gesetzt werden, wenn wenigstens eine Komponente bekannt ist',3);
- exit;
- end;
- xMax:=liKo[0].werte.kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- if length(liKo)=0 then begin
- gibAus('tMin kann erst gesetzt werden, wenn wenigstens eine Komponente bekannt ist',3);
- exit;
- end;
- tMin:=liKo[0].werte.kont2disk('t',exprToFloat(sT,s));
- continue;
+ if ((length(liKo)=0) and
+ ausdehnungsParameterErkannt(sT,s,nil,bekannteBefehle,xMin,xMax,tMin,tMax)) then begin
+ gibAus('Ausdehnung kann erst gesetzt werden, wenn wenigstens eine Komponente bekannt ist',3);
+ exit;
end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- if length(liKo)=0 then begin
- gibAus('tMax kann erst gesetzt werden, wenn wenigstens eine Komponente bekannt ist',3);
- exit;
- end;
- tMax:=liKo[0].werte.kont2disk('t',exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,liKo[0].werte,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
if tMax<tMin then begin
i:=tMax;
tMax:=tMin;
@@ -2914,6 +2918,7 @@ var
quellen: tWerteArray;
s: string;
Zeit: extended;
+ bekannteBefehle: tMyStringList;
begin
result:=false;
warteAufBeendigungDesLeseThreads;
@@ -2930,48 +2935,42 @@ begin
transformationen:=tAgglomeration.create;
(transformationen as tAgglomeration).schritt:=-1;
(transformationen as tAgglomeration).horizontal:=false;
+ bekannteBefehle:=tMyStringList.create;
repeat
+ bekannteBefehle.clear;
if not f.metaReadln(s,true) then begin
gibAus('Unerwartetes Dateiende!',3);
+ bekannteBefehle.free;
exit;
end;
- if s='Ende' then break;
- if startetMit('xMin:',s) then begin
- xMin:=quellen[0].kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if startetMit('xMax:',s) then begin
- xMax:=quellen[0].kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if startetMit('tMin:',s) then begin
- tMin:=quellen[0].kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
- if startetMit('tMax:',s) then begin
- tMax:=quellen[0].kont2disk('t',exprToFloat(sT,s));
+ if istDasBefehl('Ende',s,bekannteBefehle,false) then
+ break;
+ if ausdehnungsParameterErkannt(sT,s,quellen[0],bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
- if startetMit('Schritt:',s) then begin
+ if istDasBefehl('Schritt:',s,bekannteBefehle,true) then begin
(transformationen as tAgglomeration).schritt:=exprToFloat(sT,s);
continue;
end;
- if startetMit('Nullposition:',s) then begin
+ if istDasBefehl('Nullposition:',s,bekannteBefehle,true) then begin
(transformationen as tAgglomeration).nullposition:=exprToFloat(sT,s);
continue;
end;
- if s='waagerecht' then begin
+ if istDasBefehl('waagerecht',s,bekannteBefehle,false) then begin
(transformationen as tAgglomeration).horizontal:=true;
continue;
end;
- if s='senkrecht' then begin
+ if istDasBefehl('senkrecht',s,bekannteBefehle,false) then begin
(transformationen as tAgglomeration).horizontal:=true;
continue;
end;
setLength(quellen,length(quellen)+1);
i:=findeWerte(erstesArgument(s),nil,wertes,konturen,false);
- if (i<0) or (wertes^[i]=self) then
+ if (i<0) or (wertes^[i]=self) then begin
+ bekannteBefehle.sort;
+ gibAus('Ansonsten kenne ich noch folgende Befehle:'#10+bekannteBefehle.text,3);
+ bekannteBefehle.free;
exit;
+ end;
quellen[length(quellen)-1]:=wertes^[i];
if length(quellen)=1 then begin
_xSteps:=quellen[0]._xSteps;
@@ -2979,29 +2978,36 @@ begin
end;
if _xSteps<>quellen[length(quellen)-1]._xSteps then begin
gibAus('Unterschiedliche Anzahl an x-Schritten: '+intToStr(_xSteps)+' bisher vs. '+intToStr(quellen[length(quellen)-1]._xSteps)+' bei '+intToStr(i)+'!',3);
+ bekannteBefehle.free;
exit;
end;
if _tSiz<>quellen[length(quellen)-1]._tSiz then begin
gibAus('Unterschiedliche Anzahl an t-Schritten: '+intToStr(_tSiz)+' bisher vs. '+intToStr(quellen[length(quellen)-1]._tSiz)+' bei '+intToStr(i)+'!',3);
+ bekannteBefehle.free;
exit;
end;
if quellen[length(quellen)-1].transformationen.xStart<>quellen[0].transformationen.xStart then begin
gibAus('Anfangspostionen passen nicht zusammen ('+floatToStr(quellen[0].transformationen.xStart)+' bisher vs. '+floatToStr(quellen[length(quellen)-1].transformationen.xStart)+' bei '+intToStr(i)+')!',3);
+ bekannteBefehle.free;
exit;
end;
if quellen[length(quellen)-1].transformationen.xStop<>quellen[0].transformationen.xStop then begin
gibAus('Endpostionen passen nicht zusammen ('+floatToStr(quellen[0].transformationen.xStop)+' bisher vs. '+floatToStr(quellen[length(quellen)-1].transformationen.xStop)+' bei '+intToStr(i)+')!',3);
+ bekannteBefehle.free;
exit;
end;
if quellen[length(quellen)-1].transformationen.tStart<>quellen[0].transformationen.tStart then begin
gibAus('Anfangszeiten passen nicht zusammen ('+floatToStr(quellen[0].transformationen.tStart)+' bisher vs. '+floatToStr(quellen[length(quellen)-1].transformationen.tStart)+' bei '+intToStr(i)+')!',3);
+ bekannteBefehle.free;
exit;
end;
if quellen[length(quellen)-1].transformationen.tStop<>quellen[0].transformationen.tStop then begin
gibAus('Endzeiten passen nicht zusammen ('+floatToStr(quellen[0].transformationen.tStop)+' bisher vs. '+floatToStr(quellen[length(quellen)-1].transformationen.tStop)+' bei '+intToStr(i)+')!',3);
+ bekannteBefehle.free;
exit;
end;
until false;
+ bekannteBefehle.free;
if length(quellen)=0 then begin
gibAus('Leere Agglomeration!',3);
@@ -3121,22 +3127,8 @@ begin
end;
bekannteBefehle.clear;
if istDasBefehl('Ende',s,bekannteBefehle,false) then break;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- xMin:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- xMax:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- tMin:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- tMax:=kont2disk('t',exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,nil,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
if istDasBefehl('epsilon:',s,bekannteBefehle,true) then begin
epsilon:=exprToFloat(sT,s);
continue;
@@ -3233,22 +3225,8 @@ begin
end;
bekannteBefehle.clear;
if istDasBefehl('Ende',s,bekannteBefehle,false) then break;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- xMin:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- xMax:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- tMin:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- tMax:=kont2disk('t',exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,nil,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
if istDasBefehl('konjugiert',s,bekannteBefehle,false) then begin
konjugiert:=true;
continue;
@@ -3466,7 +3444,7 @@ function tWerte.ermittleMinMaxDichten(sT: boolean; f: tMyStringList; threads: lo
var
s: string;
bekannteBefehle: tMyStringList;
- xMin,xMax,tMin,tMax: int64;
+ xMin,xMax,tMin,tMax: longint;
begin
result:=false;
warteAufBeendigungDesLeseThreads;
@@ -3485,22 +3463,8 @@ begin
end;
bekannteBefehle.clear;
if istDasBefehl('Ende',s,bekannteBefehle,false) then break;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- xMin:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- xMax:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- tMin:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- tMax:=kont2disk('t',exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,nil,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
bekannteBefehle.sort;
gibAus('Verstehe Option '''+s+''' nicht beim Ermitteln von Minimum und Maximum!'#10'Ich kenne:'#10+bekannteBefehle.text,3);
bekannteBefehle.free;
@@ -5599,22 +5563,8 @@ begin
threads:=strToInt(s);
continue;
end;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- xMin:=quelle.kont2disk('x',quelle.exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- xMax:=quelle.kont2disk('x',quelle.exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- tMin:=quelle.kont2disk('t',quelle.exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,quelle,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- tMax:=quelle.kont2disk('t',quelle.exprToFloat(sT,s));
- continue;
- end;
if istDasBefehl('Richtung:',s,bekannteBefehle,true) then begin
bekannteBefehle.clear;
if istDasBefehl('waagerecht',s,bekannteBefehle,false) then begin
@@ -6295,22 +6245,8 @@ begin
continue;
end;
if self.dichtenParameterErkannt(sT,s,bekannteBefehle,threads,xMin,xMax,tMin,tMax) then continue;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- xMin:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- xMax:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- tMin:=kont2disk('t',exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,nil,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- tMax:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
if istDasBefehl('modulo',s,bekannteBefehle,false) then begin
modulo:=true;
continue;
@@ -6692,22 +6628,8 @@ begin
datei:=s;
continue;
end;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- xMin:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- xMax:=kont2disk('x',exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,nil,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- tMin:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- tMax:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
if istDasBefehl('Koordinaten einfügen',s,bekannteBefehle,false) then begin
if (_xSteps=1) or (_tSiz=1) then begin
mitKoordinaten:=byte(_xSteps=1)*2 + byte(_tSiz=1);
@@ -7453,22 +7375,8 @@ begin
datei:=s;
continue;
end;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- xMin:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- xMax:=kont2disk('x',exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,nil,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- tMin:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- tMax:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
if istDasBefehl('x-Skalierung:',s,bekannteBefehle,true) then begin
xFak:=kont2diskFak('x',exprToFloat(sT,s));
continue;
@@ -7601,22 +7509,8 @@ begin
datei:=s;
continue;
end;
- if istDasBefehl('xMin:',s,bekannteBefehle,true) then begin
- xMin:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('xMax:',s,bekannteBefehle,true) then begin
- xMax:=kont2disk('x',exprToFloat(sT,s));
- continue;
- end;
- if istDasBefehl('tMin:',s,bekannteBefehle,true) then begin
- tMin:=kont2disk('t',exprToFloat(sT,s));
+ if ausdehnungsParameterErkannt(sT,s,nil,bekannteBefehle,xMin,xMax,tMin,tMax) then
continue;
- end;
- if istDasBefehl('tMax:',s,bekannteBefehle,true) then begin
- tMax:=kont2disk('t',exprToFloat(sT,s));
- continue;
- end;
if istDasBefehl('toroidal',s,bekannteBefehle,false) then begin
toroidal:=true;
continue;