jwsury12

Problems with ITopologicalOperator Cut

Discussion created by jwsury12 on Jan 30, 2013
Latest reply on Jan 31, 2013 by whe-esristaff
I'm thoroughly baffled!  I'm using ITopologicalOperator.Cut to cut polyline road segments that cross polyline boundaries.

            While Not pFeature Is Nothing

                pCuttingPolygonBoundary = ConvertPolygonToPolyline(pFeature.Shape)

                If pCuttingPolygonBoundary.SpatialReference Is Nothing Then
                    pCuttingPolygonBoundary.SpatialReference = pPublicMap.SpatialReference
                End If

                pCuttingPolygonBoundary.SnapToSpatialReference()
                pTopoOp = pCuttingPolygonBoundary
                pTopoOp.IsKnownSimple_2 = False
                pTopoOp.Simplify()

                pSF = New SpatialFilter
                pSF.Geometry = pCuttingPolygonBoundary
                pSF.GeometryField = m_OutputFeatureClass.ShapeFieldName
                pSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelCrosses

                pPolylineFeatureCursor = m_OutputFeatureClass.Search(pSF, False)
                pPolylineFeature = pPolylineFeatureCursor.NextFeature()
                sOIDList = ""

                While Not pPolylineFeature Is Nothing

                    pLeftPolyline = New Polyline
                    pRightPolyline = New Polyline

                    pPolyline = pPolylineFeature.ShapeCopy

                    If pPolyline.SpatialReference Is Nothing Then
                        pPolyline.SpatialReference = pPublicMap.SpatialReference
                    End If

                    pPolyline.Project(pCuttingPolygonBoundary.SpatialReference)
                    pPolyline.SnapToSpatialReference()

                    pTopoOp = pPolyline
                    pTopoOp.IsKnownSimple_2 = False
                    pTopoOp.Simplify()

                    pTopoOp.Cut(pCuttingPolygonBoundary, pLeftPolyline, pRightPolyline)



I then put the resulting left and right polylines into the featureclass and delete the original polyline.  It seems to work however when I do a spatial selection using the crossed by the outline selection method some of the polylines are still selected.  Its my understanding that the split lines no longer cross the boundary put simply touch it.

Is there something I'm missing?

Outcomes