Update search
This commit is contained in:
parent
c2363f8dd4
commit
71ef807f56
1 changed files with 32 additions and 27 deletions
|
@ -173,7 +173,7 @@ public class GeocodingUtilities {
|
||||||
GeocodingResult rs = new GeocodingResult(r);
|
GeocodingResult rs = new GeocodingResult(r);
|
||||||
rs.street = (Street) object;
|
rs.street = (Street) object;
|
||||||
rs.city = rs.street.getCity();
|
rs.city = rs.street.getCity();
|
||||||
if(d > THRESHOLD_STREET_CHANGE_CONNECTION_POINT) {
|
if(d < THRESHOLD_STREET_CHANGE_CONNECTION_POINT) {
|
||||||
rs.connectionPoint = rs.street.getLocation();
|
rs.connectionPoint = rs.street.getLocation();
|
||||||
}
|
}
|
||||||
streetsList.add(rs);
|
streetsList.add(rs);
|
||||||
|
@ -192,35 +192,40 @@ public class GeocodingUtilities {
|
||||||
|
|
||||||
final List<GeocodingResult> res = new ArrayList<GeocodingResult>();
|
final List<GeocodingResult> res = new ArrayList<GeocodingResult>();
|
||||||
// FIXME interpolation
|
// FIXME interpolation
|
||||||
for(GeocodingResult s : streetsList) {
|
if(streetsList.size() == 0) {
|
||||||
final List<GeocodingResult> streetBuildings = new ArrayList<GeocodingResult>();
|
res.add(r);
|
||||||
reader.preloadBuildings(s.street, null);
|
} else {
|
||||||
log.info("Preload buildings " + s.street.getName() + " " + s.city.getName() + " " + s.street.getId());
|
for (GeocodingResult s : streetsList) {
|
||||||
for(Building b : s.street.getBuildings()) {
|
final List<GeocodingResult> streetBuildings = new ArrayList<GeocodingResult>();
|
||||||
if(MapUtils.getDistance(b.getLocation(), r.searchPoint) < DISTANCE_BULDING_PROXIMITY) {
|
reader.preloadBuildings(s.street, null);
|
||||||
GeocodingResult bld = new GeocodingResult(s);
|
log.info("Preload buildings " + s.street.getName() + " " + s.city.getName() + " " + s.street.getId());
|
||||||
bld.building = b;
|
for (Building b : s.street.getBuildings()) {
|
||||||
bld.connectionPoint = b.getLocation();
|
if (MapUtils.getDistance(b.getLocation(), r.searchPoint) < DISTANCE_BULDING_PROXIMITY) {
|
||||||
streetBuildings.add(bld);
|
GeocodingResult bld = new GeocodingResult(s);
|
||||||
}
|
bld.building = b;
|
||||||
}
|
bld.connectionPoint = b.getLocation();
|
||||||
Collections.sort(streetBuildings, DISTANCE_COMPARATOR);
|
streetBuildings.add(bld);
|
||||||
if(streetBuildings.size() > 0) {
|
|
||||||
Iterator<GeocodingResult> it = streetBuildings.iterator();
|
|
||||||
if(knownMinBuidlingDistance == 0) {
|
|
||||||
GeocodingResult firstBld = it.next();
|
|
||||||
knownMinBuidlingDistance = firstBld.getDistance();
|
|
||||||
res.add(firstBld);
|
|
||||||
}
|
|
||||||
while(it.hasNext()) {
|
|
||||||
GeocodingResult nextBld = it.next();
|
|
||||||
if(nextBld.getDistance() > knownMinBuidlingDistance * THRESHOLD_MULTIPLIER_SKIP_BUILDINGS_AFTER) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
res.add(nextBld);
|
|
||||||
}
|
}
|
||||||
|
Collections.sort(streetBuildings, DISTANCE_COMPARATOR);
|
||||||
|
if (streetBuildings.size() > 0) {
|
||||||
|
Iterator<GeocodingResult> it = streetBuildings.iterator();
|
||||||
|
if (knownMinBuidlingDistance == 0) {
|
||||||
|
GeocodingResult firstBld = it.next();
|
||||||
|
knownMinBuidlingDistance = firstBld.getDistance();
|
||||||
|
res.add(firstBld);
|
||||||
|
}
|
||||||
|
while (it.hasNext()) {
|
||||||
|
GeocodingResult nextBld = it.next();
|
||||||
|
if (nextBld.getDistance() > knownMinBuidlingDistance
|
||||||
|
* THRESHOLD_MULTIPLIER_SKIP_BUILDINGS_AFTER) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
res.add(nextBld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.add(s);
|
||||||
}
|
}
|
||||||
res.add(s);
|
|
||||||
}
|
}
|
||||||
Collections.sort(res, DISTANCE_COMPARATOR);
|
Collections.sort(res, DISTANCE_COMPARATOR);
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in a new issue