Formatting

This commit is contained in:
Victor Shcherb 2020-02-24 12:38:59 +01:00
parent b0a7b61b92
commit 89504b92df

View file

@ -34,13 +34,8 @@ import static net.osmand.binary.RouteDataObject.HEIGHT_UNDEFINED;
public class RouteCalculationResult { public class RouteCalculationResult {
private final static Log log = PlatformUtil.getLog(RouteCalculationResult.class); private final static Log log = PlatformUtil.getLog(RouteCalculationResult.class);
/** // Evaluates street name that the route follows after turn within specified distance.
* When generating list of directions from segments, algorithm attempts to evaluate street names // It is useful to find names for short segments on intersections and roundabouts.
* that follow the route after turn. It's quite often segments follow roundabout exit refer to
* unnamed road, so algorithm scans several segments following the exit to find out the street
* name.
* Maximum distance to scan in meter is specified by this parameter.
*/
private static float distanceSeekStreetName = 150; private static float distanceSeekStreetName = 150;
private static double distanceClosestToIntermediate = 3000; private static double distanceClosestToIntermediate = 3000;
@ -377,21 +372,19 @@ public class RouteCalculationResult {
info.setRef(ref); info.setRef(ref);
String streetName = next.getObject().getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(), String streetName = next.getObject().getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
ctx.getSettings().MAP_TRANSLITERATE_NAMES.get()); ctx.getSettings().MAP_TRANSLITERATE_NAMES.get());
if(Algorithms.isEmpty(streetName)) { if (Algorithms.isEmpty(streetName)) {
// try to get street names from following segments // try to get street names from following segments
float distanceFromTurn = next.getDistance(); float distanceFromTurn = next.getDistance();
for(int n = lind+1; n+1 < list.size(); n++) { for (int n = lind + 1; n + 1 < list.size(); n++) {
RouteSegmentResult s1 = list.get(n); RouteSegmentResult s1 = list.get(n);
if(s1.getTurnType() != null) // scan the list only until the next turn
break; // scan the list only until the next turn if (s1.getTurnType() != null || distanceFromTurn > distanceSeekStreetName ||
!Algorithms.isEmpty(streetName)) {
break;
}
streetName = s1.getObject().getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(), streetName = s1.getObject().getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
ctx.getSettings().MAP_TRANSLITERATE_NAMES.get()); ctx.getSettings().MAP_TRANSLITERATE_NAMES.get());
if(!Algorithms.isEmpty(streetName)) distanceFromTurn += s1.getDistance();
break;
if(0 < s1.getDistance())
distanceFromTurn += s1.getDistance();
if(distanceFromTurn > distanceSeekStreetName)
break;
} }
} }
info.setStreetName(streetName); info.setStreetName(streetName);