Class: TGPolygon

Declaration: AreaGeometry.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TGPolyline

Inherited By:

None.

Purpose:

A TGPolygon is a collection of points connected with straight line segments. It is automatically closed: Do not specify the same point for the ending and starting points. TGPolygon is derived from TGPolyline. Unlike its base class, TGPolygon is an area-enclosing geometry that can be filled (as well as framed). A TGPolygon's straight line segments can cross each other. An example is the five-pointed star that you create by drawing five crisscrossed line segments without lifting your pencil. TGPolygons can be filled using one of two filling algorithms, as specified by the Boolean flag EOFill. true means an even-odd rule is used for determining what area is filled, and false means a nonzero winding rule is used. Consider the case of the five-pointed star that consists of five triangular areas at the points and a central pentagonal area formed by the intersections of the five line segments. The even-odd rule fills the triangles, while leaving the pentagon unfilled, but the nonzero winding rule fills the pentagon as well as the triangles.

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: TGPolygon::TGPolygon

  1. TGPolygon ()
  2. TGPolygon (const TGPolygon &)
  3. TGPolygon (unsigned long numPoints, bool EOFill =true)
  4. TGPolygon (const TGPointArray & pts, bool EOFill =true)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.
  3. Creates a polygon with the specified number of points and the specified fill rule.
  4. Creates a polygon with the specified points and the specified fill rule.

Calling Context:

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

virtual ~ TGPolygon ()

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: TGPolygon::GetEOFill

bool GetEOFill () const

Interface Category:

API.

Purpose:

Returns a Boolean specifying the filling algorithm.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the filling algorithm is the even-odd rule.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGPolygon::IsConvex

bool IsConvex () const

Interface Category:

API.

Purpose:

Tests whether the polygon is convex.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the polygon is convex.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGPolygon::SetEOFill

void SetEOFill (bool EOFill)

Interface Category:

API.

Purpose:

Sets the flag that specifies the filling algorithm.

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: TGPolygon::Intersects

bool Intersects (const TGRect & g) const

Interface Category:

API.

Purpose:

Tests whether the polygon intersects the given rectangle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the polygon intersects the given rectangle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGPolygon::Contains

bool Contains (const TGPoint & p) const

Interface Category:

API.

Purpose:

Tests whether the polygon contains the given point.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the polygon contains the given point.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGPolygon::operator>>=

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: TGPolygon::operator<<=

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: TGPolygon::operator=

TGPolygon & operator =(const TGPolygon & Src)

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: TGPolygon::operator==

bool operator ==(const TGPolygon & Src) 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 polygons are equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGPolygon::operator!=

bool operator != (const TGPolygon & Src) 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 polygons are not equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGPolygon::IsRectilinear

bool IsRectilinear () const

Interface Category:

API.

Purpose:

Tests whether the polygon is comprised completely of straight lines.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the polygon is comprised completely of straight lines.

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.