Provides access to members that iterate over the vertices or points of a geometry (see the EnumVertices property of the IPointCollection interface).
Description
The methods on IEnumVertex interface can be used to access points of a point collection. EnumVertex is a lightweight object that you can use to pass around between routines. You may wish to use this enumerator in preference to the Points array returned by the IPointCollection::Points property, as it allows you to directly change the x-, y-, z-, m-, and ID properties of each Point, although Points cannot be removed or replaced using this interface. The IEnumVertex has knowledge of parts within multipart shapes and may therefore be convenient for use on a multipart shape, such as a Polygon or Polyline. Those methods are more efficient than the IPointCollection methods to access a large number of points in a sequential order for polyline and polygon. The collection methods transform absolute point index into a part relative index, enumerators don't.
Members
Name | Description | |
---|---|---|
Clone | Returns a copy of this enumerator positioned at the same vertex. | |
IsLastInPart | Indicates if the current vertex is last in the current part. | |
Next | Returns the next vertex and its location within the geometry. | |
NextInPart | Returns the next vertex in current part, or goes back to the first vertex in the part after last vertex in part is encountered. | |
Previous | Returns the previous vertex and its location in the geometry. | |
put_Attribute | Sets attribute values at the current vertex. | |
put_ID | Sets the ID attribute of the current vertex. For segment-based geometries, this will modify a pair of segments. | |
put_M | Sets the M attribute of the current vertex. For segment-based geometries, this will modify a pair of segments. | |
put_X | Sets the X coordinate of the current vertex. For segment-based geometries, this will modify a pair of segments. | |
put_Y | Sets the Y coordinate of the current vertex. For segment-based geometries, this will modify a pair of segments. | |
put_Z | Sets the Z coordinate of the current vertex. For segment-based geometries, this will modify a pair of segments. | |
QueryNext | Copies the next vertex to the input parameter and returns its location in the geometry. | |
QueryNextInPart | Copies the next vertex in the current part to the input parameter and returns its location in current part. Continues with the first vertex in the part if already at the end. | |
QueryPrevious | Copies the previous vertex to the input parameter and returns its location in the geometry. | |
Reset | Starts from the beginning of the geometry the next time Next is called. | |
ResetToEnd | Starts from the end of the geometry the next time Previous is called. | |
SetAt | Resets enumerator to specific location. | |
Skip | Skips forward or backward over a specified number of vertices. |
IEnumVertex.Clone Method
Returns a copy of this enumerator positioned at the same vertex.
Public Function Clone ( _
) As IEnumVertex
public IEnumVertex Clone (
);
Description
The Clone method creates a copy of the current Enumerator and preserves the current location (Indexes) inside of the copied Enumerator.
IEnumVertex.IsLastInPart Method
Indicates if the current vertex is last in the current part.
Public Function IsLastInPart ( _
) As Boolean
public bool IsLastInPart (
);
Description
The IsLastInPart method returns whether or not the Enumerator is located on the last point of a given. For example for a polyline with 2 parts of 4 vertices each, the IsLastInPart method would return 'true' for PartIndex = 0 and VertexIndex = 4 and for PartIndex = 1 and VertexIndex = 4.
IEnumVertex.Next Method
Returns the next vertex and its location within the geometry.
Public Sub Next ( _
ByRef outVertex As IPoint, _
ByRef outPartIndex As Integer, _
ByRef vertexIndex As Integer _
)
public void Next (
ref IPoint outVertex,
ref int outPartIndex,
ref int vertexIndex
);
Description
The Next method returns the next vertex in the enumerator.
Remarks
See picture for a graphical explanation of some of the IEnumVertex methods.
IEnumVertex.NextInPart Method
Returns the next vertex in current part, or goes back to the first vertex in the part after last vertex in part is encountered.
Public Sub NextInPart ( _
ByRef outVertex As IPoint, _
ByRef OutVertexIndex As Integer _
)
public void NextInPart (
ref IPoint outVertex,
ref int OutVertexIndex
);
Description
The NextInPart method returns the Next vertex in the current part only. If the Enumerator reaches the end of the current part it is reset to the start point of that part and returns the start point.
IEnumVertex.Previous Method
Returns the previous vertex and its location in the geometry.
Public Sub Previous ( _
ByRef outVertex As IPoint, _
ByRef outPartIndex As Integer, _
ByRef vertexIndex As Integer _
)
public void Previous (
ref IPoint outVertex,
ref int outPartIndex,
ref int vertexIndex
);
Description
The Previous method returns the vertex before the current location of the Enumerator.
Remarks
See picture for a graphical explanation of some of the IEnumVertex methods.
IEnumVertex.QueryNext Method
Copies the next vertex to the input parameter and returns its location in the geometry.
Public Sub QueryNext ( _
ByVal vertex As IPoint, _
ByRef outPartIndex As Integer, _
ByRef vertexIndex As Integer _
)
public void QueryNext (
IPoint vertex,
ref int outPartIndex,
ref int vertexIndex
);
Description
The QueryNext method query the next vertex in the enumerator. Different from the Next method, the output point needs to be cocreated before calling QueryNext. The QueryNext method is faster than the Next method because it doesn't need to create a point internally each time. The QueryNext method only populates the output point.
Remarks
Note: The output point must be co-created prior to use the query. The output point is not co-created by the method, it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method inside the loop could improve performance compare to calling Next method which needs to co-create point each time.
IEnumVertex.QueryNextInPart Method
Copies the next vertex in the current part to the input parameter and returns its location in current part. Continues with the first vertex in the part if already at the end.
Public Sub QueryNextInPart ( _
ByVal vertex As IPoint, _
ByRef OutVertexIndex As Integer _
)
public void QueryNextInPart (
IPoint vertex,
ref int OutVertexIndex
);
Description
The QueryNextInPart method returns the Next vertex in the current part only. If the Enumerator reaches the end of the current part it is reset to the start point of that part and returns the first point. As oppose to the NextInPart method the output point needs to be cocreated before to call QueryNextInPart. The QueryNextInPart method is faster than the NextInPart method because it doesn't need to create a point internally each time. The QueryNextInPart method only populates the output point. For example, creating the point only once outside a loop and reuse it in the QueryNextInPart method will be faster than calling NextInPart each time.
Remarks
Note: The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.
IEnumVertex.QueryPrevious Method
Copies the previous vertex to the input parameter and returns its location in the geometry.
Public Sub QueryPrevious ( _
ByVal vertex As IPoint, _
ByRef outPartIndex As Integer, _
ByRef vertexIndex As Integer _
)
public void QueryPrevious (
IPoint vertex,
ref int outPartIndex,
ref int vertexIndex
);
Description
The QueryPrevious method returns the vertex before the current location of the Enumerator. As oppose to the Previous method the output point needs to be cocreated before to call QueryPrevious. The QueryPrevious method is faster than the Previous method because it doesn't need to create a point internally each time. The QueryPrevious method only populates the output point. For example, creating the point only once outside a loop and reuse it in the QueryPrevious method will be faster than calling Previous each time.
Remarks
Note: The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.
IEnumVertex.Reset Method
Starts from the beginning of the geometry the next time Next is called.
Public Sub Reset ( _
)
public void Reset (
);
Description
The Reset method sets the Enumerator in the position just before the first point. Therefore calling the Next method returns the first point of the Enumerator (PartIndex = 0 and VertexIndex = 0)
Remarks
See picture for a graphical explanation of some of the IEnumVertex methods.
IEnumVertex.ResetToEnd Method
Starts from the end of the geometry the next time Previous is called.
Public Sub ResetToEnd ( _
)
public void ResetToEnd (
);
Description
The ResetToEnd method sets the Enumerator in the position just after the last point. Therefore calling the Previous method returns the last point of the Enumerator (PartIndex = PartCount -1 and VertexIndex = VertexCountInPart-1).
Remarks
See picture for a graphical explanation of some of the IEnumVertex methods.
IEnumVertex.SetAt Method
Resets enumerator to specific location.
Public Sub SetAt ( _
ByVal iPart As Integer, _
ByVal iVertex As Integer _
)
public void SetAt (
int iPart,
int iVertex
);
Description
The SetAt method allows setting the Enumerator to a particular position.
Remarks
See picture for a graphical explanation of some of the IEnumVertex methods.
IEnumVertex.Skip Method
Skips forward or backward over a specified number of vertices.
Public Sub Skip ( _
ByVal numVertices As Integer _
)
public void Skip (
int numVertices
);
Description
The Skip method allows jumping over a given number of positions in the enumerator. The Skip method can be used to go forward (positive value) or backward (negative value).
Classes that implement IEnumVertex
Classes | Description |
---|