Skip to content

Commit

Permalink
add tagging for dashed cycle lanes (#888)
Browse files Browse the repository at this point in the history
- refactor the way how country specific resources are queried
- take care of the special cycleway situation in NL,BE
- add country-specific resources for cycleway icons
  • Loading branch information
westnordost committed Mar 28, 2018
1 parent 69e96ae commit 5df24a8
Show file tree
Hide file tree
Showing 134 changed files with 1,965 additions and 6,292 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ private void checkRegularShoppingDaysIsBetween0And7(CountryInfo info)
assertTrue(info.getRegularShoppingDays() >= 0);
}

private void checkMaxSpeedLayoutExists(CountryInfo info)
{
if(info.getMaxspeedLayout() != null)
{
int resId = getContext().getResources().getIdentifier(
info.getMaxspeedLayout(), "layout", getContext().getPackageName());
assertTrue(resId != 0);
}
}

private static List<String> validWeekdays = Arrays.asList("Mo","Tu","We","Th","Fr","Sa","Su");
private void checkStartOfWorkweekValid(CountryInfo info)
{
Expand All @@ -60,7 +50,6 @@ private void checkForEach(CountryInfo info)
checkFirstDayOfWorkweekIsValid(info);
checkSpeedUnitIsEitherKmhOrMph(info);
checkRegularShoppingDaysIsBetween0And7(info);
checkMaxSpeedLayoutExists(info);
checkStartOfWorkweekValid(info);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,39 @@ public class AddCyclewayTest extends AOsmElementQuestTypeTest
{
public void testCyclewayLeftAndRightDontHaveToBeSpecified1()
{
bundle.putString(AddCyclewayForm.CYCLEWAY_LEFT, Cycleway.LANE.name());
bundle.putString(AddCyclewayForm.CYCLEWAY_LEFT, Cycleway.EXCLUSIVE_LANE.name());
StringMapChangesBuilder cb = new StringMapChangesBuilder(tags);
createQuestType().applyAnswerTo(bundle, cb);
// success if no exception thrown
}

public void testCyclewayLeftAndRightDontHaveToBeSpecified2()
{
bundle.putString(AddCyclewayForm.CYCLEWAY_RIGHT, Cycleway.LANE.name());
bundle.putString(AddCyclewayForm.CYCLEWAY_RIGHT, Cycleway.EXCLUSIVE_LANE.name());
StringMapChangesBuilder cb = new StringMapChangesBuilder(tags);
createQuestType().applyAnswerTo(bundle, cb);
// success if no exception thrown
}

public void testCyclewayLane()
{
putBothSides(Cycleway.LANE);
putBothSides(Cycleway.EXCLUSIVE_LANE);
verify(
new StringMapEntryAdd("cycleway:both", "lane"),
new StringMapEntryAdd("cycleway:both:lane", "exclusive"));
}

public void testCyclewayDashedLane()
{
putBothSides(Cycleway.SHARED_LANE);
verify(
new StringMapEntryAdd("cycleway:both", "lane"),
new StringMapEntryAdd("cycleway:both:lane", "shared"));
}

public void testCyclewayUnspecifiedLane()
{
putBothSides(Cycleway.LANE_UNSPECIFIED);
verify(new StringMapEntryAdd("cycleway:both", "lane"));
}

Expand All @@ -43,10 +59,22 @@ public void testCyclewayBusLane()
verify(new StringMapEntryAdd("cycleway:both", "share_busway"));
}

public void testCyclewaySharedLane()
public void testCyclewayPictogramLane()
{
putBothSides(Cycleway.SHARED);
verify(new StringMapEntryAdd("cycleway:both", "shared_lane"));
putBothSides(Cycleway.PICTOGRAMS);
verify(
new StringMapEntryAdd("cycleway:both", "shared_lane"),
new StringMapEntryAdd("cycleway:both:lane", "pictograms")
);
}

public void testCyclewaySuggestionLane()
{
putBothSides(Cycleway.SUGGESTION_LANE);
verify(
new StringMapEntryAdd("cycleway:both", "shared_lane"),
new StringMapEntryAdd("cycleway:both:lane", "shared")
);
}

public void testCyclewayNone()
Expand All @@ -57,7 +85,7 @@ public void testCyclewayNone()

public void testCyclewayOnSidewalk()
{
putBothSides(Cycleway.SIDEWALK);
putBothSides(Cycleway.SIDEWALK_EXPLICIT);
verify(
new StringMapEntryAdd("cycleway:both", "track"),
new StringMapEntryAdd("sidewalk", "both"),
Expand All @@ -77,7 +105,7 @@ public void testCyclewaySidewalkOkay()

public void testCyclewaySidewalkAny()
{
bundle.putString(AddCyclewayForm.CYCLEWAY_RIGHT, Cycleway.SIDEWALK.name());
bundle.putString(AddCyclewayForm.CYCLEWAY_RIGHT, Cycleway.SIDEWALK_EXPLICIT.name());
bundle.putString(AddCyclewayForm.CYCLEWAY_LEFT, Cycleway.SIDEWALK_OK.name());
verify(
new StringMapEntryAdd("sidewalk", "both")
Expand All @@ -86,16 +114,17 @@ public void testCyclewaySidewalkAny()

public void testCyclewayDualTrack()
{
putBothSides(Cycleway.TRACK_DUAL);
putBothSides(Cycleway.DUAL_TRACK);
verify(
new StringMapEntryAdd("cycleway:both", "track"),
new StringMapEntryAdd("cycleway:both:oneway", "no")
new StringMapEntryAdd("cycleway:both", "track"),
new StringMapEntryAdd("cycleway:both:oneway", "no"),
new StringMapEntryAdd("cycleway:both:lane", "exclusive")
);
}

public void testCyclewayDualLane()
{
putBothSides(Cycleway.LANE_DUAL);
putBothSides(Cycleway.DUAL_LANE);
verify(
new StringMapEntryAdd("cycleway:both", "lane"),
new StringMapEntryAdd("cycleway:both:oneway", "no")
Expand All @@ -104,47 +133,53 @@ public void testCyclewayDualLane()

public void testLeftAndRightAreDifferent()
{
bundle.putString(AddCyclewayForm.CYCLEWAY_RIGHT, Cycleway.LANE.name());
bundle.putString(AddCyclewayForm.CYCLEWAY_RIGHT, Cycleway.EXCLUSIVE_LANE.name());
bundle.putString(AddCyclewayForm.CYCLEWAY_LEFT, Cycleway.TRACK.name());
verify(
new StringMapEntryAdd("cycleway:right", "lane"),
new StringMapEntryAdd("cycleway:right:lane","exclusive"),
new StringMapEntryAdd("cycleway:left", "track")
);
}

public void testCyclewayMakesStreetNotOnewayForBicycles()
{
putBothSides(Cycleway.LANE);
putBothSides(Cycleway.EXCLUSIVE_LANE);
bundle.putBoolean(AddCyclewayForm.IS_ONEWAY_NOT_FOR_CYCLISTS, true);
verify(
new StringMapEntryAdd("cycleway:both", "lane"),
new StringMapEntryAdd("oneway:bicycle", "no")
new StringMapEntryAdd("oneway:bicycle", "no"),
new StringMapEntryAdd("cycleway:both:lane", "exclusive")
);
}

public void testCyclewayLaneWithExplicitDirection()
{
// this would be a street that has lanes on both sides but is oneway=yes (in countries with
// right hand traffic)
putBothSides(Cycleway.LANE);
putBothSides(Cycleway.EXCLUSIVE_LANE);
bundle.putInt(AddCyclewayForm.CYCLEWAY_LEFT_DIR, -1);
verify(
new StringMapEntryAdd("cycleway:left", "lane"),
new StringMapEntryAdd("cycleway:left:oneway", "-1"),
new StringMapEntryAdd("cycleway:right", "lane")
new StringMapEntryAdd("cycleway:right", "lane"),
new StringMapEntryAdd("cycleway:left:lane","exclusive"),
new StringMapEntryAdd("cycleway:right:lane","exclusive")
);
}

public void testCyclewayLaneWithExplicitOtherDirection()
{
// this would be a street that has lanes on both sides but is oneway=-1 (in countries with
// right hand traffic)
putBothSides(Cycleway.LANE);
putBothSides(Cycleway.EXCLUSIVE_LANE);
bundle.putInt(AddCyclewayForm.CYCLEWAY_LEFT_DIR, +1);
verify(
new StringMapEntryAdd("cycleway:left", "lane"),
new StringMapEntryAdd("cycleway:left:oneway", "yes"),
new StringMapEntryAdd("cycleway:right", "lane")
new StringMapEntryAdd("cycleway:right", "lane"),
new StringMapEntryAdd("cycleway:left:lane","exclusive"),
new StringMapEntryAdd("cycleway:right:lane","exclusive")
);
}

Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/AM.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
additionalStreetsignLanguages: [en]
isLivingStreetKnown: true
livingStreetSign: ic_living_street_russian
officialLanguages: [hy]
orchardProduces: [grape, apple, apricot, tomatoe, peach, pear, plum, cherry, walnut, fig, hazelnut]
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/AO.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
isLivingStreetKnown: true
livingStreetSign: ic_living_street_sadc
officialLanguages: [pt]
orchardProduces: [banana, coffee, pineapple, palm_oil, tomatoe, cashew_nut, cacao, sisal]
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/AS.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
maxspeedLayout: quest_maxspeed_us
officialLanguages: [en, sm]
orchardProduces: [coconut, banana, tomatoe, cacao]
speedUnit: [mph, km/h]
2 changes: 0 additions & 2 deletions app/src/main/assets/country_metadata/AU.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_yellow
isAdvisorySpeedLimitKnown: true
isLeftHandTraffic: true
isLivingStreetKnown: true
livingStreetSign: ic_living_street_australia
officialLanguages: [en]
orchardProduces: [grape, olive, almond, apple, orange, banana, peach, avocado, guava, mango, mangosteen,
walnut, apricot, pear, tomatoe, plum, cherry]
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/BW.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
isLeftHandTraffic: true
isLivingStreetKnown: true
livingStreetSign: ic_living_street_sadc
officialLanguages: [en, tn]
orchardProduces: [orange]
2 changes: 0 additions & 2 deletions app/src/main/assets/country_metadata/BY.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
livingStreetSign: ic_living_street_russian
officialLanguages: [be, ru]
orchardProduces: [apple, cranberry, strawberry, plum, tomatoe, pear, walnut, grape, hazelnut, cherry]
popularSports: [soccer, basketball, tennis, field_hockey, volleyball, ice_hockey]
2 changes: 0 additions & 2 deletions app/src/main/assets/country_metadata/CA.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_yellow
isAdvisorySpeedLimitKnown: true
isSlowZoneKnown: false
maxspeedLayout: quest_maxspeed_ca
officialLanguages: [en, fr]
orchardProduces: [blueberry, apple, grape, cranberry, tomatoe, strawberry, peach, raspberry, chilli_pepper,
sweet_pepper, cherry, pear, plum, apricot, kiwi]
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/CN.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_yellow
isAdvisorySpeedLimitKnown: true
officialLanguages: [zh]
orchardProduces: [apple, tea, plum, orange, pear, tomatoe, persimmon, grape, peach, rubber, guava,
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/CZ.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/DK.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/EE.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
additionalStreetsignLanguages: [ru]
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/ES.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Do not edit. Source files are in /res/country_metadata
additionalStreetsignLanguages: [ca, eu, gl]
additionalValidHousenumberRegex: s/n
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/FI.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/FR.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Do not edit. Source files are in /res/country_metadata
additionalStreetsignLanguages: [oc, ca, br]
additionalValidHousenumberRegex: \p{N}{1,4}\sbis
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/GB.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
additionalStreetsignLanguages: [cy, gd]
advisorySpeedLimitLayout: quest_maxspeed_advisory_white
isAdvisorySpeedLimitKnown: true
isLeftHandTraffic: true
isLivingStreetKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/GR.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
additionalStreetsignLanguages: [en]
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/GU.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
maxspeedLayout: quest_maxspeed_us
officialLanguages: [en, ch]
orchardProduces: [coconut, tomatoe, banana]
speedUnit: [mph, km/h]
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/HU.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/IT.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/JP.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
additionalStreetsignLanguages: [en]
advisorySpeedLimitLayout: quest_maxspeed_advisory_white
isAdvisorySpeedLimitKnown: true
isLeftHandTraffic: true
officialLanguages: [ja]
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/KG.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
isLivingStreetKnown: true
livingStreetSign: ic_living_street_russian
officialLanguages: [ky, ru]
orchardProduces: [apple, tomatoe, apricot, grape, hazelnut, pear, peach, plum, cherry, walnut, almond,
raspberry, pistachio, chilli_pepper, sweet_pepper, strawberry]
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/KR.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
additionalStreetsignLanguages: [en]
advisorySpeedLimitLayout: quest_maxspeed_advisory_white
isAdvisorySpeedLimitKnown: true
officialLanguages: [ko]
orchardProduces: [apple, chilli_pepper, sweet_pepper, chestnut, apple, persimmon, chilli_pepper, sweet_pepper,
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/KZ.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
isLivingStreetKnown: true
livingStreetSign: ic_living_street_russian
officialLanguages: [kk, ru]
orchardProduces: [apple, tomatoe, grape, apricot, pear, cherry, strawberry, plum, walnut, peach, chilli_pepper,
sweet_pepper, almond]
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/LS.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
isLeftHandTraffic: true
isLivingStreetKnown: true
livingStreetSign: ic_living_street_sadc
officialLanguages: [st, en]
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/LU.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Do not edit. Source files are in /res/country_metadata
advisorySpeedLimitLayout: quest_maxspeed_advisory_blue
isAdvisorySpeedLimitKnown: true
isLivingStreetKnown: true
isSlowZoneKnown: true
Expand Down
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/MG.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
isLivingStreetKnown: true
livingStreetSign: ic_living_street_sadc
officialLanguages: [mg, fr]
orchardProduces: [coffee, vanilla, banana, guava, mango, mangosteen, coconut, cashew_nut, pineapple,
sisal, orange, pepper, cacao, pistachio, tomatoe, apple, tung_nut]
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/MN.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Do not edit. Source files are in /res/country_metadata
isLivingStreetKnown: true
livingStreetSign: ic_living_street_russian
officialLanguages: [mn]
orchardProduces: [hazelnut]
popularReligions: [buddhist, chinese_folk, taoist]
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/MU.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Do not edit. Source files are in /res/country_metadata
isLeftHandTraffic: true
isLivingStreetKnown: true
livingStreetSign: ic_living_street_sadc
officialLanguages: [en, fr, mfe]
orchardProduces: [tomatoe, tea, pineapple, coconut, banana, chilli_pepper, sweet_pepper]
popularReligions: [hindu, christian, muslim]
1 change: 0 additions & 1 deletion app/src/main/assets/country_metadata/MW.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Do not edit. Source files are in /res/country_metadata
isLeftHandTraffic: true
isLivingStreetKnown: true
livingStreetSign: ic_living_street_sadc
officialLanguages: [en, ny]
orchardProduces: [tea, banana, guava, mango, mangosteen, tomatoe, coffee, tung_nut, pepper, chilli_pepper,
sweet_pepper, sisal, nutmeg, vanilla]
Loading

0 comments on commit 5df24a8

Please sign in to comment.