double distance = tolerance * resolution;
geometry = GeometryToolkit.buffer(geometry, mapSR, mapSR,
mapSR, distance);
}
IdentifyType identifyType = identifyParam.getIdentifyType();
// Handle layers
ArrayList<String> handleLayerIds = null;
if (identifyType.equals(IdentifyType.TOP)) {
handleLayerIds = layerIds;
} else if (identifyType.equals(IdentifyType.VISIBLE)) {
handleLayerIds = new ArrayList<String>();
for (int i = 0, count = map.getMapContext().getLayerCount(); i < count; i++) {
MapLayer layer = map.getLayer(i).getMapLayer();
if (layer.isVisible()) {
handleLayerIds.add(String.valueOf(i));
}
}
} else if (identifyType.equals(IdentifyType.ALL)) {
handleLayerIds = new ArrayList<String>();
for (int i = 0, count = map.getMapContext().getLayerCount(); i < count; i++) {
handleLayerIds.add(String.valueOf(i));
}
}
for (int i = 0, count = handleLayerIds.size(); i < count; i++) {
Layer layer = map.getLayer(i);
QueryParam queryParam = new QueryParam();
queryParam.setGeometry(geometry);
queryParam.setSpatialFilterType(SpatialFilterType.INTERSECTS);
FeatureCollection<? extends FeatureType, ? extends Feature> layerFeatureCollection = layer
.query(queryParam);
if (layerFeatureCollection != null
&& !layerFeatureCollection.isEmpty()) {
for (FeatureIterator<? extends Feature> itr = layerFeatureCollection
.features(); itr.hasNext();) {
Feature feature = itr.next();
FeatureResult featureResult = new FeatureResult();
featureResult.setLayer(layer);
featureResult.setFeature(feature);
result.add(featureResult);
}
if (identifyType.equals(IdentifyType.TOP)) {
break;
}
}
}
} catch (Exception e) {