Skip to content

Commit

Permalink
Update src/main/java/org/openstreetmap/josm/plugins/pt_assistant/acti…
Browse files Browse the repository at this point in the history
…ons/routinghelper/HorseTransportMode.java

Co-authored-by: Florian Schäfer <[email protected]>
  • Loading branch information
PolyglotOpenstreetmap and floscher authored Nov 16, 2020
1 parent 3d3cc48 commit 1c2fd0d
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ public class HorseTransportMode implements ITransportMode {
@Override
public boolean canTraverseWay(@NotNull final IWay<?> way, @NotNull final WayTraversalDirection direction) {
final String onewayValue = way.get("oneway");
List<String> majorHighways = Arrays.asList(
"tertiary", "secondary", "primary", "trunk");
majorHighways.forEach(v -> majorHighways.add(String.format("%s_link", v)));
// This list is ordered from most suitable to least suitable
List<String> suitableHighwaysForHorseRiders = Arrays.asList(
"bridleway", "pedestrian", "footway", "path", "track", "living_street", "residential", "unclassified", "cyclestreet", "service", "cycleway");
suitableHighwaysForHorseRiders.addAll(majorHighways); // TODO do this only once when plugin starts
final List<String> suitableHighwaysForHorseRiders = Stream.concat(
// This list is ordered from most suitable to least suitable
Stream.of("bridleway", "pedestrian", "footway", "path", "track", "living_street", "residential", "unclassified", "cyclestreet", "service", "cycleway"),
Stream.of("tertiary", "secondary", "primary", "trunk").flatMap(it -> Stream.of(it, it + "_link"))
).collect(Collectors.toList());
return !way.hasTag("horse", "no") &&
(way.hasTag("highway", suitableHighwaysForHorseRiders) ||
way.hasTag("horse", "yes"))
Expand Down

0 comments on commit 1c2fd0d

Please sign in to comment.