Skip to content

Commit

Permalink
Merge pull request #6303 from ibi-group/corridor-name
Browse files Browse the repository at this point in the history
Add fallback name for corridors
  • Loading branch information
leonardehrenfried authored Dec 23, 2024
2 parents 4198bb6 + d7fd1d8 commit e890466
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 4 deletions.
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
1 change: 1 addition & 0 deletions application/src/main/resources/WayProperties_de.properties
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
1 change: 1 addition & 0 deletions application/src/main/resources/WayProperties_fi.properties
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
1 change: 1 addition & 0 deletions application/src/main/resources/WayProperties_fr.properties
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
1 change: 1 addition & 0 deletions application/src/main/resources/WayProperties_hu.properties
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
1 change: 1 addition & 0 deletions application/src/main/resources/WayProperties_nl.properties
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
1 change: 1 addition & 0 deletions application/src/main/resources/WayProperties_no.properties
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
1 change: 1 addition & 0 deletions application/src/main/resources/WayProperties_sv.properties
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;
}
}

0 comments on commit e890466

Please sign in to comment.