response.setUserData(results.get(0).getUserData());
}
// combine location envelopes
Envelope resultEnvelope = combineResultService.combine(results);
Bbox bbox = dtoConverterService.toDto(resultEnvelope);
response.setBbox(bbox);
response.setCenter(new Coordinate(bbox.getX() + bbox.getWidth() / 2, bbox.getY() + bbox.getHeight() / 2));
} else {
List<GetLocationForStringAlternative> altList = new ArrayList<GetLocationForStringAlternative>();
response.setAlternatives(altList);
for (GetLocationResult[] altArr : alternatives) {
for (GetLocationResult alt : altArr) {
if (maxAlternatives > 0 && maxAlternatives <= altList.size()) {
break;
}
GetLocationForStringAlternative one = new GetLocationForStringAlternative();
String matchedLocation = location;
List<String> matchedStrings = alt.getCanonicalStrings();
if (null != matchedStrings) {
matchedLocation = splitGeocoderStringService.combine(matchedStrings);
}
one.setCanonicalLocation(matchedLocation);
// set additional info data
one.setGeocoderName(alt.getGeocoderName());
one.setUserData(alt.getUserData());
// combine location envelopes
Bbox bbox = dtoConverterService.toDto(alt.getEnvelope());
one.setBbox(bbox);
one.setCenter(
new Coordinate(bbox.getX() + bbox.getWidth() / 2, bbox.getY() + bbox.getHeight() / 2));
altList.add(one);
}
}
}