Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-12-09 23:27:12 +01:00
commit 4586482329
3 changed files with 12 additions and 12 deletions

View file

@ -151,7 +151,7 @@ public class GeocodingUtilities {
List<GeocodingResult> lst = new ArrayList<GeocodingUtilities.GeocodingResult>();
List<RouteSegmentPoint> listR = new ArrayList<BinaryRoutePlanner.RouteSegmentPoint>();
rp.findRouteSegment(lat, lon, ctx, listR);
double dist = 0;
double distSquare = 0;
TLongHashSet set = new TLongHashSet();
Set<String> streetNames = new HashSet<String>();
for(RouteSegmentPoint p : listR) {
@ -161,8 +161,8 @@ public class GeocodingUtilities {
}
boolean emptyName = Algorithms.isEmpty(road.getName()) && Algorithms.isEmpty(road.getRef()) ;
if(!emptyName) {
if(dist == 0 || dist > p.dist) {
dist = p.dist;
if(distSquare == 0 || distSquare > p.distSquare) {
distSquare = p.distSquare;
}
GeocodingResult sr = new GeocodingResult();
sr.searchPoint = new LatLon(lat, lon);
@ -175,11 +175,11 @@ public class GeocodingUtilities {
lst.add(sr);
}
}
if(p.dist > STOP_SEARCHING_STREET_WITH_MULTIPLIER_RADIUS * STOP_SEARCHING_STREET_WITH_MULTIPLIER_RADIUS &&
dist != 0 && p.dist > THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER * dist ) {
if(p.distSquare > STOP_SEARCHING_STREET_WITH_MULTIPLIER_RADIUS * STOP_SEARCHING_STREET_WITH_MULTIPLIER_RADIUS &&
distSquare != 0 && p.distSquare > THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER * distSquare ) {
break;
}
if(p.dist > STOP_SEARCHING_STREET_WITHOUT_MULTIPLIER_RADIUS*STOP_SEARCHING_STREET_WITHOUT_MULTIPLIER_RADIUS) {
if(p.distSquare > STOP_SEARCHING_STREET_WITHOUT_MULTIPLIER_RADIUS*STOP_SEARCHING_STREET_WITHOUT_MULTIPLIER_RADIUS) {
break;
}
}

View file

@ -835,12 +835,12 @@ public class BinaryRoutePlanner {
}
public static class RouteSegmentPoint extends RouteSegment {
public RouteSegmentPoint(RouteDataObject road, int segmentStart, double dist) {
public RouteSegmentPoint(RouteDataObject road, int segmentStart, double distSquare) {
super(road, segmentStart);
this.dist = dist;
this.distSquare = distSquare;
}
public double dist;
public double distSquare;
public int preciseX;
public int preciseY;
public List<RouteSegmentPoint> others;

View file

@ -72,10 +72,10 @@ public class RoutePlannerFrontEnd {
for (int j = 1; j < r.getPointsLength(); j++) {
QuadPoint pr = MapUtils.getProjectionPoint31(px, py, r.getPoint31XTile(j - 1),
r.getPoint31YTile(j - 1), r.getPoint31XTile(j ), r.getPoint31YTile(j ));
double currentsDist = squareDist((int) pr.x, (int)pr.y, px, py);
if (road == null || currentsDist < road.dist) {
double currentsDistSquare = squareDist((int) pr.x, (int)pr.y, px, py);
if (road == null || currentsDistSquare < road.distSquare) {
RouteDataObject ro = new RouteDataObject(r);
road = new RouteSegmentPoint(ro, j, currentsDist);
road = new RouteSegmentPoint(ro, j, currentsDistSquare);
road.preciseX = (int) pr.x;
road.preciseY = (int) pr.y;
}