Permalink
Browse files

Added DTMExists.

  • Loading branch information...
1 parent bafa6f2 commit c129b88fee70087fa5dda1bd270f00f158e276a2 @kwollaston committed Mar 20, 2012
@@ -77,3 +77,8 @@ procedure Lape_CreateDTMPoint(const Params: PParamArray; const Result: Pointer);
begin
PMDTMPoint(Result)^ := ps_CreateDTMPoint(Pinteger(Params^[0])^, Pinteger(Params^[1])^, Pinteger(Params^[2])^, Pinteger(Params^[3])^, Pinteger(Params^[4])^, Pboolean(Params^[5])^);
end;
+
+procedure Lape_DTMExists(const Params : PParamArray; const Result : Pointer);
+begin
+ PBoolean(Result)^ := ps_DTMExists(PLongInt(Params^[0])^);
+end;
@@ -35,6 +35,7 @@ AddGlobalFunc('procedure FreeDTM(DTM: Integer);', @Lape_FreeDTM);
//AddGlobalFunc('function GetDTM(index: Integer): TMDTM', @Lape_GetDTM);
AddGlobalFunc('function AddSDTM(const d: TSDTM): Integer', @Lape_AddTSDTM);
//AddGlobalFunc('function AddDTM(const d: TMDTM): Integer', @Lape_AddDTM);
+AddGlobalFunc('function DTMExists(index : integer) : boolean', @Lape_DTMExists);
//AddGlobalFunc('procedure PrintDTM(const aDTM: TMDTM);', @Lape_PrintDTM);
//AddGlobalFunc('function MDTMToSDTM(Const DTM: TMDTM): TSDTM', @Lape_MDTMToSDTM);
//AddGlobalFunc('function SDTMToMDTM(Const DTM: TSDTM): TMDTM', @Lape_SDTMToMDTM);
@@ -113,3 +113,8 @@ function ps_CreateDTMPoint(x,y,c,t,asz : integer; bp : boolean) : TMDTMPoint;
begin
result := CreateDTMPoint(x,y,c,t,asz,bp);
end;
+
+function ps_DTMExists(index : integer) : boolean;
+begin
+ result := CurrThread.Client.MDTMs.ExistsDTM(index);
+end;
@@ -43,6 +43,7 @@ AddFunction(@ps_FindDTMsRotatedSE, 'function FindDTMsRotatedSE(DTM: Integer; var
AddFunction(@ps_FindDTMsRotatedAlternating, 'function FindDTMsRotatedAlternating(DTM: Integer; var Points: TPointArray; xs, ys, xe, ye: Integer; sAngle, eAngle, aStep: Extended; var aFound: T2DExtendedArray) : Boolean;');
AddFunction(@ps_addDTM, 'function AddMDTM(const d: TMDTM): Integer;');
AddFunction(@ps_addDTM, 'function AddDTM(const d: TMDTM): Integer;');
+AddFunction(@ps_DTMExists, 'function DTMExists(index : integer) : boolean;');
AddFunction(@ps_addTSDTM, 'function AddSDTM(const d: TSDTM): Integer;');
AddFunction(@ps_GetDTM ,'function GetDTM(index: Integer) : TMDTM');
AddFunction(@ps_SDTMToMDTM, 'function SDTMToMDTM(Const DTM: TSDTM): TMDTM;');
@@ -414,7 +414,7 @@ function TMBitmaps.ExistsBMP(Index : integer) : boolean;
begin
result := false;
if (Index >= 0) and (Index <= BmpsCurr) then
- result := BmpArray[Index] <> nil;
+ result := Assigned(BmpArray[Index]);
end;
function TMBitmaps.CreateBMPFromString(width, height: integer; Data: string): integer;
View
@@ -67,6 +67,7 @@ TMDTMS = class(TObject) //Manages the DTMs TMufasaDTMs
public
function AddDTM(const d: TSDTM): Integer;overload;
function AddDTM(const d: TMDTM): Integer;overload;
+ function ExistsDTM(index : integer) : boolean;
function GetDTM(index: Integer) :TMDTM;
procedure FreeDTM(DTM: Integer);
function StringToDTM(const S: String): Integer;
@@ -190,6 +191,13 @@ function TMDTMS.AddDTM(const d: TMDTM): Integer;
DTMList[result].Normalize;
end;
+function TMDTMS.ExistsDTM(index : integer) : boolean;
+begin
+ result := false;
+ if (index >= 0) and (index <= High(DTMList)) then
+ result := Assigned(DTMList[index]);
+end;
+
{/\
Returns the DTM (pDTM type) in the variable dtm at the given index.
Returns true is succesfull, false if the dtm does not exist.

0 comments on commit c129b88

Please sign in to comment.