Add road shield

This commit is contained in:
Victor Shcherb 2020-05-13 15:44:04 +02:00
parent 75b8b0de3a
commit 733dfc3027
4 changed files with 28 additions and 26 deletions

View file

@ -1011,6 +1011,17 @@ public class RouteDataObject {
rf == null ? "" : rf);
}
public boolean hasNameTagStartsWith(String tagStartsWith) {
int[] nextSegmentNameIds = nameIds;
for (int nm = 0; nm < nameIds.length; nm++) {
RouteTypeRule rtr = region.quickGetEncodingRule(nameIds[nm]);
if (rtr != null && rtr.getTag().startsWith(tagStartsWith)) {
return true;
}
}
return false;
}
public static class RestrictionInfo {
public int type;
public long toWay;

View file

@ -230,6 +230,7 @@ public class RouteCalculationResult {
RouteDirectionInfo info = new RouteDirectionInfo(localDirections.get(currentDirection).getAverageSpeed(), TurnType.straight());
info.setRef(toSplit.getRef());
info.setStreetName(toSplit.getStreetName());
info.setRouteDataObject(toSplit.getRouteDataObject());
info.setDestinationName(toSplit.getDestinationName());
info.routePointOffset = interLocations[currentIntermediate];
info.setDescriptionRoute(ctx.getString(R.string.route_head));//; //$NON-NLS-1$
@ -412,32 +413,17 @@ public class RouteCalculationResult {
if (ref != null) {
RouteDataObject nextRoad = next.getObject();
boolean isNextShieldFound = false;
int[] nextSegmentNameIds = nextRoad.nameIds;
for (int nm = 0; nm < nextSegmentNameIds.length; nm++) {
if (nextRoad.region.quickGetEncodingRule(nextSegmentNameIds[nm]).getTag().startsWith("road_ref")) {
info.setRouteDataObject(nextRoad);
isNextShieldFound = true;
}
}
info.setRouteDataObject(nextRoad);
if (!isNextShieldFound) {
for (int ind = lind; ind < list.size(); ind++) {
if (list.get(ind).getTurnType() != null) {
info.setRouteDataObject(null);
break;
} else {
RouteDataObject obj = list.get(ind).getObject();
int[] nameIds = obj.nameIds;
for (int idx = 0; idx < nameIds.length; idx ++) {
if (obj.region.routeEncodingRules.get(obj.nameIds[idx]).getTag().startsWith("road_ref")) {
info.setRouteDataObject(obj);
break;
}
}
if (info.getRouteDataObject() != null) {
break;
}
boolean isNextShieldFound = nextRoad.hasNameTagStartsWith("road_ref");
for (int ind = lind; ind < list.size() && !isNextShieldFound; ind++) {
if (list.get(ind).getTurnType() != null) {
isNextShieldFound = true;
} else {
RouteDataObject obj = list.get(ind).getObject();
if (obj.hasNameTagStartsWith("road_ref")) {
info.setRouteDataObject(obj);
isNextShieldFound = true;
}
}
}
@ -787,6 +773,7 @@ public class RouteCalculationResult {
if (segs != null) {
RouteSegmentResult lastSegmentResult = segs.get(segs.size() - 1);
RouteDataObject routeDataObject = lastSegmentResult.getObject();
info.setRouteDataObject(routeDataObject);
info.setRef(routeDataObject.getRef(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
ctx.getSettings().MAP_TRANSLITERATE_NAMES.get(), lastSegmentResult.isForwardDirection()));
info.setStreetName(routeDataObject.getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
@ -1143,6 +1130,7 @@ public class RouteCalculationResult {
p = new RouteDirectionInfo(i.getAverageSpeed(), i.getTurnType());
p.routePointOffset = i.routePointOffset;
p.routeEndPointOffset = i.routeEndPointOffset;
p.setRouteDataObject(i.getRouteDataObject());
p.setDestinationName(i.getDestinationName());
p.setRef(i.getRef());
p.setStreetName(i.getStreetName());

View file

@ -480,7 +480,7 @@ public class RouteProvider {
ch.routeEndPointOffset = info.routeEndPointOffset - startI[0];
}
ch.setDescriptionRoute(info.getDescriptionRoutePart());
ch.setRouteDataObject(info.getRouteDataObject());
// Issue #2894
if (info.getRef() != null && !"null".equals(info.getRef())) {
ch.setRef(info.getRef());

View file

@ -1144,6 +1144,9 @@ public class MapInfoWidgetsFactory {
additional.append(key).append("=").append(val).append(";");
}
}
if(name == null || nameTag == null) {
return false;
}
Context context = topBar.getContext();
int[] tps = object.getTypes();