Record TLQTRect

Hierarchy
Properties

Unit

Declaration

type TLQTRect = record

Description

TLQTRect describes an area in the QuadTree-World Details to the rectangles are described above. The TLQTRect could be used in two ways. One forming a world description, the other by forming a rectangle within the world. If defining a world, the sign of the axis are taken from the values Top vs Bottom or Left vs Right. To define a world map one would set Left = -180 and Right = 180 Top = 90 and Bottom = -90 This means that X increases while traveling from left to right and Y increases from top to bottom. This is different from the default definition (e.g. on TCanvas). A rectangle on the world could be defined by Left = -100 and Right = 100 Top = 45 and Bottom = -45

Overview

Fields

Public Left: Double;
Public Top: Double;
Public Right: Double;
Public Bottom: Double;

Methods

Public function Height: Double;
Public function Height(const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel) : Double;
Public function Width: Double;
Public function Width(const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel) : Double;
Public function Area(const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel) : Double;
Public procedure Clear;
Public function WorldXAxisLeftPlus: Boolean; inline;
Public function WorldYAxisUpPlus: Boolean; inline;
Public function IsPoint: Boolean;
Public function IsLine: Boolean;
Public function IsNotArea: Boolean;
Public function IsInfinite: Boolean;
Public function HasInfiniteXAxis: Boolean;
Public function HasInfiniteYAxis: Boolean;
Public function IsValidAsWorld: Boolean;
Public function IsEqual(ALQTRect : TLQTRect): Boolean;
Public function ContainsPoint(const ALQTPoint : TLQTPoint): Boolean; overload;
Public function ContainsPoint(const AX, AY : Double): Boolean; overload;
Public function ContainsPoint(const APoint : TLQTPoint; const AWorldRect : TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat) : Boolean; overload;
Public procedure NormateToWorld(const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat);
Public procedure Transform(const ASourceWorld, ATargetWorld : TLQTRect);
Public procedure Assign(const ALQTRect: TLQTRect);
Public procedure SetFrom(const ALeft, ATop, ARight, ABottom : Double);
Public procedure SetFromPoint(const APoint : TLQTPoint);
Public procedure SetFromPoint(const APoint : TLQTPoint; const AWorldRect: TLQTRect);
Public function TryExtentWith(const ALQTRect: TLQTRect) : Boolean; overload;
Public function TryExtentWith(const ALQTRect: TLQTRect; const ANormalizeWorld : TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat) : Boolean; overload;
Public function IsXWrappedAround(const AWorldRect: TLQTRect) : Boolean;
Public function IsYWrappedAround(const AWorldRect: TLQTRect) : Boolean;
Public function Union(const ALQTRect: TLQTRect; const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat) : Boolean;
Public function Union(const APoint : TLQTPoint) : Boolean;
Public function Union(const APoint : TLQTPoint;const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat) : Boolean;
Public function CoordsAsString(const AFormatString : String = '') : String;
Public class operator = (a,b : TLQTRect) : Boolean;
Public class operator + (a,b: TLQTRect): TLQTRect;

Description

Fields

Public Left: Double;
 
Public Top: Double;

or West border

Public Right: Double;

or North border

Public Bottom: Double;

or East border

Methods

Public function Height: Double;

function Height returns the absolute Value of Top-Bottom. Caution: Do not use this function if IsInfinite is true

Public function Height(const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel) : Double;

function Height returns the heigt of the rectangle in the given world and model. This overloaded function will treat wrap around rectangles

Public function Width: Double;

function Width returns the absolute Value of Left-Right. Caution: Do not use this function if IsInfinite is true

Public function Width(const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel) : Double;

function Width returns the width of the rectangle in the given world and model. This overloaded function will treat wrap around rectangles

Public function Area(const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel) : Double;

function Area returns the Width * Height of the rectangle in the given world and model. This overloaded function will treat wrap around rectangles

Public procedure Clear;

procedure Clear sets all fields to zero

Public function WorldXAxisLeftPlus: Boolean; inline;

function WorldXAxisLeftPlus returns true if the XAxis increases when traveling from Right to Left. Remark: This function treats the rectangle as been used as a world description.

Public function WorldYAxisUpPlus: Boolean; inline;

function WorldYAxisUpPlus returns true if the YAxis increases when traveling from Bottom to Top. Remark: This function treats the rectangle as been used as a world description.

Public function IsPoint: Boolean;

function IsPoint returns true if all coords are concentrated on one point, false if not. This means that all sides are equal, this includes non-zero value!

Public function IsLine: Boolean;

function IsLine returns true if either right and left or top and bottom has the same value.

Public function IsNotArea: Boolean;

function IsNotArea returns true if one of the functions IsPoint or IsLine would return true

Public function IsInfinite: Boolean;

function IfInfinite returns true if one of the Left, Top, Right or Bottom fields is Infinite or NegInfinite or bigger than LQTRectMaxValue oder smaller than LQTRectMinValue. The Limits are choosen to fit the height and width of a rectangle within the range of a Double-Value.

Public function HasInfiniteXAxis: Boolean;

function HasInfiniteXAxis returns true if the Left or Right fields is Infinite or NegInfinite or bigger than LQTRectMaxValue oder smaller than LQTRectMinValue. The Limits are choosen to fit the width of a rectangle within the range of a Double-Value.

Public function HasInfiniteYAxis: Boolean;

function HasInfiniteYAxis returns true if the Top or Bottom fields is Infinite or NegInfinite or bigger than LQTRectMaxValue oder smaller than LQTRectMinValue. The Limits are choosen to fit the height of a rectangle within the range of a Double-Value.

Public function IsValidAsWorld: Boolean;

