diff --git a/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java index f821f7c0e82..999b90a8bbd 100644 --- a/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/DebugStyleSpec.java @@ -244,7 +244,11 @@ private static List traversalPermissions(VectorSourceLayer edges) .vectorSourceLayer(edges) .group(PERMISSIONS_GROUP) .typeLine() - .filterValueInProperty(streetTraversalPermission.name(), "permission") + .filterValueInProperty( + "permission", + streetTraversalPermission.name(), + StreetTraversalPermission.ALL.name() + ) .lineCap("butt") .lineColorMatch("permission", permissionColors(), BLACK) .lineWidth(LINE_WIDTH) @@ -279,7 +283,11 @@ private static List noThruTraffic(VectorSourceLayer edges) { .vectorSourceLayer(edges) .group(NO_THRU_TRAFFIC_GROUP) .typeLine() - .filterValueInProperty(streetTraversalPermission.name(), "noThruTraffic") + .filterValueInProperty( + "noThruTraffic", + streetTraversalPermission.name(), + StreetTraversalPermission.ALL.name() + ) .lineCap("butt") .lineColorMatch("noThruTraffic", permissionColors(), BLACK) .lineWidth(LINE_WIDTH) diff --git a/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java index c2b9c2a9d22..d84ee0f533d 100644 --- a/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java +++ b/application/src/main/java/org/opentripplanner/apis/vectortiles/model/StyleBuilder.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashMap; @@ -11,7 +12,6 @@ import java.util.stream.Stream; import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber.ZoomStop; import org.opentripplanner.framework.json.ObjectMappers; -import org.opentripplanner.street.model.StreetTraversalPermission; import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.utils.collection.ListUtils; @@ -250,14 +250,6 @@ public final StyleBuilder edgeFilter(Class... classToFilter) { return filterClasses(classToFilter); } - /** - * Filter the entities by their "permission" property. - */ - public final StyleBuilder permissionsFilter(StreetTraversalPermission p) { - filter = List.of("==", "permission", p.name()); - return this; - } - /** * Only apply the style to the given vertices. */ @@ -266,8 +258,13 @@ public final StyleBuilder vertexFilter(Class... classToFilter) return filterClasses(classToFilter); } - public StyleBuilder filterValueInProperty(String value, String propertyName) { - filter = List.of("in", value, List.of("string", List.of("get", propertyName))); + public StyleBuilder filterValueInProperty(String propertyName, String... values) { + var newFilter = new ArrayList<>(); + newFilter.add("any"); + for (String value : values) { + newFilter.add(List.of("in", value, List.of("string", List.of("get", propertyName)))); + } + filter = newFilter; return this; } diff --git a/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java b/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java index 70041c6f5b4..d6e2d7250ea 100644 --- a/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java +++ b/application/src/main/java/org/opentripplanner/inspector/vector/edge/EdgePropertyMapper.java @@ -43,11 +43,7 @@ private static List mapStreetEdge(StreetEdge se) { } public static String streetPermissionAsString(StreetTraversalPermission permission) { - return ( - permission == StreetTraversalPermission.ALL - ? "PEDESTRIAN_AND_BICYCLE_AND_CAR" - : permission.toString() - ).replace("_AND_", " "); + return permission.name().replace("_AND_", " "); } private static String noThruTrafficAsString(StreetEdge se) {