1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-02-07 10:40:19 -05:00

Fixed a lil' bug.

Should AddDTM be in the constructor of TMDTM?
Now you need to do AddDTM(mdtm) in the script?
This commit is contained in:
Niels 2010-05-19 19:40:07 +02:00
parent 9d59b3d6ee
commit 1eaac406b5
2 changed files with 7 additions and 8 deletions

View File

@ -34,8 +34,6 @@ type
{ TMDTM } { TMDTM }
{ TMDTM }
TMDTM = class(TObject) TMDTM = class(TObject)
private private
FPoints : TMDTMPointArray; FPoints : TMDTMPointArray;
@ -51,6 +49,9 @@ type
property Count : integer read FLen write SetPointCount; property Count : integer read FLen write SetPointCount;
property Points : TMDTMPointArray read FPoints; property Points : TMDTMPointArray read FPoints;
end; end;
{ TMDTMS }
TMDTMS = class(TObject) //Manages the DTMs TMufasaDTMs TMDTMS = class(TObject) //Manages the DTMs TMufasaDTMs
private private
Client: TObject; Client: TObject;
@ -256,15 +257,12 @@ end;
function TMDTM.ToString: string; function TMDTM.ToString: string;
begin begin
Result := '';
end; end;
function TMDTM.Valid: boolean; function TMDTM.Valid: boolean;
begin begin
result := false; Result := Count > 0;
if Count < 1 then
exit;
result := true;
end; end;
end. end.

View File

@ -127,6 +127,7 @@ function SDTMToMDTM(Const DTM: TSDTM): TMDTM;
var var
I: Integer; I: Integer;
begin begin
Result := TMDTM.Create;
Result.Count := Length(DTM.SubPoints) + 1; //The mainpoint is in a different structure Result.Count := Length(DTM.SubPoints) + 1; //The mainpoint is in a different structure
Result.Points[0].x := DTM.MainPoint.x; Result.Points[0].x := DTM.MainPoint.x;
@ -152,7 +153,7 @@ procedure NormalizeDTM(var dtm: TMDTM);
var var
i:integer; i:integer;
begin begin
if (dtm.count < 1) or ((dtm.Points[0].x = 0) and (dtm.Points[0].y = 0)) then //Already normalized if (dtm = nil) or (dtm.count < 1) or ((dtm.Points[0].x = 0) and (dtm.Points[0].y = 0)) then //Already normalized
exit; exit;
for i := 1 to dtm.Count - 1 do for i := 1 to dtm.Count - 1 do
begin begin