IGPolyline2D
- A IGPolyline2D 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.
An IGPolyline2D object is not explicitly closed
(use IGPolygon2D for that; explictly closing a IGPolyline2D may give an unexpected "seam").
IGPolyline2D - Member Functions and Data by Group
Constructors & Destructor
Use these functions to construct and destroy objects of class IGPolyline.
- ~IGPolyline2D
public:
virtual ~IGPolyline2D()
- Destroys the polyline.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- IGPolyline2D
- Constructs an IGPolyline2D object.
Note that IRawArray does not check whether allocation is successful. Therefore, before you construct an
object, check to ensure that there is enough memory and use a reasonable size.
Overload 1
- Creates an IGPolylin2D with the specified number of control points (IGPoint2D::kOrigin).
public:
IGPolyline2D(unsigned long numPoints)
- Use this constructor to create a 2D polyline object having the given number of control points.
- numPoints
- The number of control points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Overload 2
- Creates an IGPolyline2D with the points copied from the IGPoint2DArray.
public:
IGPolyline2D(const IGPoint2DArray& points)
- Use this constructor to create a 2D polyline whose points are copied from the given array.
- points
- The array of control points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Overload 3
- Copy constructor.
public:
IGPolyline2D(const IGPolyline2D&)
- Use this constructor to create a 2D polyline object copied from the given one.
- IGPolyline2D
- A constant reference to the polyline to be copied.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Overload 4
- Default constructor with 0 points.
public:
IGPolyline2D()
- Use the default constructor to create an empty IGPolyline2D object, that is, one with 0 points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Adding and Appending Control Points to the Polyline
Use the functions in this group to add or append a control point to an IGPolyline2D.
- addBefore
public:
void
addBefore( unsigned long index,
const IGPoint2D& tobeadded )
- Inserts the specified IGPoint2D before the control point at the specified index.
- index
- The index whose value must be less than the number of control points.
- tobeadded
- The new control point.
- Exception
| Calls a parameter assertion that fails if the index is out of range.
|
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- append
public:
void append(const IGPoint2D& p)
- Appends the specified point to the end of the IGPolyline2D.
- p
- The new control points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Assessing Aspects of the Polyline
Use these functions to determine whether the line intersects a given rectangle or
whether the all of the line segments are horizontal or vertical.
- intersects
public:
bool intersects(const IGRect2D& g) const
- Determines whether the IGPolyline2D intersects the specified rectangle.
- g
- The rectangle.
- Return
- True if the polyline intersects the rectangle.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- isRectilinear
public:
bool isRectilinear() const
- Determines whether all the line segments of the IGPolyline2D are horizontal or vertical.
- Return
- True if all the line segments of the polyline are horizontal or vertical.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Assignment Operator
Use the operator in this group to perform assignment operations.
- operator =
public:
IGPolyline2D& operator =(const IGPolyline2D& Src)
- Assignment operator.
- Src
- The polyline whose value is copied.
- Return
- A non-const reference to the left-hand side object.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Modifying a Polyline
Use this function to change the IGPolyline2D so that it passes through the given point.
- dragPosition
public:
void
dragPosition( GCoordinate parametric,
const IGPoint2D& toPoint )
- Changes the IGPolyline2D so that it passes through the given IGPoint2D at the specified parametric.
- parametric
- The parametric.
- toPoint
- The new point that this polyline passes through.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Obtaining and Manipulating a Polyline's Control Points
Use these functions to remove or obtain the control point at the specified index, to reverse the
polyline's direction by changing the direction of the control points, to copy the
polyline's control points into a given point array, to reset one or more control points, or to
transform the control points by a given transformation matrix.
- point
public:
IGPoint2D point(unsigned long index) const
- Returns the control point at the specified index.
- index
- The index whose value must be less than the number of control points.
- Return
- The point at the specified index.
- Exception
| Calls a parameter assertion that fails if the index is out of range.
|
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- points
public:
void points(IGPoint2DArray& pts) const
- Copies the IGPolyline2D's control points into the argument.
- pts
- The point array that the polyline's control points are copied into.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- removePoint
public:
void removePoint(unsigned long index)
- Removes the control point at the specified index.
- index
- The index whose value must be less than the number of control points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- reverseDirection
public:
void reverseDirection()
- Reverses the direction of the IGPolyline2D, that is, the order of the control points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- setPoint
public:
void setPoint(unsigned long index, const IGPoint2D& p)
- Resets the control point at the specified index to the IGPoint2D.
- index
- The index whose value must be less than the number of control points.
- p
- The new control point.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- setPoints
public:
void setPoints(const IGPoint2DArray& newPoints)
- Resets the IGPolyline2D's control points. The number of points can be changed.
- newPoints
- The new control points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- transformBy
public:
void transformBy(const IGrafMatrix& transform)
- Transforms the IGPolyline2D's control points by the specified transformation matrix.
- transform
- The transformation matrix.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Obtaining Information About the Polyline
Use the functions in this group to obtain information about a polyline, such as its
bounding rectangle, the parametric value corresponding to the given control point,
or the current number of control points the polyline contains.
- bounds
public:
IGRect2D bounds() const
- Returns the bounding rectangle of the IGPolyline2D.
- Return
- The rectangle that bounds this polyline.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- evaluate
public:
IGPoint2D evaluate(GParametric u) const
- 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. That is to say, the integer part of u determines which segment
of the polyline is referenced, and the fraction determines where on that segment the
point is.
- u
- The parametric value.
- Return
- A point corresponding to the parametric distance.
- Exception
| Calls a parameter assertion that fails if the specified parametric is negative or greater than the number of control points.
|
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- nearestParametric
public:
GParametric nearestParametric(const IGPoint2D& p) const
- Returns the parametric value at the point on the polyline nearest to the specified IGPoint2D.
- p
- The point for which the parametric value is computed.
- Return
- The parametric value of the polyline.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- numberOfPoints
public:
unsigned long numberOfPoints() const
- Returns the number of control points in the IGPolyline2D.
- Return
- The number of control points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Streaming an Object In an Out
Use the operators and functions in this group to read an IGPolyline2D object in from a stream or write it out to one.
- operator <<=
public:
IDataStream& operator <<=(IDataStream&)
- Operator for streaming in the polyline object from the given polymorphic stream.
- IDataStream
- The stream to which the polyline object is streamed out.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- operator >>=
public:
IDataStream& operator >>=(IDataStream&) const
- Operator for streaming out the polyline object to the given polymorphic stream.
- IDataStream
- The stream from which the polyline object is streamed in.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- readFromStream
public:
void readFromStream(IDataStream& toWhere)
- Streams in the polyline object from the polymorphic streaming specified by fromWhere.
- fromWhere
- The stream used to stream in the polyline object.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- writeToStream
public:
void writeToStream(IDataStream& toWhere) const
- Streams out the polyline object to the polymorphic streaming specified by toWhere.
- toWhere
- The stream to which the polyline object is streamed out.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
Testing Polylines for Equality or Inequality
Use these operators to test the given polyline against the current one for equality or
inequality.
- operator !=
public:
bool operator !=(const IGPolyline2D& Src) const
- Tests two IGPolyline2D objects for inequality.
- Src
- The polyline to be compared to this polyline.
- Return
- True if any of the control points of the source polyline are not equal to this polyline's corresponding points.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
- operator ==
public:
bool operator ==(const IGPolyline2D& Src) const
- Tests two IGPolyline2D objects for equality.
- Src
- The polyline to be compared to this polyline.
- Return
- True if all the control points are equal to the corresponding points of the source polyline.
- Supported Platforms
Windows |
OS/2 |
AIX |
Yes |
Yes |
Yes |
IGPolyline2D - Inherited Member Functions and Data
Inherited Public Functions
Inherited Public Data
Inherited Protected Functions
Inherited Protected Data