public static void searchByCriterion ( final Criterion criterion , final MapWidget mapWidget , final DataCallback < Map < VectorLayer , List < Feature > > > onFinished , final Runnable onError ) { FeatureSearchRequest request = new FeatureSearchRequest ( ) ; request . setMapCrs ( mapWidget . getMapModel ( ) . getCrs ( ) ) ; request . setCriterion ( criterion ) ; request . setLayerFilters ( getLayerFiltersForCriterion ( criterion , mapWidget . getMapModel ( ) ) ) ; request . setFeatureIncludes ( featureIncludes ) ; request . setMax ( searchResultSize ) ; GwtCommand commandRequest = new GwtCommand ( FeatureSearchRequest . COMMAND ) ; commandRequest . setCommandRequest ( request ) ; GwtCommandDispatcher . getInstance ( ) . execute ( commandRequest , new AbstractCommandCallback < FeatureSearchResponse > ( ) { public void execute ( FeatureSearchResponse response ) { onFinished . execute ( convertFromDto ( response . getFeatureMap ( ) , mapWidget . getMapModel ( ) ) ) ; } @ Override public void onCommunicationException ( Throwable error ) { if ( null != onError ) { onError . run ( ) ; } else { super . onCommunicationException ( error ) ; } } } ) ; }
Execute a search by criterion command .