IEnumSegment Interface

Provides access to members that iterate over collections of segments (obtained from the EnumSegments property on the ISegmentCollection interface).

Description

The methods on IEnumSegment interface can be used to access segments of a segment collection. Those methods are more efficient than the ISegmentCollection methods to access a large number of segments in a sequential order for polyline and polygon. The collection methods transform absolute segment index into a part relative index, enumerators don't.

Members

Name Description
Method Clone Returns a copy of this enumerator positioned at the same segment.
Method IsLastInPart Indicates if the current segment is last in the current part.
Read-only property IsRecycling Indicates if this enumerator re-uses the same segment each time next is called.
Method Next Returns the next segment, and its location in the collection. If the location does not have parts (i.e. a path or ring) then the part index will always be zero.
Method NextEx Populates a segment info structure with information on the next segment in the collection.
Method NextInPart Returns the next segment in current part, goes back to first segment after last segment in part is encountered.
Method NextInPartEx Returns the next segment info structure in current part, goes back to first segment after last segment in part is encountered.
Method Previous Returns the previous segment in this segment collection.
Method Reset Starts from the beginning of the segment collection the next time Next is called.
Method ResetToEnd Starts from the end of the path, ring, polyline or polygon the next time Previous is called.
Method SetAt Resets enumerator to specific location.
Method Skip Skips forward or backward over a specified number of segments.

IEnumSegment.Clone Method

Returns a copy of this enumerator positioned at the same segment.

Public Sub Clone ( _
    ByRef outEnumerator As IEnumSegment _
)
public void Clone (
    ref IEnumSegment outEnumerator
);

IEnumSegment.IsLastInPart Method

Indicates if the current segment is last in the current part.

Public Function IsLastInPart ( _
) As Boolean
public bool IsLastInPart (
);

Description

The IsLastInPart method returns 'True' if the enumerator is located on the last segment of a given part. For example, if a polyline has 2 parts and 3 segments in each part, IsLastInPart would return 'true' when the enumerator is located at Part Index = 0 Segment Index = 2 and Part Index = 1 Segment Index = 2.

IEnumSegment.IsRecycling Property

Indicates if this enumerator re-uses the same segment each time next is called.

Public ReadOnly Property IsRecycling As Boolean
public bool IsRecycling {get;}

Description

The IsRecycling method indicates whether or not modifications to segments in the segment collection are seen or not by the enumerator. If 'True' then modifications to segments will not be seen by the enumerator, if 'False' then the enumerator is always up to date and represents the current state of the segment collection.

Remarks

Note: The IsRecycling state is contolled by the system and cannot be directly changed by users.

IEnumSegment.Next Method

Returns the next segment, and its location in the collection. If the location does not have parts (i.e. a path or ring) then the part index will always be zero.

Public Sub Next ( _
    ByRef outSegment As ISegment, _
    ByRef outPartIndex As Integer, _
    ByRef SegmentIndex As Integer _
)
public void Next (
    ref ISegment outSegment,
    ref int outPartIndex,
    ref int SegmentIndex
);

Description

The NextEx method advances the enumerator to the next position, returns the segment, the part index and the segment index.

Remarks

See picture for a graphical explanation of some of the IEnumSegment methods.

IEnumSegment.NextEx Method

Populates a segment info structure with information on the next segment in the collection.

Public Sub NextEx ( _
    ByRef outSegment As esriSegmentInfo _
)
public void NextEx (
    ref esriSegmentInfo outSegment
);

Description

The NextEx method advances the enumerator to the next position and returns the segment and the associated information using an esriSegmentInfo structure.

IEnumSegment.NextInPart Method

Returns the next segment in current part, goes back to first segment after last segment in part is encountered.

Public Sub NextInPart ( _
    ByRef outSegment As ISegment, _
    ByRef OutSegmentIndex As Integer _
)
public void NextInPart (
    ref ISegment outSegment,
    ref int OutSegmentIndex
);

Description

The NextInPart method is returning the next segment in the current part. As oppose to the Next method the NextInpart method limits its search to the part where the enumerator is currently located. For example, if the enumerator is located on the last segment of a given part then NextInPartEx will return the first segment of that part.

IEnumSegment.NextInPartEx Method

Returns the next segment info structure in current part, goes back to first segment after last segment in part is encountered.

Public Sub NextInPartEx ( _
    ByRef outSegment As esriSegmentInfo _
)
public void NextInPartEx (
    ref esriSegmentInfo outSegment
);

Description

The NextInPartEx method is returning the next segment in the current part along with more information about the segment than the NextInPart method. As oppose to the Next method the NextInpartEx method limits its search to the part where the enumerator is currently located. For example, if the enumerator is located on the last segment of a given part then NextInPartEx will return the first segment of that part.

IEnumSegment.Previous Method

Returns the previous segment in this segment collection.

Public Sub Previous ( _
    ByRef outSegment As ISegment, _
    ByRef outPartIndex As Integer, _
    ByRef SegmentIndex As Integer _
)
public void Previous (
    ref ISegment outSegment,
    ref int outPartIndex,
    ref int SegmentIndex
);

Description

The Previous method returns the segment before the current position. For example, if the enumerator is in position Part Index = 0 and Segment Index = 1, then calling previous will return the segment located at Part Index = 0 and Segment Index = 0.

Remarks

See picture for a graphical explanation of some of the IEnumSegment methods.

IEnumSegment.Reset Method

Starts from the beginning of the segment collection the next time Next is called.

Public Sub Reset ( _
)
public void Reset (
);

Description

Reset the enumerator. For example, the following call to IEnumSegment::Next returns segment index = 0.

Remarks

See picture for a graphical explanation of some of the IEnumSegment methods.

IEnumSegment.ResetToEnd Method

Starts from the end of the path, ring, polyline or polygon the next time Previous is called.

Public Sub ResetToEnd ( _
)
public void ResetToEnd (
);

Description

The ResetToEnd method set the enumerator to its end. Using the Previous method in this situation will return the last segment of the last part.

Remarks

See picture for a graphical explanation of some of the IEnumSegment methods.

IEnumSegment.SetAt Method

Resets enumerator to specific location.

Public Sub SetAt ( _
    ByVal iPart As Integer, _
    ByVal ISegment As Integer _
)
public void SetAt (
    int iPart,
    int ISegment
);

Description

The SetAt method allows setting the enumerator at any given location in the enumerator. Then using the Next method will return the specified segment. For example, using SetAt(1,0) followed by Next will return the segment located at Part Index = 1 and Segment Index = 0.

Remarks

See picture for a graphical explanation of some of the IEnumSegment methods.

IEnumSegment.Skip Method

Skips forward or backward over a specified number of segments.

Public Sub Skip ( _
    ByVal numSegments As Integer _
)
public void Skip (
    int numSegments
);

Description

The skip method jumps over a given number of segments in ascending (positive number) or descending (negative number) order and set the enumerator at that position. For example, if the enumerator is in its initial position (ex: after reset) calling skip 2 will move the enumerator to the position just before segment index= 2, therefore calling next will return segment index = 2.

Classes that implement IEnumSegment

Classes Description

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.