public static void mergeAndBufferGeometries ( List < Geometry > geometries , double buffer , final DataCallback < Geometry [ ] > onFinished ) { GeometryUtilsRequest request = new GeometryUtilsRequest ( ) ; request . setActionFlags ( GeometryUtilsRequest . ACTION_BUFFER | GeometryUtilsRequest . ACTION_MERGE ) ; request . setIntermediateResults ( true ) ; request . setBuffer ( buffer ) ; request . setGeometries ( toDtoGeometries ( geometries ) ) ; GwtCommand command = new GwtCommand ( GeometryUtilsRequest . COMMAND ) ; command . setCommandRequest ( request ) ; GwtCommandDispatcher . getInstance ( ) . execute ( command , new AbstractCommandCallback < GeometryUtilsResponse > ( ) { public void execute ( GeometryUtilsResponse response ) { if ( onFinished != null ) { Geometry [ ] geoms = new Geometry [ 2 ] ; geoms [ 0 ] = GeometryConverter . toGwt ( response . getGeometries ( ) [ 0 ] ) ; geoms [ 1 ] = GeometryConverter . toGwt ( response . getGeometries ( ) [ 1 ] ) ; onFinished . execute ( geoms ) ; } } } ) ; }
The returned result will contain a merged - only and a merged and buffered result .