Skip to content

Commit 1c2fd0d

Browse files
Update src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/routinghelper/HorseTransportMode.java
Co-authored-by: Florian Schäfer <florian@schaeferban.de>
1 parent 3d3cc48 commit 1c2fd0d

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/main/java/org/openstreetmap/josm/plugins/pt_assistant/actions/routinghelper/HorseTransportMode.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ public class HorseTransportMode implements ITransportMode {
2121
@Override
2222
public boolean canTraverseWay(@NotNull final IWay<?> way, @NotNull final WayTraversalDirection direction) {
2323
final String onewayValue = way.get("oneway");
24-
List<String> majorHighways = Arrays.asList(
25-
"tertiary", "secondary", "primary", "trunk");
26-
majorHighways.forEach(v -> majorHighways.add(String.format("%s_link", v)));
27-
// This list is ordered from most suitable to least suitable
28-
List<String> suitableHighwaysForHorseRiders = Arrays.asList(
29-
"bridleway", "pedestrian", "footway", "path", "track", "living_street", "residential", "unclassified", "cyclestreet", "service", "cycleway");
30-
suitableHighwaysForHorseRiders.addAll(majorHighways); // TODO do this only once when plugin starts
24+
final List<String> suitableHighwaysForHorseRiders = Stream.concat(
25+
// This list is ordered from most suitable to least suitable
26+
Stream.of("bridleway", "pedestrian", "footway", "path", "track", "living_street", "residential", "unclassified", "cyclestreet", "service", "cycleway"),
27+
Stream.of("tertiary", "secondary", "primary", "trunk").flatMap(it -> Stream.of(it, it + "_link"))
28+
).collect(Collectors.toList());
3129
return !way.hasTag("horse", "no") &&
3230
(way.hasTag("highway", suitableHighwaysForHorseRiders) ||
3331
way.hasTag("horse", "yes"))

0 commit comments

Comments
 (0)