Fix formatting

This commit is contained in:
Victor Shcherb 2016-07-24 23:15:55 +02:00
parent e15a9bb3a2
commit cb6009ecff
2 changed files with 15 additions and 1 deletions

View file

@ -294,7 +294,13 @@ public class SearchUICore {
if(st1 != st2) { if(st1 != st2) {
return Algorithms.compare(st1, st2); return Algorithms.compare(st1, st2);
} }
return collator.compare(o1.localeName, o2.localeName); cmp = collator.compare(o1.localeName, o2.localeName);
if(cmp != 0) {
return cmp;
}
s1 = o1.getSearchDistance(loc, 1);
s2 = o2.getSearchDistance(loc, 1);
return Double.compare(s1, s2);
} }
}); });
} }

View file

@ -42,6 +42,14 @@ public class SearchResult {
return priority - 1 / (1 + priorityDistance * distance); return priority - 1 / (1 + priorityDistance * distance);
} }
public double getSearchDistance(LatLon location, double pd) {
double distance = 0;
if (location != null && this.location != null) {
distance = MapUtils.getDistance(location, this.location);
}
return priority - 1 / (1 + pd * distance);
}
public LatLon location; public LatLon location;
public int preferredZoom = 15; public int preferredZoom = 15;
public String localeName; public String localeName;