Skip to content

Commit

Permalink
Fix destination shields creating
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanPyrohivskyi committed Nov 29, 2024
1 parent 0e45fd5 commit 50f50f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions OsmAnd/src/net/osmand/plus/routing/CurrentStreetName.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ public boolean setupStreetName(@NonNull NextDirectionInfo info) {
} else {
shields = RoadShield.create(dataObject);
}
if (shields.isEmpty()) {
destinationName = info.directionInfo.getDestinationRefAndName();
}
text = RoutingHelperUtils.formatStreetName(name, ref, destinationName, "", shields);
turnType = info.directionInfo.getTurnType();
if (turnType == null) {
Expand Down
7 changes: 5 additions & 2 deletions OsmAnd/src/net/osmand/plus/routing/RoadShield.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static List<RoadShield> create(@Nullable RouteDataObject rdo) {
public static List<RoadShield> createDestination(@Nullable RouteDataObject rdo, RouteDirectionInfo info) {
List<RoadShield> shields = create(rdo);
String destRef = info.getDestinationRef();
if (rdo != null && !Algorithms.isEmpty(destRef)) {
if (rdo != null && !Algorithms.isEmpty(destRef) && !shields.isEmpty()) {
String refs = Algorithms.splitAndClearRepeats(destRef, ";");
List<String> split = Arrays.asList(refs.split(";"));
Map<String, RoadShield> map = new HashMap<>();
Expand All @@ -68,10 +68,13 @@ public static List<RoadShield> createDestination(@Nullable RouteDataObject rdo,
}

shields.clear();
if (tag == null) {
return shields;
}
for (String s : split) {
RoadShield shield = map.get(s);
if (shield == null) {
shield = new RoadShield(rdo, tag == null ? "route_road_" + s.length() + "_ref" : tag, s);
shield = new RoadShield(rdo, tag, s);
shield.additional = additional;
}
shields.add(shield);
Expand Down

0 comments on commit 50f50f5

Please sign in to comment.