fine tune "Near" criterion for reverese geocoding
This commit is contained in:
parent
0644b82aa6
commit
188e21935b
2 changed files with 18 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
package net.osmand.binary;
|
||||
package net.osmand.binary;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.ResultMatcher;
|
||||
|
@ -124,7 +124,15 @@ public class GeocodingUtilities {
|
|||
}
|
||||
return dist;
|
||||
}
|
||||
|
||||
|
||||
public double getDistanceP() {
|
||||
if(point != null && searchPoint != null) {
|
||||
return MapUtils.getDistance(point, searchPoint);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder bld = new StringBuilder();
|
||||
|
|
|
@ -164,6 +164,8 @@ public abstract class MenuTitleController {
|
|||
OsmandSettings settings = getMapActivity().getMyApplication().getSettings();
|
||||
String lang = settings.MAP_PREFERRED_LOCALE.get();
|
||||
String geocodingResult = "";
|
||||
double relevantDistance = -1;
|
||||
|
||||
if (object.building != null) {
|
||||
String bldName = object.building.getName(lang);
|
||||
if (!Algorithms.isEmpty(object.buildingInterpolation)) {
|
||||
|
@ -173,6 +175,7 @@ public abstract class MenuTitleController {
|
|||
+ object.city.getName(lang);
|
||||
} else if (object.street != null) {
|
||||
geocodingResult = object.street.getName(lang) + ", " + object.city.getName(lang);
|
||||
relevantDistance = object.getDistanceP();
|
||||
} else if (object.city != null) {
|
||||
geocodingResult = object.city.getName(lang);
|
||||
} else if (object.point != null) {
|
||||
|
@ -189,11 +192,15 @@ public abstract class MenuTitleController {
|
|||
sname += ref;
|
||||
}
|
||||
geocodingResult = sname;
|
||||
relevantDistance = object.getDistanceP();
|
||||
}
|
||||
|
||||
streetStr = geocodingResult;
|
||||
if (relevantDistance == -1) {
|
||||
relevantDistance = object.getDistance();
|
||||
}
|
||||
|
||||
if (!Algorithms.isEmpty(streetStr) && object.getDistance() > 100) {
|
||||
if (!Algorithms.isEmpty(streetStr) && relevantDistance > 100) {
|
||||
streetStr = getMapActivity().getString(R.string.shared_string_near) + " " + streetStr;
|
||||
} else if (Algorithms.isEmpty(streetStr)) {
|
||||
streetStr = getMapActivity().getString(R.string.no_address_found);
|
||||
|
|
Loading…
Reference in a new issue