Class: TGArea

Declaration: AreaGeometry.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

The TGArea class is a device-independent specification of an arbitrarily-shaped area. A TGArea object is defined as an object that performs certain binary CAG (Constructive Area Geometry) operations on other area-defining geometries, such as TGRect, TGEllipse, and TGPolygon. The CAG operations are Add (union), Subtract, Intersection, and Exclusive OR. For instance, a TGArea can be made up of the area of a rectangle minus the area of an ellipse. Thus, the TGArea is a conglomeration of one or more area-enclosing geometries. The TGArea provides constructors for creating an area from a given shape (such as a TGRect, TGPolygon, or TGGlyphRun) and can be transformed by a TGrafMatrix. The class also provides operators and other member functions for the CAG operations.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive from this class.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TGArea::TGArea

  1. TGArea ()
  2. TGArea (const TGRect & g)
  3. TGArea (const TGEllipse & g)
  4. TGArea (const TGPolygon & g)
  5. TGArea (const TGLoop & g)
  6. TGArea (const TGGlyphRun & g)
  7. TGArea (const TGArea & g)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Creates an area geometry from the specified rectangle.
  3. Creates an area geometry from the specified ellipse.
  4. Creates an area geometry from the specified polygon.
  5. Creates an area geometry from the specified loop geometry.
  6. Creates an area geometry from the specified glyph run.
  7. Copy constructor.

Calling Context:

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

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::~TGArea

virtual ~ TGArea ()

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:

None.

Member Function: TGArea::GetEmptyArea

static const TGArea & GetEmptyArea ()

Interface Category:

API.

Purpose:

Creates a new area geometry that has no area.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the new, empty area geometry.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::GetInfiniteArea

static const TGArea & GetInfiniteArea ()

Interface Category:

API.

Purpose:

Creates a new area geometry that is infinitely large.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the new, infinitely large area geometry.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::TransformBy

void TransformBy (const TGrafMatrix &)

Interface Category:

API.

Purpose:

Transforms the entire area using the specified matrix.

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: TGArea::IsEmpty

bool IsEmpty () const

Interface Category:

API.

Purpose:

Tests whether this area contains any geometries.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if this area contains no basic geometries.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::SetToEmpty

void SetToEmpty ()

Interface Category:

API.

Purpose:

Removes all basic geometries from this area.

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: TGArea::IsRectilinear

bool IsRectilinear () const

Interface Category:

API.

Purpose:

Tests whether the area is comprised completely of horizontal and vertical edges.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the area is comprised completely of horizontal and vertical edges.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::IsRectangular

bool IsRectangular () const

Interface Category:

API.

Purpose:

Tests whether the area is rectangular in shape.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the area is rectangular in shape.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::IsSingular

bool IsSingular () const

Interface Category:

API.

Purpose:

Tests whether the area is comprised of a single basic geometry.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the area is comprised of a single basic geometry.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::GetBounds

TGRect GetBounds () const

Interface Category:

API.

Purpose:

Returns the rectangle that completely encloses the area.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the bounding rectangle for the area.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::Intersects

bool Intersects (const TGRect &) const

Interface Category:

API.

Purpose:

Tests whether the area geometry intersects the given rectangle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the area geometry intersects the given rectangle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::Contains

  1. bool Contains (const TGPoint &) const
  2. bool Contains (const TGRect &) const

Interface Category:

API.

Purpose:

  1. Tests whether the area geometry contains the given point.
  2. Tests whether the area geometry contains the given rectangle.

Calling Context:

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

Parameters:

Return Value:

Returns true if either the point or the rectangle lies completely within the area geometry.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::Add

void Add (const TGArea &)

Interface Category:

API.

Purpose:

Adds the shape of the specified TGArea to the current shape. Addition is achieved through union.

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 provides the same functionality as operator +=.

Member Function: TGArea::operator+=

TGArea & operator += (const TGArea &)

Interface Category:

API.

Purpose:

Adds the shape of the TGArea on the right side of the operator += to this one. Addition is achieved through union.

Calling Context:

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

Parameters:

Return Value:

A const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function provides the same functionality as TGArea::Add. This function is declared inline.

Member Function: TGArea::Subtract

void Subtract (const TGArea &)

Interface Category:

API.

Purpose:

Subtracts the shape of the specified TGArea from the current shape.

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 provides the same functionality as operator -=.

Member Function: TGArea::operator-=

TGArea & operator -=(const TGArea &)

Interface Category:

API.

Purpose:

Subtracts the shape of the specified TGArea from the current shape.

Calling Context:

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

Parameters:

Return Value:

A const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function provides the same functionality as TGArea::Subtract. This function is declared inline.

Member Function: TGArea::Intersect

void Intersect (const TGArea &)

Interface Category:

API.

Purpose:

Sets the shape to the intersection of the current shape with the specified TGArea's shape.

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 provides the same functionality as operator *=.

Member Function: TGArea::operator*=

TGArea & operator *= (const TGArea &)

Interface Category:

API.

Purpose:

Intersects the current shape with the specified TGArea's shape.

Calling Context:

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

Parameters:

Return Value:

A const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function provides the same functionality as TGArea::Intersect. This function is declared inline.

Member Function: TGArea::ExclusiveOr

void ExclusiveOr (const TGArea &)

Interface Category:

API.

Purpose:

Sets the shape to the combined area of the current shape and the specified TGArea's shape, minus their intersection.

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 provides the same functionality as operator ^=.

Member Function: TGArea::operator^=

TGArea & operator ^= (const TGArea &)

Interface Category:

API.

Purpose:

Sets the shape to the combined area of the current shape and the specified TGArea's shape, minus their intersection.

Calling Context:

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

Parameters:

Return Value:

A const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function provides the same functionality as TGArea::ExclusiveOr. This function is declared inline.

Member Function: TGArea::operator=

TGArea & operator =(const TGArea &)

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:

None.

Member Function: TGArea::operator==

bool operator ==(const TGArea &) const

Interface Category:

API.

Purpose:

Tests whether the two objects are equal.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if the two area geometries are equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::operator!=

bool operator != (const TGArea &) const

Interface Category:

API.

Purpose:

Tests whether the two objects are equal.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if the two area geometries are not equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGArea::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: TGArea::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: TGArea::GetTimeStamp

TPseudoTimeStamp GetTimeStamp () const

Interface Category:

API.

Purpose:

Returns the object's time stamp. Time stamps are a quick and efficient way to determine whether two TGArea objects are equal. If the time stamps of the two objects are equal, then the objects are equal. However, if the time stamps are not equal, the objects might or might not be equal. A TGArea derived class must maintain the value of its time stamp. If any part of the object's visible value changes, then it updates its time stamp by calling UpdateTimeStamp. A special case: if the object is in the default state (as defined by the derived class), its time stamp is zero.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the object's time stamp.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.