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.
- TGPolygon ()
- TGPolygon (const TGPolygon &)
- TGPolygon (unsigned long numPoints, bool EOFill =true)
- TGPolygon (const TGPointArray & pts, bool EOFill =true)
Interface Category:
API.
Purpose:
- Default constructor.
- Copy constructor.
- Creates a polygon with the specified number of points and the specified fill rule.
- Creates a polygon with the specified points and the specified fill rule.
Calling Context:
- Called by the stream-in operators.
- Called to copy an object.
- Call this function directly.
- Call this function directly.
Parameters:
- Takes no parameters.
- const TGPolygon & -The polygon to be copied.
- unsigned long numPoints -The number of points in the polygon.
- bool EOFill =true -The flag indicating whether to use the even-odd rule or the nonzero winding number rule when filling the shape. The default is true--even-odd fill rule.
- const TGPointArray & pts -The array of points that make up the polygon.
- bool EOFill =true -The flag indicating whether to use the even-odd rule or the nonzero winding number rule when filling the shape. The default is true--even-odd fill rule.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- bool EOFill -The flag indicating the filling algorithm. Use true for the even-odd rule or false for the nonzero window number rule.
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:
- const TGRect & rect -The rectangle to test for intersection.
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:
- const TGPoint & point -The point to test for within the polygon.
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:
- TStream & -The stream to which the object streams itself out.
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:
- TStream & -The stream from which the object streams itself in.
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:
- const TGPolygon & Src -The polygon to be copied.
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:
- const TGPolygon & Src -The polygon to be compared to this one.
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:
- const TGPolygon & Src -The polygon to be compared to this one.
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.