AnsweredAssumed Answered

AGSGeometryEngine cutGeometry:withCutter locks CPU at 100%

Question asked by MakiG007 on Oct 17, 2014
Latest reply on Oct 21, 2014 by MakiG007

Hello:

 

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::Topo_graph::update_chain_area_and_perimeter_(long long)

-> Esri_runtimecore::Geometry::Math_utils:Kahan_summator::add(double)

-> 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.

Outcomes