Small code improvement
This commit is contained in:
parent
27bd894e56
commit
98a0829d5a
1 changed files with 4 additions and 6 deletions
|
@ -284,10 +284,10 @@ public class GeocodingUtilities {
|
||||||
double streetDistance = 0;
|
double streetDistance = 0;
|
||||||
boolean isBuildingFound = knownMinBuildingDistance > 0;
|
boolean isBuildingFound = knownMinBuildingDistance > 0;
|
||||||
for (GeocodingResult street : streetsList) {
|
for (GeocodingResult street : streetsList) {
|
||||||
boolean skipStreet = streetDistance > 0 && street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME;
|
if (streetDistance == 0) {
|
||||||
if (streetDistance == 0 || !isBuildingFound) {
|
|
||||||
streetDistance = street.getDistance();
|
streetDistance = street.getDistance();
|
||||||
} else if (skipStreet) {
|
} else if (streetDistance > 0 && street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME &&
|
||||||
|
isBuildingFound) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
street.connectionPoint = road.connectionPoint;
|
street.connectionPoint = road.connectionPoint;
|
||||||
|
@ -298,6 +298,7 @@ public class GeocodingUtilities {
|
||||||
if (knownMinBuildingDistance == 0) {
|
if (knownMinBuildingDistance == 0) {
|
||||||
GeocodingResult firstBld = it.next();
|
GeocodingResult firstBld = it.next();
|
||||||
knownMinBuildingDistance = firstBld.getDistance();
|
knownMinBuildingDistance = firstBld.getDistance();
|
||||||
|
isBuildingFound = true;
|
||||||
res.add(firstBld);
|
res.add(firstBld);
|
||||||
}
|
}
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -309,9 +310,6 @@ public class GeocodingUtilities {
|
||||||
res.add(nextBld);
|
res.add(nextBld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (skipStreet) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
res.add(street);
|
res.add(street);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue