// we can clear here (but remember the selected feature for the special case of single selection) !
final String singleSelectionId = mapWidget.getMapModel().getSelectedFeature();
if (clearSelection) {
mapWidget.getMapModel().clearSelectedFeatures();
}
MapModel mapModel = mapWidget.getMapModel();
Coordinate worldPosition = mapModel.getMapView().getWorldViewTransformer().viewToWorld(coordinate);
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
SearchByLocationRequest request = new SearchByLocationRequest();
Layer<?> layer = mapModel.getSelectedLayer();
if (priorityToSelectedLayer && layer != null && layer instanceof VectorLayer) {
if (!layer.isShowing()) {
return;
}
request.setLayerIds(new String[] { layer.getServerLayerId() });
request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter());
} else {
request.setLayerIds(getVisibleServerLayerIds(mapModel));
}
Point point = mapModel.getGeometryFactory().createPoint(worldPosition);
request.setLocation(GeometryConverter.toDto(point));
request.setCrs(mapWidget.getMapModel().getCrs());
request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS);
request.setBuffer(calculateBufferFromPixelTolerance());