private OGCGeometry simplifyBunch_ ( GeometryCursor gc ) { // Combines geometries into multipoint, polyline, and polygon types, // simplifying them and unioning them, // then produces OGCGeometry from the result. // Can produce OGCConcreteGoemetryCollection MultiPoint dstMultiPoint = null ; ArrayList < Geometry > dstPolylines = new ArrayList < Geometry > ( ) ; ArrayList < Geometry > dstPolygons = new ArrayList < Geometry > ( ) ; for ( com . esri . core . geometry . Geometry g = gc . next ( ) ; g != null ; g = gc . next ( ) ) { switch ( g . getType ( ) ) { case Point : if ( dstMultiPoint == null ) dstMultiPoint = new MultiPoint ( ) ; dstMultiPoint . add ( ( Point ) g ) ; break ; case MultiPoint : if ( dstMultiPoint == null ) dstMultiPoint = new MultiPoint ( ) ; dstMultiPoint . add ( ( MultiPoint ) g , 0 , - 1 ) ; break ; case Polyline : dstPolylines . add ( ( Polyline ) g . copy ( ) ) ; break ; case Polygon : dstPolygons . add ( ( Polygon ) g . copy ( ) ) ; break ; default : throw new UnsupportedOperationException ( ) ; } } ArrayList < Geometry > result = new ArrayList < Geometry > ( 3 ) ; if ( dstMultiPoint != null ) { Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( dstMultiPoint , esriSR , true , null ) ; result . add ( resMP ) ; } if ( dstPolylines . size ( ) > 0 ) { if ( dstPolylines . size ( ) == 1 ) { Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( dstPolylines . get ( 0 ) , esriSR , true , null ) ; result . add ( resMP ) ; } else { GeometryCursor res = OperatorUnion . local ( ) . execute ( new SimpleGeometryCursor ( dstPolylines ) , esriSR , null ) ; Geometry resPolyline = res . next ( ) ; Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( resPolyline , esriSR , true , null ) ; result . add ( resMP ) ; } } if ( dstPolygons . size ( ) > 0 ) { if ( dstPolygons . size ( ) == 1 ) { Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( dstPolygons . get ( 0 ) , esriSR , true , null ) ; result . add ( resMP ) ; } else { GeometryCursor res = OperatorUnion . local ( ) . execute ( new SimpleGeometryCursor ( dstPolygons ) , esriSR , null ) ; Geometry resPolygon = res . next ( ) ; Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( resPolygon , esriSR , true , null ) ; result . add ( resMP ) ; } } return OGCGeometry . createFromEsriCursor ( new SimpleGeometryCursor ( result ) , esriSR ) ; }
it produces a single OGCGeometry .