close Warning: Can't synchronize with repository "(default)" (No changeset 184 in the repository). Look in the Trac log for more information.

Changeset 169


Ignore:
Timestamp:
Nov 23, 2017, 10:21:49 AM (6 years ago)
Author:
chronos
Message:
  • Added: TPolygon default property for accessing points field.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UGeometry.pas

    r168 r169  
    3434
    3535  TPolygon = record
     36  private
     37    function GetPoint(const Index: Integer): TPoint; inline;
     38    procedure SetPoint(const Index: Integer; const AValue: TPoint); inline;
     39  public
    3640    Points: TPointArray;
    3741    function IsPointInside(const P: TPoint): Boolean;
     
    4246    procedure Clear;
    4347    procedure CutLine(const Vector: TLine; const PointInside: TPoint);
     48    property Items[Index: Integer]: TPoint read GetPoint write SetPoint; default;
    4449  end;
    4550
     
    236241
    237242{ TPolygon }
     243
     244function TPolygon.GetPoint(const Index: Integer): TPoint;
     245begin
     246  Result := Points[Index];
     247end;
     248
     249procedure TPolygon.SetPoint(const Index: Integer; const AValue: TPoint);
     250begin
     251  Points[Index] := AValue;
     252end;
    238253
    239254function TPolygon.IsPointInside(const P: TPoint): Boolean;
Note: See TracChangeset for help on using the changeset viewer.