introduce destination:forward/backward support
This commit is contained in:
parent
665639bdc6
commit
d2d08addc0
7 changed files with 13 additions and 12 deletions
|
@ -236,7 +236,7 @@ public class BinaryMapRouteReaderAdapter {
|
|||
nameTypeRule = id;
|
||||
} else if (tags.equals("ref")) {
|
||||
refTypeRule = id;
|
||||
} else if (tags.equals("destination")) {
|
||||
} else if (tags.equals("destination") || tags.equals("destination:forward") || tags.equals("destination:backward")) {
|
||||
destinationTypeRule = id;
|
||||
} else if (tags.equals("destination:ref")) {
|
||||
destinationRefTypeRule = id;
|
||||
|
|
|
@ -109,20 +109,21 @@ public class RouteDataObject {
|
|||
return null;
|
||||
}
|
||||
|
||||
public String getDestinationName(String lang){
|
||||
public String getDestinationName(String lang, boolean direction){
|
||||
if(names != null) {
|
||||
if(Algorithms.isEmpty(lang)) {
|
||||
return names.get(region.destinationTypeRule);
|
||||
}
|
||||
int[] kt = names.keys();
|
||||
String destinationTag = (direction == true) ? "destination:forward" : "destination:backward";
|
||||
if(!Algorithms.isEmpty(lang)) {
|
||||
destinationTag = "destination:" + lang;
|
||||
}
|
||||
|
||||
for(int i = 0 ; i < kt.length; i++) {
|
||||
int k = kt[i];
|
||||
if(region.routeEncodingRules.size() > k) {
|
||||
if(("destination:"+lang).equals(region.routeEncodingRules.get(k).getTag())) {
|
||||
if(destinationTag.equals(region.routeEncodingRules.get(k).getTag())) {
|
||||
return names.get(k);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return names.get(region.destinationTypeRule);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class AvoidSpecificRoads {
|
|||
|
||||
protected String getText(RouteDataObject obj) {
|
||||
return RoutingHelper.formatStreetName(obj.getName(app.getSettings().MAP_PREFERRED_LOCALE.get()),
|
||||
obj.getRef(), obj.getDestinationName(app.getSettings().MAP_PREFERRED_LOCALE.get()), app.getString(R.string.towards));
|
||||
obj.getRef(), obj.getDestinationName(app.getSettings().MAP_PREFERRED_LOCALE.get(), true), app.getString(R.string.towards));
|
||||
}
|
||||
|
||||
public void showDialog(@NonNull final MapActivity mapActivity) {
|
||||
|
|
|
@ -255,7 +255,7 @@ public class RouteCalculationResult {
|
|||
RouteSegmentResult next = list.get(lind);
|
||||
info.setRef(next.getObject().getRef());
|
||||
info.setStreetName(next.getObject().getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get()));
|
||||
info.setDestinationName(next.getObject().getDestinationName(ctx.getSettings().MAP_PREFERRED_LOCALE.get()));
|
||||
info.setDestinationName(next.getObject().getDestinationName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(), next.isForwardDirection()));
|
||||
}
|
||||
|
||||
String description = toString(turn, ctx) + " " + RoutingHelper.formatStreetName(info.getStreetName(),
|
||||
|
|
|
@ -761,7 +761,7 @@ public class RoutingHelper {
|
|||
if(rs != null) {
|
||||
String nm = rs.getObject().getName(settings.MAP_PREFERRED_LOCALE.get());
|
||||
String rf = rs.getObject().getRef();
|
||||
String dn = rs.getObject().getDestinationName(settings.MAP_PREFERRED_LOCALE.get());
|
||||
String dn = rs.getObject().getDestinationName(settings.MAP_PREFERRED_LOCALE.get(), rs.isForwardDirection());
|
||||
return formatStreetName(nm, rf, dn, "»");
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -588,7 +588,7 @@ public class VoiceRouter {
|
|||
RouteDataObject obj = currentSegment.getObject();
|
||||
current = new Struct(new Term[] { getTermString(getSpeakablePointName(obj.getRef())),
|
||||
getTermString(getSpeakablePointName(obj.getName(settings.MAP_PREFERRED_LOCALE.get()))),
|
||||
getTermString(getSpeakablePointName(obj.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()))) });
|
||||
getTermString(getSpeakablePointName(obj.getDestinationName(settings.MAP_PREFERRED_LOCALE.get(), currentSegment.isForwardDirection()))) });
|
||||
} else {
|
||||
RouteDataObject obj = currentSegment.getObject();
|
||||
current = new Struct(new Term[] { getTermString(getSpeakablePointName(obj.getRef())),
|
||||
|
|
|
@ -581,7 +581,7 @@ public class MapInfoWidgetsFactory {
|
|||
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
||||
if (rt != null) {
|
||||
text = RoutingHelper.formatStreetName(rt.getName(settings.MAP_PREFERRED_LOCALE.get()),
|
||||
rt.getRef(), rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()), "»");
|
||||
rt.getRef(), rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get(), rt.bearingVsRouteDirection(locationProvider.getLastKnownLocation())), "»");
|
||||
}
|
||||
if (text == null) {
|
||||
text = "";
|
||||
|
|
Loading…
Reference in a new issue