Add road shield
This commit is contained in:
parent
75b8b0de3a
commit
733dfc3027
4 changed files with 28 additions and 26 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isNextShieldFound) {
|
||||
for (int ind = lind; ind < list.size(); ind++) {
|
||||
boolean isNextShieldFound = nextRoad.hasNameTagStartsWith("road_ref");
|
||||
for (int ind = lind; ind < list.size() && !isNextShieldFound; ind++) {
|
||||
if (list.get(ind).getTurnType() != null) {
|
||||
info.setRouteDataObject(null);
|
||||
break;
|
||||
isNextShieldFound = true;
|
||||
} 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")) {
|
||||
if (obj.hasNameTagStartsWith("road_ref")) {
|
||||
info.setRouteDataObject(obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (info.getRouteDataObject() != null) {
|
||||
break;
|
||||
}
|
||||
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());
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue