Class TLine

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TLine = class(TObject)

Description

TLine is used to select objects on the screen by drawing a "lasso" around them. See TLassoTool.

Hierarchy

Overview

Fields

Private FCanAdjustBounds: boolean;
Private FCount: integer;
Private FFirstSubLine: TLine;
Private FMaxP: TPoint;
Private FMinP: TPoint;
Private FPoints: TPointArray;
Private FSecondSubLine: TLine;
Private FStart: integer;
Private FUpdateBounds: boolean;

Methods

Private procedure CreateSubLines;
Private function GetPoint(const Index: integer): TPoint;
Private function GetIntersection(const ALine: TLine): TIntersectResult;
Private function InsideBox(const X, Y: integer): boolean;
Private procedure SetBounds;
Private procedure CopyPoints(const Value: TPointArray);
Public procedure AddPoint(const APoint: TPoint);
Public procedure AssignPoints(const Value: TPointArray);
Public constructor Create(const Capacity: integer);
Public destructor Destroy; override;
Public procedure Draw(const BitMap: TBitmap32);
Public function Inside(const X, Y: integer): boolean; overload;
Public function Inside(const APoint: TPoint): boolean; overload;
Public function Intersect(const ALine: TLine): boolean;
Public procedure Invalidate;
Public procedure SetBox(const Corner1, Corner2: TPoint);

Properties

Public property Count: integer read FCount write FCount;
Public property Points[constIndex:integer]: TPoint read GetPoint;
Public property Start: integer read FStart write FStart;

Description

Fields

Private FCanAdjustBounds: boolean;

FCanAdjustBounds indicates whether or not the length of FPoints can be changed. FCanAdjustBounds is set to False in AssignPoints and CopyPoints. It is used to prevent sublines (FFirstSubLine and FSecondSubLine) from adding points.

Private FCount: integer;

See Count.

Private FFirstSubLine: TLine;

FFirstSubLine is used to handle the first half of the points in its parent TLine. Its last point is shared with FSecondSubLine.

Private FMaxP: TPoint;

The coordinates of FMaxP are equal to the highest X and Y coordinates of any of the TPoints in Points between Start and Start+Count-1.

Private FMinP: TPoint;

The coordinates of FMinP are equal to the lowest X and Y coordinates of any of the TPoints in Points between Start and Start+Count-1.

Private FPoints: TPointArray;

See Points and AssignPoints.

Private FSecondSubLine: TLine;

FSecondSubLine is used to handle the second half of the points in its parent TLine. Its first point is shared with FFirstSubLine.

Private FStart: integer;

See Start.

Private FUpdateBounds: boolean;

FUpdateBounds indicates whether FMaxP and FMinP are up-to-date.

Methods

Private procedure CreateSubLines;

CreateSubLines creates FFirstSubLine and FSecondSubLine and half of its points to each of them. They will share one point.

Private function GetPoint(const Index: integer): TPoint;

See Points.

Private function GetIntersection(const ALine: TLine): TIntersectResult;

GetIntersection computes how ALine and the current line intersect. both ALine and the current line must have a Count of 2.

Private function InsideBox(const X, Y: integer): boolean;

InsideBox returns true if the point (X,Y) is inside the box defined by (FMinP, FMaxP).

Private procedure SetBounds;

SetBounds sets FMinP and (FMaxP).

Private procedure CopyPoints(const Value: TPointArray);
 
Public procedure AddPoint(const APoint: TPoint);

AddPoint adds a new point to the end of TLine

Public procedure AssignPoints(const Value: TPointArray);

AssignPoints copies Value. AddPoint can not be called after AssignPoints.

Public constructor Create(const Capacity: integer);

Create creates a new instance of TLine. If capacity is set greater than 0, Points is allocated

Public destructor Destroy; override;

Destroy destroys the current instance of TLine. Do not call Destroy directly. Call Free instead.

Public procedure Draw(const BitMap: TBitmap32);

Draw draws TLine on BitMap as a polygon.

Public function Inside(const X, Y: integer): boolean; overload;

Inside returns true if the point (X,Y) is inside the polygon defined by TLine.

Public function Inside(const APoint: TPoint): boolean; overload;

Inside returns true if the point APoint is inside the polygon defined by TLine.

Public function Intersect(const ALine: TLine): boolean;

Intersect returns True if ALine intersects TLine.

Public procedure Invalidate;

Call Invalidate to indicate that the TLine has changed.

Public procedure SetBox(const Corner1, Corner2: TPoint);

SetBox sets FMinP and (FMaxP) to the box defined by Corner1 and Corner2. The order of Corner1 and Corner2 doesn't matter.

Properties

Public property Count: integer read FCount write FCount;

Count is the number of locations in Points that is used by this TLine.

Public property Points[constIndex:integer]: TPoint read GetPoint;

property Points: TPointArray read FPoints write SetPoints;

Public property Start: integer read FStart write FStart;

Start is the index of the first location in Points that is used by this TLine.


Generated by PasDoc 0.12.1 on 2013-05-13 15:42:03