| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- {========================================================================}
- {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
- {========================================================================}
- {= All Rights Reserved =}
- {========================================================================}
- {= D 01099 Dresden = Tel.: +0351-8012255 =}
- {= Loewenstr.7a = info@swiftsoft.de =}
- {========================================================================}
- {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
- {========================================================================}
- {= This code is for reference purposes only and may not be copied or =}
- {= distributed in any format electronic or otherwise except one copy =}
- {= for backup purposes. =}
- {= =}
- {= No Delphi Component Kit or Component individually or in a collection=}
- {= subclassed or otherwise from the code in this unit, or associated =}
- {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
- {= without express permission from SwiftSoft. =}
- {= =}
- {= For more licence informations please refer to the associated =}
- {= HelpFile. =}
- {========================================================================}
- {= $Date: 20.01.1998 - 18:00:00 $ =}
- {========================================================================}
- unit MMPtList;
- {$I COMPILER.INC}
- interface
- uses
- {$IFDEF WIN32}
- Windows,
- {$ELSE}
- WinProcs,
- WinTypes,
- {$ENDIF}
- SysUtils,
- Classes,
- MMObj,
- MMMuldiv,
- MMUtils;
- type
- PMMPoint = ^TMMPoint;
- TMMPoint = record
- X: Longint;
- Y: Longint;
- end;
- const
- { Maximum List size }
- MaxListSize = Maxint div (sizeOf(TMMPoint)*sizeOf(TMMPoint));
- type
- PMMPointArray = ^TMMPointArray;
- TMMPointArray = array[0..MaxListSize-1] of TMMPoint;
- TMMPointList = class(TMMObject)
- public
- constructor Create; virtual;
- destructor Destroy; override;
- procedure Clear; virtual;
- procedure Assign(Source: TPersistent);
- function Add(Point: TMMPoint): Integer;
- procedure Insert(Index: Integer; Point: TMMPoint);
- procedure Exchange(Index1, Index2: Integer);
- procedure Move(CurIndex, NewIndex: Integer);
- function Remove(Point: PMMPoint): Integer;
- procedure Delete(Index: Integer);
- function IndexOf(Point: PMMPoint): Integer;
- function LocatePointX(X: Longint): integer;
- function LocatePointY(Y: Longint): integer;
- function CalcX(Y: Longint): Longint;
- function CalcY(X: Longint): Longint;
- procedure SortByX;
- procedure SortByY;
- function First: PMMPoint;
- function Last: PMMPoint;
- function Expand: TMMPointList;
- property Capacity: Integer read FCapacity write SetCapacity;
- property Count: Integer read FCount write SetCount;
- property Points[Index: Integer]: PMMPoint read Get write Put; default;
- property List: PMMPointArray read FList;
- end;
- function ComparePoints(Point1,Point2: PMMPoint): Boolean;
- function LocateX(Points: PMMPointArray; NumPoints: integer; X: Longint): integer;
- function LocateY(Points: PMMPointArray; NumPoints: integer; Y: Longint): integer;
- procedure SortX(Points: PMMPointArray; NumPoints: integer);
- procedure SortY(Points: PMMPointArray; NumPoints: integer);
- implementation
|