AnsweredAssumed Answered

How to use ITopologicalOperator with vb.net?

Question asked by mahakarthik on Feb 18, 2016
Latest reply on Feb 19, 2016 by mahakarthik

Dear all,

            I am using arcmap 9.3 with VB.Net. I need to get the adjacent building so i am using the Itopological operator for get the building. i am doing following coding but i am not complete the coding i have struggle please any one help me for complete the coding.

 

Sub exampleITopologicalOperator_Buffer(ByVal x As Double, ByVal y As Double)

  Dim featureCursor As IFeatureCursor

        Dim ptc As ESRI.ArcGIS.Geometry.IPointCollection, i As Long, pa As ESRI.ArcGIS.Geometry.IArea, ptopo As ESRI.ArcGIS.Geometry.ITopologicalOperator

  

        ptc = New ESRI.ArcGIS.Geometry.Polygon

        Dim pt(4) As ESRI.ArcGIS.Geometry.IPoint, poutPoly As ESRI.ArcGIS.Geometry.IPolygon

        'The spatial reference should be set here using IGeometry::SpatialReference (Code skipped here) 344011.132111 6300045.490245

        For i = 0 To 4

            pt(i) = New ESRI.ArcGIS.Geometry.Point

        Next

 

        pt(0).PutCoords(x + 0.5, y)

        pt(1).PutCoords(x, y + 0.5)

        pt(2).PutCoords(x - 0.5, y)

        pt(3).PutCoords(x, y - 0.5)

        pt(4).PutCoords(x + 0.5, y)

 

        Dim geometryBride As ESRI.ArcGIS.Geometry.IGeometryBridge

        geometryBride = New ESRI.ArcGIS.Geometry.GeometryEnvironmentClass()

        geometryBride.AddPoints(ptc, pt)

        pa = ptc 

        ptopo = ptc

        poutPoly = ptopo.Buffer(-1) 'inside buffer

        pa = poutPoly

      

 

        Dim SpatialFilter As ISpatialFilter

 

 

        SpatialFilter.Geometry = poutPoly

        SpatialFilter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelOverlaps       

 

    End Sub

Outcomes