Class: TArea

Declaration: Graphics.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MGraphic

Inherited By:

None.

Purpose:

TArea provides a wrapper for the TGArea geometry class, to which it adds the facilities inherited from MGraphic: an attribute bundle, matrix transformations, and hit detection. TArea has a, not is a, TGArea. The TGArea class defines an arbitrarily-shaped area by performing certain binary CAG (Constructive Area Geometry) operations to combine other area-defining geometries.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TArea::TArea

  1. TArea ()
  2. TArea (const TArea &)
  3. TArea (const TGArea &, TGrafBundle * adoptBundle =NIL)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.
  3. Creates a TArea from the specified TGArea with the specified attribute bundle.

Calling Context:

  1. Called by the stream-in operators.
  2. Called to copy an object.
  3. 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: TArea::~TArea

virtual ~ TArea ()

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: TArea::Draw

virtual void Draw (TGrafPort & port) const

Interface Category:

API.

Purpose:

Draws the TArea to the specific TGrafPort. Attributes in the area's bundle override those already provided in the port (if any).

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: TArea::TransformBy

virtual void TransformBy (const TGrafMatrix &)

Interface Category:

API.

Purpose:

Transforms the TArea's shape and position by applying the specified transformation matrix.

Calling Context:

Called by the Graphics system. You can also 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: TArea::ScaleBy

virtual void ScaleBy (const TGPoint &, const TGPoint & center =TGPoint :: kOrigin)

Interface Category:

API.

Purpose:

Changes the TArea's size according to the specified horizontal and vertical scalars (the coordinates of the first parameter). Because there are two independent scalars, the area's shape can change. The second parameter defines the center of scale. Every point is mapped to a new position by applying the scalars to the point's horizontal and vertical displacements from the center of scale. Thus, the scaled area does not stay centered at the same point unless the second argument is the old center of the 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: TArea::TranslateBy

virtual void TranslateBy (const TGPoint &)

Interface Category:

API.

Purpose:

Moves the TArea's position by the specified vector.

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: TArea::RotateBy

virtual void RotateBy (GDegrees, const TGPoint & center =TGPoint :: kOrigin)

Interface Category:

API.

Purpose:

Rotates the TArea by the given number of degrees, using the specified center of rotation. This does not change the size or shape of the area, only its orientation.

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: TArea::GetGeometricBounds

virtual TGRect GetGeometricBounds () const

Interface Category:

API.

Purpose:

Gets the bounding rectangle of the TArea's geometry, without considering any area added by its attribute bundle. (For example, the pen is a bundled attribute that can increase the area of the area by adding a border that extends beyond the bounds of the geometry.)

Calling Context:

Called during hit detection. You can also call this function directly.

Parameters:

Return Value:

Returns the bounding rectangle, which is the smallest axis-aligned rectangle that encloses the geometry.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TArea::GetLooseFitBounds

virtual TGRect GetLooseFitBounds (const TGrafPort* =NIL) const

Interface Category:

API.

Purpose:

Gets the entire TArea's bounding rectangle, taking into account the bundle information. (For example, the pen is a bundled attribute that can increase the area of the area by adding a border that extends beyond the bounds of the geometry.)

Calling Context:

Called during hit detection. You can also call this function directly.

Parameters:

Return Value:

Returns the bounding rectangle, which is the smallest axis-aligned rectangle that encloses the entire graphic, including any area added by the pen.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TArea::IsEmpty

virtual bool IsEmpty () const

Interface Category:

API.

Purpose:

Determines whether this TArea's geometry is empty (which it is when the area is created with the default constructor).

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the order of the curve is zero.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TArea::SetToEmpty

virtual void SetToEmpty ()

Interface Category:

API.

Purpose:

Resets this TArea to empty (that is, uninitialized).

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

virtual bool IsRectilinear () const

Interface Category:

API.

Purpose:

Determines whether all the line segments of this TArea are horizontal or vertical.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if all the line segments of this area are horizontal or vertical.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TArea::IsSingular

virtual bool IsSingular () const

Interface Category:

API.

Purpose:

Determines whether this TArea 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: TArea::GetArea

virtual const TGArea * GetArea () const

Interface Category:

API.

Purpose:

Returns a constant pointer to this TArea's encapsulated TGArea.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a constant pointer to the area's encapsulated area geometry.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TArea::operator=

TArea & operator =(const TArea & source)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

Returns a 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: TArea::operator==

bool operator ==(const TArea & source) const

Interface Category:

API.

Purpose:

Determines whether the two TAreas are equal by testing their respective geometries and attribute bundles.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if this area and the parameter have equal geometries and attribute bundles.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TArea::operator!=

bool operator != (const TArea &) const

Interface Category:

API.

Purpose:

Determines whether the two TAreas are not equal by testing their respective geometries and attribute bundles.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if the geometries or bundles of this area and the parameter are not equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TArea::operator>>=

virtual TStream & operator >>=(TStream &) 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: TArea::operator<<=

virtual TStream & operator <<= (TStream &)

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: TArea::Validate

void Validate ()

Interface Category:

API.

Purpose:

Makes sure that the graphic's bounds are up-to-date.

Calling Context:

Called by the Graphics system before returning bounds to the user. You should not need to call it directly.

Parameters:

Return Value:

None.

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.