Class: TGPolyline

Declaration: LineGeometry.h

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.

Member Function: TGPolyline::TGPolyline

  1. TGPolyline ()
  2. TGPolyline (unsigned long numPoints)
  3. TGPolyline (const TGPointArray & points)
  4. TGPolyline (const TGPolyline &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Creates a TGPolyline with the specified number of control points. All the points are initialized to TGPoint::kOrigin.
  3. Creates a TGPolyline with the points copied from the TGPointArray.
  4. Copy constructor.

Calling Context:

  1. Called by the stream-in operators. You can also call this function directly.
  2. Call this function directly.
  3. Call this function directly.
  4. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGPolyline::~TGPolyline

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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.