Class: TLongRect

Declaration: LongRect.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

TLongRect represents discrete coordinate-aligned rectangles. TLongRect is used to specify bounds of a discrete area, such as the size of an array of pixels. TLongRect rectangles are defined with four long integers: fLeft, fTop, fRight, and fBottom, all of which are declared public. TLongRects are defined over a half-open interval, so a point is considered to be contained in the rectangle if it falls within fLeft <= X < fRight and fTop <= Y < fBottom.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive from TLongRect: All its data is public and the destructor is not virtual.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TLongRect::TLongRect

  1. TLongRect ()
  2. TLongRect (const TGPoint & p0, const TGPoint & p1)
  3. TLongRect (long left, long top, long right, long bottom)
  4. TLongRect (const TLongRect &)
  5. TLongRect (const TGRect &)

Interface Category:

API.

Purpose:

  1. Default constructor. Does not initialize data members.
  2. Creates a TLongRect and initializes it from the two specified points. fLeft gets the smallest x component in the two points; fRight gets the largest. fTop gets the smallest y component in the two points; fBottom gets the largest.
  3. Creates a TLongRect and initializes it from the four specified coordinates.
  4. Copy constructor.
  5. Creates a TLongRect and initializes it from the specified TGRect.

Calling Context:

  1. Called by the stream-in operators.
  2. Call this function directly.
  3. Call this function directly.
  4. Called to copy an object.
  5. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

  1. This function is defined inline.
  2. This function is defined inline.
  3. This function is defined inline.

  4. Member Function: TLongRect::~TLongRect

    ~ TLongRect ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is defined inline.

Member Function: TLongRect::IsEmpty

bool IsEmpty () const

Interface Category:

API.

Purpose:

Determines if the TLongRect is empty. The rectangle is considered empty if the right edge is less than the left edge and the bottom edge is less than the top edge.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if (fLeft >=fRight) ||(fTop >=fBottom). Returns false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is defined inline.

Member Function: TLongRect::GetWidth

unsigned long GetWidth () const

Interface Category:

API.

Purpose:

Computes the width of this rectangle using fRight -fLeft.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the width of the rectangle as an unsigned long integer.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is defined inline.

Member Function: TLongRect::GetHeight

unsigned long GetHeight () const

Interface Category:

API.

Purpose:

Computes the height of this rectangle using fBottom -fTop.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the height of the rectangle as an unsigned long integer.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is defined inline.

Member Function: TLongRect::EqualSize

bool EqualSize (const TLongRect & g) const

Interface Category:

API.

Purpose:

Determines whether this rectangle has the same height and width as the specified rectangle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if this rectangle has the same height and width as the specified rectangle. Returns false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::SetToPoint

void SetToPoint (long x, long y)

Interface Category:

API.

Purpose:

Sets the rectangle to equal a single point. fLeft and fRight get the specified x-coordinate. fBottom and fTop get the specified y-coordinate.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::ExtendTo

  1. void ExtendTo (const TLongRect & g)
  2. void ExtendTo (long x, long y)

Interface Category:

API.

Purpose:

  1. Individually extends this rectangle's coordinates to the corresponding coordinate in the specified rectangle. The change to any coordinate does not occur if the result does not extend the bounds of the current rectangle.
  2. Individually extends this rectangle's coordinates to the corresponding x or y parameter. fLeft and fRight are extended to the x parameter and fBottom and fTop are extended to the y parameter. The change to any coordinate does not occur if the result does not extend the bounds of the current rectangle.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::IntersectWith

void IntersectWith (const TLongRect & g)

Interface Category:

API.

Purpose:

Forces the current rectangle to intersect the specified rectangle. If fLeft (fTop) is less than fLeft (fTop) of the specified rectangle, then fLeft (fTop) is adjusted to equal fLeft (fTop) of the specified rectangle. If fRight (fBottom) is greater than fRight (fBottom) of the specified rectangle, then fRight (fBottom) is adjusted to equal fRight (fBottom) of the specified rectangle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::Offset

void Offset (long dx, long dy)

Interface Category:

API.

Purpose:

Translates this rectangle by the specified delta x and delta y values. The width and the height of the rectangle remain the same.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::Inset

void Inset (long dx, long dy)

Interface Category:

API.

Purpose:

Adjusts the horizontal edges in opposite directions by the specified delta x value and adjusts the vertical edges in opposite directions by the specified delta y value. If delta x (or delta y) is positive, the horizontal (or vertical) edges are moved together; if delta x (or delta y) is negative, the horizontal (or vertical) edges are moved apart.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::OrderPoints

void OrderPoints ()

Interface Category:

API.

Purpose:

Forces (fTop, fLeft) to be less than (fBottom, fRight).

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::Intersects

bool Intersects (const TLongRect & g) const

Interface Category:

API.

Purpose:

Tests whether this rectangle intersects the specified rectangle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if this rectangle intersects the specified rectangle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is defined inline.

Member Function: TLongRect::Contains

  1. bool Contains (const TLongRect & g) const
  2. bool Contains (long x, long y) const

Interface Category:

API.

Purpose:

  1. Tests whether the specified rectangle lies within this rectangle.
  2. Tests whether the specified point lies within this rectangle.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

Returns true if the specified rectangle (or point) lies within this rectangle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::operator>>=

TStream & operator >>=(TStream & towhere) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::operator<<=

TStream & operator <<= (TStream & fromwhere)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::operator=

TLongRect & operator =(const TLongRect & a)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function by using the operator in an assignment statement.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is defined inline.

Member Function: TLongRect::operator==

bool operator ==(const TLongRect & a) const

Interface Category:

API.

Purpose:

Tests whether two objects are equal.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if the two objects are equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::operator!=

bool operator != (const TLongRect & a) const

Interface Category:

API.

Purpose:

Tests whether two objects are equal.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if the two objects are not equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLongRect::Set

void Set (long left, long top, long right, long bottom)

Interface Category:

API.

Purpose:

Sets the horizontal and vertical edges to the specified values.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is defined inline.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.