I have created a tool that allows a user to draw a polyline that is then used to cut a polygon. I am currently using this code:
AGSMutablePolygon* polygon = [myPolygonGraphic.geometry mutableCopy]; AGSMutablePolyline* cutline = [(AGSMutablePolyline*)self.mapView.sketchLayer.geometry mutableCopy]; NSArray* cutResults = [[AGSGeometryEngine defaultGeometryEngine] cutGeometry:polygon withCutter:cutLine];
For a majority of the polylines that I draw this works perfectly fine .. however, about 75% of the time, when I create a polyline that is similar to the letter Z, the application freezes on the cutGeometry:withCutter: call locking the CPU at 100% on the main thread. It doesn't seem to matter which part(s) of the Z intersect the polygon.
Profiling the app in Instruments shows that the application is doing some heavy processing in the following methods:
-> Esri_runtimecore::Geometry::Attribute_stream_of_dbl::read_point_2D(long long) const
I have tried using non-mutable copies of the geometry as well ... no luck.
So am I missing something here? is there some reason my code is failing or is it just an internal esri runtime bug? (infinite loop?)
Is there another method out there that I can use to cut the polygon (that will work in a disconnected state)?
Thanks in advance.