2009-10-12 11:04:52 -04:00
|
|
|
{
|
|
|
|
This file is part of the Mufasa Macro Library (MML)
|
2009-10-12 13:47:46 -04:00
|
|
|
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
|
2009-10-12 11:04:52 -04:00
|
|
|
|
|
|
|
MML is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
MML is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with MML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
See the file COPYING, included in this distribution,
|
|
|
|
for details about the copyright.
|
|
|
|
|
|
|
|
DTM.inc for the Mufasa Macro Library
|
|
|
|
}
|
|
|
|
|
2009-11-12 13:22:09 -05:00
|
|
|
function ps_FindDTM(DTM: Integer; out x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
|
2009-12-01 18:41:43 -05:00
|
|
|
var
|
|
|
|
temp: pDTM;
|
2009-10-03 15:17:54 -04:00
|
|
|
begin
|
2009-12-01 18:41:43 -05:00
|
|
|
if CurrThread.Client.MDTM.GetDTM(DTM, temp) then
|
|
|
|
Result := CurrThread.Client.MFinder.FindDTM(temp, x, y, x1, y1, x2, y2)
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
x := 0;
|
|
|
|
y := 0;
|
|
|
|
Result := False;
|
|
|
|
end;
|
2009-10-03 15:17:54 -04:00
|
|
|
end;
|
|
|
|
|
2009-11-12 13:22:09 -05:00
|
|
|
function ps_FindDTMs(DTM: Integer; out p: TPointArray; x1, y1, x2, y2: Integer): Boolean;
|
2009-12-01 18:41:43 -05:00
|
|
|
var
|
|
|
|
temp: pDTM;
|
2009-10-05 23:40:44 -04:00
|
|
|
begin
|
2009-12-01 18:41:43 -05:00
|
|
|
if CurrThread.Client.MDTM.GetDTM(DTM, temp) then
|
2009-12-02 14:04:29 -05:00
|
|
|
Result := CurrThread.Client.MFinder.FindDTMs(temp, p, x1, y1, x2, y2, 0)
|
2009-12-01 18:41:43 -05:00
|
|
|
else
|
|
|
|
begin
|
|
|
|
setlength(p,0);
|
|
|
|
Result := False;
|
|
|
|
end;
|
2009-10-05 23:40:44 -04:00
|
|
|
end;
|
|
|
|
|
2009-11-12 13:22:09 -05:00
|
|
|
function ps_FindDTMRotated(DTM: Integer; out x, y: Integer; x1, y1, x2, y2:
|
2009-10-06 02:52:38 -04:00
|
|
|
Integer; sAngle, eAngle, aStep: Extended;
|
2009-11-12 13:22:09 -05:00
|
|
|
out aFound: Extended): Boolean;
|
2009-12-01 18:41:43 -05:00
|
|
|
var
|
|
|
|
temp: pDTM;
|
2009-10-06 02:52:38 -04:00
|
|
|
begin
|
2009-12-01 18:41:43 -05:00
|
|
|
if CurrThread.Client.MDTM.GetDTM(DTM, temp) then
|
|
|
|
Result := CurrThread.Client.MFinder.FindDTMRotated(temp, x, y, x1, y1, x2, y2, sAngle, eAngle, aStep, aFound)
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
x := 0;
|
|
|
|
y := 0;
|
|
|
|
Result := False;
|
|
|
|
end;
|
2009-10-06 02:52:38 -04:00
|
|
|
end;
|
2009-10-05 23:40:44 -04:00
|
|
|
|
2009-12-01 18:41:43 -05:00
|
|
|
function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: T2DExtendedArray): Boolean;
|
|
|
|
var
|
|
|
|
temp: pDTM;
|
2009-10-06 02:52:38 -04:00
|
|
|
begin
|
2009-12-01 18:41:43 -05:00
|
|
|
if CurrThread.Client.MDTM.GetDTM(DTM, temp) then
|
|
|
|
Result := CurrThread.Client.MFinder.FindDTMsRotated(temp, Points, x1, y1, x2, y2,
|
2009-12-26 10:01:19 -05:00
|
|
|
sAngle, eAngle, aStep, aFound, 0)
|
2009-12-01 18:41:43 -05:00
|
|
|
else
|
|
|
|
Result := False;
|
2009-10-06 02:52:38 -04:00
|
|
|
end;
|
|
|
|
|
2009-12-01 18:41:43 -05:00
|
|
|
{function ps_FindDTMsRotated(DTM: Integer; out Points: TPointArray; x1,
|
2009-10-06 02:52:38 -04:00
|
|
|
y1, x2, y2: Integer; sAngle, eAngle,
|
2009-11-12 13:22:09 -05:00
|
|
|
aStep: Extended; out aFound: T2DExtendedArray)
|
2009-10-06 02:52:38 -04:00
|
|
|
: Boolean;
|
|
|
|
begin
|
|
|
|
Result := CurrThread.Client.MDTM.FindDTMsRotated(DTM, Points, x1, y1, x2, y2,
|
|
|
|
sAngle, eAngle, aStep, aFound);
|
2009-12-01 18:41:43 -05:00
|
|
|
end; }
|
2009-10-05 23:40:44 -04:00
|
|
|
|
2009-10-03 18:11:30 -04:00
|
|
|
function ps_DTMFromString(DTMString: String): Integer;
|
2009-10-03 15:17:54 -04:00
|
|
|
var
|
|
|
|
dtm: pDTM;
|
|
|
|
begin
|
|
|
|
With CurrThread.Client.MDTM do
|
|
|
|
begin
|
|
|
|
dtm := StringToDTM(DTMString);
|
|
|
|
Result := AddpDTM(dtm);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure ps_FreeDTM(DTM: Integer);
|
|
|
|
begin
|
|
|
|
CurrThread.Client.MDTM.FreeDTM(DTM);
|
|
|
|
end;
|
2009-10-04 02:37:34 -04:00
|
|
|
|
2009-11-12 13:22:09 -05:00
|
|
|
function ps_GetDTM(index: Integer; out dtm: pDTM): Boolean;
|
2009-10-04 02:37:34 -04:00
|
|
|
begin
|
|
|
|
Result := CurrThread.Client.MDTM.GetDTM(index, dtm);
|
|
|
|
end;
|
|
|
|
|
|
|
|
function ps_AddDTM(d: TDTM): Integer;
|
|
|
|
begin
|
|
|
|
Result := CurrThread.Client.MDTM.AddDTM(d);
|
|
|
|
end;
|
|
|
|
|
|
|
|
function ps_AddpDTM(d: pDTM): Integer;
|
|
|
|
begin
|
|
|
|
Result := CurrThread.Client.MDTM.AddpDTM(d);
|
|
|
|
end;
|