Skip to content

Commit

Permalink
inspector vector tiles: render parallel edges
Browse files Browse the repository at this point in the history
The style offsets the edges so that the directions may be
differentiated.
  • Loading branch information
flaktack committed Oct 9, 2024
1 parent 8ffcc55 commit b7563d6
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public class DebugStyleSpec {
1.3f,
List.of(new ZoomStop(13, 0.5f), new ZoomStop(MAX_ZOOM, 10))
);
private static final ZoomDependentNumber LINE_OFFSET = new ZoomDependentNumber(
1.3f,
List.of(new ZoomStop(13, 0.3f), new ZoomStop(MAX_ZOOM, 6))
);
private static final ZoomDependentNumber CIRCLE_STROKE = new ZoomDependentNumber(
1,
List.of(new ZoomStop(15, 0.2f), new ZoomStop(MAX_ZOOM, 3))
Expand Down Expand Up @@ -88,6 +92,7 @@ static StyleSpec build(
.lineColor(MAGENTA)
.edgeFilter(EDGES_TO_DISPLAY)
.lineWidth(LINE_WIDTH)
.lineOffset(LINE_OFFSET)
.minZoom(6)
.maxZoom(MAX_ZOOM)
.intiallyHidden(),
Expand All @@ -114,6 +119,7 @@ static StyleSpec build(
StreetStationCentroidLink.class
)
.lineWidth(LINE_WIDTH)
.lineOffset(LINE_OFFSET)
.minZoom(13)
.maxZoom(MAX_ZOOM)
.intiallyHidden(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ public StyleBuilder lineWidth(ZoomDependentNumber zoomStops) {
return this;
}

public StyleBuilder lineOffset(ZoomDependentNumber zoomStops) {
paint.put("line-offset", zoomStops.toJson());
return this;
}

public StyleBuilder fillColor(String color) {
paint.put("fill-color", validateColor(color));
return this;
Expand Down
26 changes: 26 additions & 0 deletions src/test/resources/org/opentripplanner/apis/vectortiles/style.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@
10.0
]
]
},
"line-offset" : {
"base" : 1.3,
"stops" : [
[
13,
0.3
],
[
23,
6.0
]
]
}
},
"filter" : [
Expand Down Expand Up @@ -134,6 +147,19 @@
10.0
]
]
},
"line-offset" : {
"base" : 1.3,
"stops" : [
[
13,
0.3
],
[
23,
6.0
]
]
}
},
"filter" : [
Expand Down

0 comments on commit b7563d6

Please sign in to comment.