I am trying to update some code from VB6 to VB.Net 2008 and have been generally successful. However, I come across an issue where, as it processes each polygon in the shapefile and implements the following code.
Dim lngExtRing as Integer
lngExtRing = pPolygon.ExteriorRingCount - 1
ReDim pExtRings(pPolygon.ExteriorRingCount - 1)
pPolygon.QueryExteriorRingsEx(pPolygon.ExteriorRingCount, pExtRings(0))
pExtRings(lngExtRing)
Once that code runs and you hover over the pExtRings portion of pExtRings(lngExtRing) for some polygons (not all), the first popup lists a ComObject but if you expand the plus, it indicates "Nothing". I have run this on a shapefile that has 5 polygons and the two polygons that it fails on have negative areas. There are two ways that might resolve this, but I don't know how to implement either. One was to reverse the orientation if the area was negative, but I tried that on a different shapefile and it still failed on a polygon that did not have a negative area. The other, perhaps better, approach would be to implement the RepairGeometry class of ESRI.ArcGIS.DataManagementTools, but I have no clue on how to make it happen.
If anyone has any insight or examples of how to use RepairGeometry, I would certainly appreciate being enlightened.
If I was calling an existing geoprocessing tool in VB then I would use the IGeoProcessor Interface. Search for this in the Help and then may be the forum to see how to set it up and supply the parameters to execute it.
Have a look at this thread, the basic syntax is all there.