This document is archived and information here might be outdated. Recommended version. |
Given a geometry and the index/number of the segments to be removed, remove the segments.
///<summary>Given a geometry and the index/number of the segments to be removed, remove the segments.</summary> /// ///<param name="geometry">An IGeometry interface that will have a segment(s) removed.</param> ///<param name="index">A System.Int32 that is the starting position of where to remove segments from the geometry. Example: 0 (the first position)</param> ///<param name="count">A System.Int32 that is the number of segements to remove from the geometry. Example: 3</param> /// ///<remarks></remarks> public void RemoveSegmentFromGeometry(ref ESRI.ArcGIS.Geometry.IGeometry geometry, System.Int32 index, System.Int32 count) { if(geometry == null || !(geometry is ESRI.ArcGIS.Geometry.ISegmentCollection)) { return; } ESRI.ArcGIS.Geometry.ISegmentCollection segmentCollection=((ESRI.ArcGIS.Geometry.ISegmentCollection)(geometry)); // Explicit Cast if (index < 0 || index >= segmentCollection.SegmentCount || count < 0 || count > segmentCollection.SegmentCount) { return; } segmentCollection.RemoveSegments(index, count, true); }
'''<summary>Given a geometry and the index/number of the segments to be removed, remove the segments.</summary> ''' '''<param name="geometry">An IGeometry interface that will have a segment(s) removed.</param> '''<param name="index">A System.Int32 that is the starting position of where to remove segments from the geometry. Example: 0 (the first position)</param> '''<param name="count">A System.Int32 that is the number of segements to remove from the geometry. Example: 3</param> ''' '''<remarks></remarks> Sub RemoveSegmentFromGeometry(ByRef geometry As ESRI.ArcGIS.Geometry.IGeometry, ByVal index As System.Int32, ByVal count As System.Int32) If geometry Is Nothing OrElse Not (TypeOf geometry Is ESRI.ArcGIS.Geometry.ISegmentCollection) Then Return End If Dim segmentCollection As ESRI.ArcGIS.Geometry.ISegmentCollection=(CType(geometry, ESRI.ArcGIS.Geometry.ISegmentCollection)) ' Explicit Cast If index < 0 OrElse index >= segmentCollection.SegmentCount OrElse count < 0 OrElse count > segmentCollection.SegmentCount Then Return End If segmentCollection.RemoveSegments(index, count, True) End Sub