Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback name for corridors #6303

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ public void populateProperties(WayPropertySet props) {
props.setSlopeOverride(new BestMatchSpecifier("indoor=yes"), true);
}

public void populateNotesAndNames(WayPropertySet props) {
static void populateNotesAndNames(WayPropertySet props) {
/* and the notes */
// TODO: The curly brackets in the string below mean that the CreativeNamer should substitute in OSM tag values.
// However they are not taken into account when passed to the translation function.
Expand Down Expand Up @@ -667,6 +667,7 @@ public void populateNotesAndNames(WayPropertySet props) {
props.createNames("highway=footway", "name.pedestrian_path");
props.createNames("highway=bridleway", "name.bridleway");
props.createNames("highway=footway;bicycle=no", "name.pedestrian_path");
props.createNames("highway=corridor", "name.corridor");

// Platforms
props.createNames("otp:route_ref=*", "name.otp_route_ref");
Expand Down
1 change: 1 addition & 0 deletions application/src/main/resources/WayProperties.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name.pedestrian_path=path
name.pedestrian_area=open area
name.path=path
name.bridleway=bridleway
name.corridor=corridor

name.otp_route_ref=Route {otp:route_ref}
name.platform_ref=Platform {ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ name.pedestrian_path=Fu\u00dfweg
name.pedestrian_area=Fu\u00dfg\u00e4ngerzone
name.path=Weg
name.bridleway=Reitweg
name.corridor=Korridor

name.otp_route_ref=Route {otp:route_ref}
name.platform_ref=Plattform {ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name.pedestrian_path=polku
name.pedestrian_area=aukio
name.path=polku
name.bridleway=ratsupolku
name.corridor=käytävä

name.otp_route_ref=linja {otp:route_ref}
name.platform_ref=laituri {ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ name.pedestrian_path=chemin pi\u00e9tonnier
name.pedestrian_area=plateau pi\u00e9tonnier
name.path=chemin
name.bridleway=sentier \u00e9questre
name.corridor=couloir

name.otp_route_ref=Ligne {otp:route_ref}
name.platform_ref=Plate-forme {ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name.pedestrian_path=gyalog\u00FAt
name.pedestrian_area=t\u00E9r
name.path=path
name.bridleway=nyomvonal
name.corridor=folyoso

name.otp_route_ref={otp:route_ref}
name.platform_ref={ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ name.pedestrian_path=voetpad
name.pedestrian_area=open ruimte
name.path=pad
name.bridleway=ruiterpad
name.corridor=gang

name.otp_route_ref=Lijn {otp:route_ref}
name.platform_ref=Spoor {ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name.pedestrian_path=gangvei
name.pedestrian_area=plass
name.path=sti
name.bridleway=bridleway
name.corridor=korridor

name.otp_route_ref=Rute {otp:route_ref}
name.platform_ref=Plattform {ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name.pedestrian_path=gångbanan
name.pedestrian_area=torget
name.path=stigen
name.bridleway=ridvägem
name.corridor=korridor

name.otp_route_ref=linje {otp:route_ref}
name.platform_ref=plattform {ref}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static org.opentripplanner.street.model.StreetTraversalPermission.CAR;

import java.util.List;
import java.util.Locale;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -184,19 +185,33 @@ public static List<OsmWithTags> roadCases() {
@ParameterizedTest
@MethodSource("roadCases")
void motorroad(OsmWithTags way) {
OsmTagMapper osmTagMapper = new OsmTagMapper();
WayPropertySet wps = new WayPropertySet();
osmTagMapper.populateProperties(wps);
final WayPropertySet wps = wayProperySet();

assertEquals(ALL, wps.getDataForWay(way).getPermission());

way.addTag("motorroad", "yes");
assertEquals(CAR, wps.getDataForWay(way).getPermission());
}

@Test
void corridorName() {
final WayPropertySet wps = wayProperySet();
var way = way("highway", "corridor");
assertEquals("corridor", wps.getCreativeNameForWay(way).toString());
assertEquals("Korridor", wps.getCreativeNameForWay(way).toString(Locale.GERMANY));
assertEquals("käytävä", wps.getCreativeNameForWay(way).toString(Locale.of("FI")));
}

public OsmWithTags way(String key, String value) {
var way = new OsmWithTags();
way.addTag(key, value);
return way;
}

private static WayPropertySet wayProperySet() {
OsmTagMapper osmTagMapper = new OsmTagMapper();
WayPropertySet wps = new WayPropertySet();
osmTagMapper.populateProperties(wps);
return wps;
}
}
Loading