To add a vertex to the polygon, we are creating an application. After a few runs, the application displays the error message "Attempt to read and write protected memory."
IHitTest hitTest = polygon.ShapeCopy as IHitTest;bool result = hitTest.HitTest(, searchRadius, esriGeometryHitPartType.esriGeometryPartBoundary, hitPoint, ref hitDist, ref hitPartIndex, ref hitSegmentIndex, ref bTrue);if (result){IGeometryCollection geometryCol = polygon.ShapeCopy as IGeometryCollection;IPointCollection pathOrRingPointCollection = geometryCol.get_Geometry(hitPartIndex) as IPointCollection;object hitSegmentIndexObject = new object();hitSegmentIndexObject = hitSegmentIndex;object partIndexObject = new object();partIndexObject = hitPartIndex;if(hitSegmentIndex == 0){pathOrRingPointCollection.AddPoint(point, 1, Type.Missing);}else if(hitSegmentIndex > 0){pathOrRingPointCollection.AddPoint(point, Type.Missing, hitSegmentIndexObject);}//remove the old PointCollection from the GeometryCollection and replace with the new onegeometryCol.RemoveGeometries(hitPartIndex, 1);geometryCol.AddGeometry(pathOrRingPointCollection as IGeometry, ref partIndexObject, Type.Missing);polygon.Shape = geometryCol as IGeometry;invalidArea.Invalidate(2);polygon.Store();
Is anyone here to help 🤔
I'm surprised the HitTest() even works as the help file indicates the first parameter is a point object which in your code you don't supply?
I apologize; it was overlooked during copy and paste. Points are collected throughout the process, and each repetition will send a point. The polygon vertex count is approximately 8 to 9 million.
Sorry are you saying you are trying to insert a vertex into a polygon that is composed of 8 million vertices? I would imagine any sort of spatial processing would be quite slow and you would need to dice up your data?