Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
None.
Inherited By:
TGPolygon
Purpose:
A polyline is a collection of points that are connected with straight line segments. The line segments form a single path through all the points, so each point, except the first and last, is connected to two other points. A polyline is not explicitly closed. For a closed polyline, use the TPolygon class instead, because attempting to close a polyline can result in an imperfect closure.
Polylines are parameterized much like linear curves. The points are numbered with successive integers, starting with 0. The integer part of a parameter specifies one of these points, and the fractional part determines a location on the subsequent line segment. For example, a polyline with three points is parameterized from 0 to 2, and a parameter value of 1.75 refers to a location on the second line segment, three-quarters of the way from point 1 to point 2.
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.
- TGPolyline ()
- TGPolyline (unsigned long numPoints)
- TGPolyline (const TGPointArray & points)
- TGPolyline (const TGPolyline &)
Interface Category:
API.
Purpose:
- Default constructor.
- Creates a TGPolyline with the specified number of control points. All the points are initialized to TGPoint::kOrigin.
- Creates a TGPolyline with the points copied from the TGPointArray.
- Copy constructor.
Calling Context:
- Called by the stream-in operators. You can also call this function directly.
- Call this function directly.
- Call this function directly.
- Called to copy an object.
Parameters:
- Takes no parameters.
- unsigned long numPoints -The number of control points.
- const TGPointArray & points -The array of control points.
- const TGPolyline & -The polyline to be copied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TGPolyline ()
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: TGPolyline::GetNumberOfPoints
unsigned long GetNumberOfPoints () const
Interface Category:
API.
Purpose:
Returns the number of control points in the TGPolyline.
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: TGPolyline::GetPoint
TGPoint GetPoint (unsigned long index) const
Interface Category:
API.
Purpose:
Returns the control point at the specified index.
Calling Context:
Call this function directly.
Parameters:
- unsigned long index -The index (whose value must be less than the number of control points).
Return Value:
Returns the point at the specified index.
Exceptions:
Calls a parameter assertion that fails if the index is out of range.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::GetPoints
void GetPoints (TGPointArray & pts) const
Interface Category:
API.
Purpose:
Copies the TGPolyline's control points into the argument.
Calling Context:
Call this function directly.
Parameters:
- TGPointArray & pts -The point array that the polyline's control points are copied into.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::Evaluate
TGPoint Evaluate (GParametric u) const
Interface Category:
API.
Purpose:
Return a point at the given parametric distance along the polyline. Polylines are parameterized as one integer unit for every point, for example, the parameter from 0..1 goes between the first and second points, 1..2 between the second and third, and so on.
Calling Context:
Call this function directly.
Parameters:
- GParametric u -The parametric value.
Return Value:
Returns a point.
Exceptions:
Calls a parameter assertion that fails if the specified parametric is negative or greater than the number of control points.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::IsRectilinear
bool IsRectilinear () const
Interface Category:
API.
Purpose:
Determines whether all the line segments of the TGPolyline are horizontal or vertical.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns true if all the line segments of the polyline are horizontal or vertical.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::SetPoints
void SetPoints (const TGPointArray & newPoints)
Interface Category:
API.
Purpose:
Resets the TGPolyline's control points. The number of points can be changed.
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: TGPolyline::SetPoint
void SetPoint (unsigned long index, const TGPoint & p)
Interface Category:
API.
Purpose:
Resets the control point at the specified index to the TGPoint.
Calling Context:
Call this function directly.
Parameters:
- unsigned long index -The index (whose value must be less than the number of control points).
- const TGPoint & p -The new control point.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::AddBefore
void AddBefore (unsigned long index, const TGPoint & tobeadded)
Interface Category:
API.
Purpose:
Inserts the specified TGPoint before the control point at the specified index. The size of the TGPolyline increases by one.
Calling Context:
Call this function directly.
Parameters:
- unsigned long index -The index (whose value must be less than the number of control points).
- const TGPoint & tobeadded -The new control point.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::Append
void Append (const TGPoint & p)
Interface Category:
API.
Purpose:
Appends the specified point to the end of the TGPolyline.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & p -The new control point.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::RemovePoint
void RemovePoint (unsigned long index)
Interface Category:
API.
Purpose:
Removes the control point at the specified index.
Calling Context:
Call this function directly.
Parameters:
- unsigned long index -The index (whose value must be less than the number of control points).
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::ReverseDirection
void ReverseDirection ()
Interface Category:
API.
Purpose:
Reverses the direction of the TGPolyline (that is, the order of the control points).
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: TGPolyline::TransformBy
void TransformBy (const TGrafMatrix & transform)
Interface Category:
API.
Purpose:
Transforms the TGPolyline's control points by the specified transformation matrix.
Calling Context:
Call this function directly.
Parameters:
- const TGrafMatrix & transform -The transformation matrix.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::DragPosition
void DragPosition (GCoordinate parametric, const TGPoint & toPoint)
Interface Category:
API.
Purpose:
Changes the TGPolyline so that it passes through the specified TGPoint at the specified parametric. The two control points nearest to the parametric are moved so that the line segment passes through the specified point.
Calling Context:
Call this function directly.
Parameters:
- GCoordinate parametric -The parametric.
- const TGPoint & toPoint -The new point that this polyline passes through.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::NearestParametric
GParametric NearestParametric (const TGPoint & p) const
Interface Category:
API.
Purpose:
Returns the parametric value of the TGPolyline at the point on the polyline nearest to the specified TGPoint. Polylines are parameterized starting at 0 and incremented by 1 at each control point. For example, a three-point polyline has a parametric range between 0 and 2 (inclusively).
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & p -The point for which the parametric value is computed.
Return Value:
Returns the parametric value of the polyline corresponding to a point on the polyline nearest to the specified point.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::Intersects
bool Intersects (const TGRect & g) const
Interface Category:
API.
Purpose:
Determines whether the TGPolyline intersects the specified rectangle.
Calling Context:
Call this function directly.
Parameters:
- const TGRect & g -The rectangle.
Return Value:
Returns true if the polyline intersects the rectangle.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::GetBounds
TGRect GetBounds () const
Interface Category:
API.
Purpose:
Returns the bounding rectangle of the TGPolyline.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the rectangle that bounds this polyline.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::operator>>=
TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & -The stream that the object's data is streamed out to.
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: TGPolyline::operator<<=
TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & -The stream that the object's data is streamed in from.
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: TGPolyline::operator=
TGPolyline & operator =(const TGPolyline & Src)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
- const TGPolyline & Src -The polyline whose value is 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: TGPolyline::operator==
bool operator ==(const TGPolyline & Src) const
Interface Category:
API.
Purpose:
Tests two TGPolylines for equality.
Calling Context:
Call this function by using the operator in an expression.
Parameters:
- const TGPolyline & Src -The polyline to be compared to this polyline.
Return Value:
Returns true if all the control points are equal to the corresponding points of the source polyline.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TGPolyline::operator!=
bool operator != (const TGPolyline & Src) const
Interface Category:
API.
Purpose:
Tests the two TGPolylines for inequality.
Calling Context:
Call this function by using the operator in an expression.
Parameters:
- const TGPolyline & Src -The polyline to be compared to this polyline.
Return Value:
Returns true if any of the control points of the source polyline are not equal to this polyline's corresponding points.
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.