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;
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 Canvas: TCanvas);
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[const Index: integer]: TPoint read GetPoint;
Public property Start: integer read FStart write FStart;

Description

Fields

Private FCanAdjustBounds: boolean;

FCanAdjustBounds: boolean; FCanAdjustBounds indicates whether or not the length of FPoints can be changed. If FCanAdjustBounds is set to False in AssignPoints.

Private FCount: integer;

FCount: integer; See Count.

Private FFirstSubLine: TLine;

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;

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;

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;

FPoints: TPointArray; See Points and AssignPoints.

Private FSecondSubLine: TLine;

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;

FStart: integer; See Start.

Private FUpdateBounds: boolean;

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).

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 Canvas: TCanvas);

Draw draws TLine on Canvas 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[const Index: 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.10.0 on 2006-10-31 09:56:46