function IsValidAsWorld validates, that the rectangle could be used as a world definition. The result is true if the rectangle forms an area and if one side is infinite the opposite side is negative infinite, rsp. vice versa

Public function IsEqual(ALQTRect : TLQTRect): Boolean;

function IsEqual returns true if all fields having the same values as there correspondend fields in the compared record. False is not

Public function ContainsPoint(const ALQTPoint : TLQTPoint): Boolean; overload;

function ContainsPoint returns true if the given point is located between Left and Right and Top and Bottom, including Left and Top, excluding Bottom and Right. APoint : The point to test Remark: The function works on all Axis signs.

Public function ContainsPoint(const AX, AY : Double): Boolean; overload;

function ContainsPoint returns true if the given point is located between Left and Right and Top and Bottom, including Left and Top, excluding Bottom and Right. Paramers: AX, AY the Coords of the point to test. Remark: The function works on all Axis signs.

Public function ContainsPoint(const APoint : TLQTPoint; const AWorldRect : TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat) : Boolean; overload;

function ContainsPoint returns true if the given point is located between Left and Right and Top and Bottom, including Left and Top, excluding Bottom and Right. APoint : The point to test AWorldRect : The rectangle that describes the world size AWorldModel : The world model Return: True if the point is located inside the rectangle.

Public procedure NormateToWorld(const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat);

procedure NormateToWorld will force the rectangle to be valid in the given World. Parameters AWorldRect: The rectangle which describes the extensions of the world. AWorldModel : The world model (flat, cylindrical or toroidal) to be used. Default: flat Remarks The passed world must be valid. The signs of the axes of the world are used. The Right and Bottom values of the rectangle equal to the correspondent of the world, are treated as valid in the meaning, that a rectangle may have the same size as the world. But if the values are bigger than this assumption is not longer used! Caution: if AWorldRect is not valid, an exception is thrown.

Public procedure Transform(const ASourceWorld, ATargetWorld : TLQTRect);

procedure Transform modifys the coords, so that the rectangle is located on the same position in the target world

Public procedure Assign(const ALQTRect: TLQTRect);

procedure Assign copies the rectangle values from the source rectangle

Public procedure SetFrom(const ALeft, ATop, ARight, ABottom : Double);

method SetFrom sets all values of the record from the source values

Public procedure SetFromPoint(const APoint : TLQTPoint);

SetFromPoint sets Left,Right,Top and Bottom, so that the Point meets the critera to be inside the rectangle using the ContainsPoint functions Caution: The rectangle is set using default X- and Y-Axis-Signs (Left < Right, Top < Bottom

Public procedure SetFromPoint(const APoint : TLQTPoint; const AWorldRect: TLQTRect);

SetFromPoint sets Left,Right,Top and Bottom, so that the Point meets the critera to be inside the rectangle using the ContainsPoint functions The Axis signs are taken from the passed World rectangle

Public function TryExtentWith(const ALQTRect: TLQTRect) : Boolean; overload;

function TryExtentWith checks if the passed rectangle and this can be combined. If so, one Field is updated. Parameters: ALQTRect the retectangle who has to be checked and combined Result: True if one Field has been updated, false if not. Remarks: A rectangle could be merged if one side of the rectangle is identical to the opposite side of the other rectangle. So if both rectangle have the same height and the Right field of one and the Left field of the other are equal than the rectangle will be enlarged and the result is true.

Public function TryExtentWith(const ALQTRect: TLQTRect; const ANormalizeWorld : TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat) : Boolean; overload;

function TryExtentWith same as before, but able to detect matching rectangles on the other end of the world. Parameters: ALQTRect the retectangle who has to be checked and combined. ANormalizeWorld a rectangle which describes the world borders. AWorldModel a description of the world model. If flat the function behaves like the function above. Result: True if one Field has been updated, false if not.

Public function IsXWrappedAround(const AWorldRect: TLQTRect) : Boolean;

function IsXWrappedAround returns True if Left and Right position of this rectangle are exchanged

Public function IsYWrappedAround(const AWorldRect: TLQTRect) : Boolean;

function IsXWrappedAround returns True if Top and Bottom position of this rectangle are exchanged

Public function Union(const ALQTRect: TLQTRect; const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat) : Boolean;

function Union combines two rectangles. This rectangle will updated Parameter ALQTRect the rectangle that should united with this rectangle AWorldRectangle the rectangle which describes the world AWorldModel the WorldModel we are in (flat, cylindrical or toroidal)

Public function Union(const APoint : TLQTPoint) : Boolean;

function Union extent the rectangle to the given point. Caution: The rectangle is set using default X- and Y-Axis-Signs (Left < Right, Top < Bottom

Public function Union(const APoint : TLQTPoint;const AWorldRect: TLQTRect; const AWorldModel : TLQTWorldModel = lqtwmFlat) : Boolean;
 
Public function CoordsAsString(const AFormatString : String = '') : String;

function CoordsAsString returns the coordinates of the rectangle in one String Parameter: AFormatString if not empty it must contain a valid FormatString. There will be 4 parametes passed to the format function Left,Top,Right,Bottom (in this order). Example: CoordsAsString('L %1.2f, T %1.2f, R %1.2f, B %1.2f');

Public class operator = (a,b : TLQTRect) : Boolean;

class operator = overwrites the equal operator to ease the usage of comparing two rectangles

Public class operator + (a,b: TLQTRect): TLQTRect;

class operator + (Union) will combine two rectangles by there max extents The result left and top will be the smallest value of the two rectangles, while result right and bottom will be the highest value of the two rectangles. The function will only work on a flat and native world


Generated by PasDoc 0.16.0.