Class: TEllipse

Declaration: Graphics.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MGraphic

Inherited By:

None.

Purpose:

TEllipse provides a wrapper for the TGEllipse geometry class, to which it adds the facilities inherited from MGraphic: an attribute bundle, matrix transformations, and hit detection. TEllipse has a, not is a, TGEllipse. A TGEllipse is a vertically or horizontally oriented ellipse. Unlike the other MGraphic derived classes that encapsulate a corresponding geometry class, TEllipse has a TGrafMatrix that is used to concatenate all transformations. Every time you invoke a member function that alters the ellipse--ScaleBy, TranslateBy, RotateBy, or TransformBy--the alteration is concatenated to the TGrafMatrix instead of altering the data of the geometry itself (the TGEllipse). (This feature arises from the observation that ellipses are not closed for arbitrary transforms.) TEllipse::GetSize and TEllipse::GetCenter return the data associated with the original, untransformed geometry. To determine the actual size and center, use the TEllipse's transformation matrix to transform the returned data. You obtain this matrix by calling GetMatrix.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TEllipse::TEllipse

  1. TEllipse (const TEllipse &)
  2. TEllipse (const TGEllipse &, TGrafBundle * adoptBundle =NIL)
  3. TEllipse (const TGRect & r)
  4. TEllipse (const TGPoint & center, GCoordinate radius)
  5. TEllipse (const TGPoint & center, GCoordinate Xradius, GCoordinate Yradius)
  6. TEllipse ()

Interface Category:

API.

Purpose:

  1. Copy constructor.
  2. Creates a TEllipse with the specified TGrafBundle.
  3. Creates a TEllipse that fits within the specified rectangle. If the rectangle is a square, the ellipse is a circle.
  4. Creates an TEllipse with a uniform radius (thus, the ellipse is a circle) whose center is at the specified location.
  5. Creates an TEllipse with the specified horizontal and vertical radii, and whose center is at the specified location.
  6. Default constructor.

Calling Context:

  1. Called to copy an object.
  2. Call this function directly.
  3. Call this function directly.
  4. Call this function directly.
  5. Call this function directly.
  6. Called by the stream-in operators. 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: TEllipse::~TEllipse

virtual ~ TEllipse ()

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: TEllipse::GetSize

virtual TGPoint GetSize () const

Interface Category:

API.

Purpose:

Gets this TEllipse's height and width. If the height and width are the same, the ellipse is a circle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a TGPoint whose x-coordinate contains the ellipse's width and whose y-coordinate contains the ellipse's height.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEllipse::GetCenter

virtual TGPoint GetCenter () const

Interface Category:

API.

Purpose:

Gets the center point of this TEllipse.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a TGPoint whose coordinates are the center of this ellipse.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEllipse::GetMatrix

virtual const TGrafMatrix * GetMatrix () const

Interface Category:

API.

Purpose:

Returns this TEllipse's TGrafMatrix.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the object's graphic transformation matrix.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEllipse::Draw

virtual void Draw (TGrafPort & port) const

Interface Category:

API.

Purpose:

Draws the TEllipse to the specific TGrafPort. Attributes in the ellipse'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: TEllipse::GetLooseFitBounds

virtual TGRect GetLooseFitBounds (const TGrafPort* =NIL) const

Interface Category:

API.

Purpose:

Gets the entire TEllipse's bounding rectangle, taking into account the bundle information. (For example, the pen is a bundled attribute that can increase the area of the graphic 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: TEllipse::GetGeometricBounds

virtual TGRect GetGeometricBounds () const

Interface Category:

API.

Purpose:

Gets the bounding rectangle of this TEllipse's geometry, without considering any area added by the bundle. (For example, the pen is a bundled attribute that can increase the area of the graphic 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 this ellipse's geometry.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEllipse::TransformBy

virtual void TransformBy (const TGrafMatrix &)

Interface Category:

API.

Purpose:

Transforms the TEllipse'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: TEllipse::ScaleBy

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

Interface Category:

API.

Purpose:

Changes the TEllipse's size according to the specified horizontal and vertical scalars (the coordinates of the first parameter). Because there are two independent scalars, the ellipse'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 ellipse does not stay centered at the same point unless the second parameter is the old center of the ellipse.

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: TEllipse::TranslateBy

virtual void TranslateBy (const TGPoint &)

Interface Category:

API.

Purpose:

Moves the TEllipse'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: TEllipse::RotateBy

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

Interface Category:

API.

Purpose:

Rotates the TEllipse by the given number of degrees, using the specified center of rotation. This does not change the size or shape of the ellipse, 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: TEllipse::operator=

TEllipse & operator =(const TEllipse & 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: TEllipse::operator==

bool operator ==(const TEllipse & source) const

Interface Category:

API.

Purpose:

Tests two TEllipses for equality, by determining whether their respective geometries and bundles are equal.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

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

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEllipse::operator!=

bool operator != (const TEllipse & source) const

Interface Category:

API.

Purpose:

Tests two TEllipses for inequality, by determining whether their geometries and bundles are different.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

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

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TEllipse::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: TEllipse::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: TEllipse::Validate

void Validate ()

Interface Category:

API.

Purpose:

Makes sure that the TEllipse'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.