Skip to content

Commit

Permalink
vector tile: update/restore edge styles
Browse files Browse the repository at this point in the history
  • Loading branch information
flaktack committed Nov 7, 2024
1 parent 14cef7c commit 3415473
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber;
import org.opentripplanner.apis.vectortiles.model.ZoomDependentNumber.ZoomStop;
import org.opentripplanner.service.vehiclerental.street.StreetVehicleRentalLink;
import org.opentripplanner.service.vehiclerental.street.VehicleRentalPlaceVertex;
import org.opentripplanner.street.model.StreetTraversalPermission;
import org.opentripplanner.street.model.edge.AreaEdge;
import org.opentripplanner.street.model.edge.BoardingLocationToStopLink;
Expand Down Expand Up @@ -50,7 +49,6 @@ public class DebugStyleSpec {
private static final String DARK_GREEN = "#136b04";
private static final String PURPLE = "#BC55F2";
private static final String BLACK = "#140d0e";
private static final String GRAY = "#DDDDDD";

private static final int MAX_ZOOM = 23;
private static final int LINE_DETAIL_ZOOM = 13;
Expand Down Expand Up @@ -197,7 +195,8 @@ private static List<StyleBuilder> edges(VectorSourceLayer edges) {
.group(EDGES_GROUP)
.typeLine()
.vectorSourceLayer(edges)
.lineColor(GRAY)
.lineColor(MAGENTA)
.edgeFilter(EDGES_TO_DISPLAY)
.lineWidth(LINE_HALF_WIDTH)
.lineOffset(LINE_OFFSET)
.minZoom(6)
Expand All @@ -209,6 +208,7 @@ private static List<StyleBuilder> edges(VectorSourceLayer edges) {
.typeSymbol()
.lineText("name")
.vectorSourceLayer(edges)
.edgeFilter(EDGES_TO_DISPLAY)
.minZoom(17)
.maxZoom(MAX_ZOOM)
.intiallyHidden(),
Expand All @@ -217,8 +217,7 @@ private static List<StyleBuilder> edges(VectorSourceLayer edges) {
.group(EDGES_GROUP)
.typeLine()
.vectorSourceLayer(edges)
.lineColor(GRAY)
.lineOpacity(0.2f)
.lineColor(BRIGHT_GREEN)
.edgeFilter(
StreetTransitStopLink.class,
StreetTransitEntranceLink.class,
Expand Down Expand Up @@ -316,11 +315,11 @@ private static List<StyleBuilder> noThruTraffic(VectorSourceLayer edges) {
private static List<String> permissionColors() {
return Arrays
.stream(StreetTraversalPermission.values())
.flatMap(p -> Stream.of(streetPermissionAsString(p), permissionColors(p)))
.flatMap(p -> Stream.of(streetPermissionAsString(p), permissionColor(p)))
.toList();
}

private static String permissionColors(StreetTraversalPermission p) {
private static String permissionColor(StreetTraversalPermission p) {
return switch (p) {
case NONE -> BLACK;
case PEDESTRIAN -> "#2ba812";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"minzoom" : 6,
"maxzoom" : 23,
"paint" : {
"line-color" : "#DDDDDD",
"line-color" : "#f21d52",
"line-width" : [
"interpolate",
[
Expand Down Expand Up @@ -63,6 +63,17 @@
7.0
]
},
"filter" : [
"in",
"class",
"StreetEdge",
"AreaEdge",
"EscalatorEdge",
"PathwayEdge",
"ElevatorHopEdge",
"TemporaryPartialStreetEdge",
"TemporaryFreeEdge"
],
"layout" : {
"line-cap" : "round",
"visibility" : "none"
Expand All @@ -84,6 +95,17 @@
"text-halo-blur" : 4,
"text-halo-width" : 3
},
"filter" : [
"in",
"class",
"StreetEdge",
"AreaEdge",
"EscalatorEdge",
"PathwayEdge",
"ElevatorHopEdge",
"TemporaryPartialStreetEdge",
"TemporaryFreeEdge"
],
"layout" : {
"symbol-placement" : "line-center",
"symbol-spacing" : 1000,
Expand Down Expand Up @@ -122,8 +144,7 @@
"minzoom" : 13,
"maxzoom" : 23,
"paint" : {
"line-color" : "#DDDDDD",
"line-opacity" : 0.2,
"line-color" : "#22DD9E",
"line-width" : [
"interpolate",
[
Expand Down Expand Up @@ -197,7 +218,7 @@
"#e25f8f",
"BICYCLE CAR",
"#e25f8f",
"PEDESTRIAN BICYCLE CAR",
"ALL",
"#adb2b0",
"#140d0e"
],
Expand Down Expand Up @@ -229,13 +250,27 @@
]
},
"filter" : [
"in",
"PEDESTRIAN",
"any",
[
"string",
"in",
"PEDESTRIAN",
[
"get",
"permission"
"string",
[
"get",
"permission"
]
]
],
[
"in",
"ALL",
[
"string",
[
"get",
"permission"
]
]
]
],
Expand Down Expand Up @@ -275,7 +310,7 @@
"#e25f8f",
"BICYCLE CAR",
"#e25f8f",
"PEDESTRIAN BICYCLE CAR",
"ALL",
"#adb2b0",
"#140d0e"
],
Expand Down Expand Up @@ -307,13 +342,27 @@
]
},
"filter" : [
"in",
"BICYCLE",
"any",
[
"string",
"in",
"BICYCLE",
[
"get",
"permission"
"string",
[
"get",
"permission"
]
]
],
[
"in",
"ALL",
[
"string",
[
"get",
"permission"
]
]
]
],
Expand Down Expand Up @@ -353,7 +402,7 @@
"#e25f8f",
"BICYCLE CAR",
"#e25f8f",
"PEDESTRIAN BICYCLE CAR",
"ALL",
"#adb2b0",
"#140d0e"
],
Expand Down Expand Up @@ -385,13 +434,27 @@
]
},
"filter" : [
"in",
"CAR",
"any",
[
"string",
"in",
"CAR",
[
"get",
"permission"
"string",
[
"get",
"permission"
]
]
],
[
"in",
"ALL",
[
"string",
[
"get",
"permission"
]
]
]
],
Expand Down Expand Up @@ -489,7 +552,7 @@
"#e25f8f",
"BICYCLE CAR",
"#e25f8f",
"PEDESTRIAN BICYCLE CAR",
"ALL",
"#adb2b0",
"#140d0e"
],
Expand Down Expand Up @@ -521,13 +584,27 @@
]
},
"filter" : [
"in",
"PEDESTRIAN",
"any",
[
"string",
"in",
"PEDESTRIAN",
[
"get",
"noThruTraffic"
"string",
[
"get",
"noThruTraffic"
]
]
],
[
"in",
"ALL",
[
"string",
[
"get",
"noThruTraffic"
]
]
]
],
Expand Down Expand Up @@ -567,7 +644,7 @@
"#e25f8f",
"BICYCLE CAR",
"#e25f8f",
"PEDESTRIAN BICYCLE CAR",
"ALL",
"#adb2b0",
"#140d0e"
],
Expand Down Expand Up @@ -599,13 +676,27 @@
]
},
"filter" : [
"in",
"BICYCLE",
"any",
[
"string",
"in",
"BICYCLE",
[
"get",
"noThruTraffic"
"string",
[
"get",
"noThruTraffic"
]
]
],
[
"in",
"ALL",
[
"string",
[
"get",
"noThruTraffic"
]
]
]
],
Expand Down Expand Up @@ -645,7 +736,7 @@
"#e25f8f",
"BICYCLE CAR",
"#e25f8f",
"PEDESTRIAN BICYCLE CAR",
"ALL",
"#adb2b0",
"#140d0e"
],
Expand Down Expand Up @@ -677,13 +768,27 @@
]
},
"filter" : [
"in",
"CAR",
"any",
[
"string",
"in",
"CAR",
[
"get",
"noThruTraffic"
"string",
[
"get",
"noThruTraffic"
]
]
],
[
"in",
"ALL",
[
"string",
[
"get",
"noThruTraffic"
]
]
]
],
Expand Down

0 comments on commit 3415473

Please sign in to comment.