Skip to content

Commit

Permalink
Revert "Add support for bike mtb:scale accessability"
Browse files Browse the repository at this point in the history
This reverts commit 2b75aa7.
  • Loading branch information
ratrun committed Sep 14, 2024
1 parent 6c558f7 commit 9d71c89
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ public WayAccess getAccess(ReaderWay way) {
return WayAccess.CAN_SKIP;
}

String mtbScale = way.getTag("mtb:scale");
if (mtbScale != null) {
if (!isMtbScaleAllowed(mtbScale))
return WayAccess.CAN_SKIP;
}

// use the way for pushing
if (way.hasTag("bicycle", "dismount"))
return WayAccess.WAY;
Expand Down Expand Up @@ -111,11 +105,6 @@ boolean isSacScaleAllowed(String sacScale) {
return "hiking".equals(sacScale);
}

boolean isMtbScaleAllowed(String mtbScale) {
// keep even more difficult accessible as one may push, see https://wiki.openstreetmap.org/wiki/Key:mtb:scale
return "0".equals(mtbScale) || "1".equals(mtbScale) || "2".equals(mtbScale);
}

@Override
public void handleWayTags(int edgeId, EdgeIntAccess edgeIntAccess, ReaderWay way) {
WayAccess access = getAccess(way);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,4 @@ boolean isSacScaleAllowed(String sacScale) {
return "hiking".equals(sacScale) || "mountain_hiking".equals(sacScale)
|| "demanding_mountain_hiking".equals(sacScale) || "alpine_hiking".equals(sacScale);
}

@Override
boolean isMtbScaleAllowed(String mtbScale) {
return !"6".equals(mtbScale);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@
import com.graphhopper.routing.util.OSMParsers;
import com.graphhopper.routing.util.PriorityCode;
import com.graphhopper.storage.IntsRef;
import com.graphhopper.util.Helper;
import com.graphhopper.util.PMap;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.text.DateFormat;
import java.util.Date;

import static com.graphhopper.routing.util.PriorityCode.*;
import static org.junit.jupiter.api.Assertions.*;

Expand Down Expand Up @@ -369,22 +373,14 @@ public void testSteps() {
}

@Test
public void testSacScaleAccess() {
public void testSacScale() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "service");
way.setTag("sac_scale", "hiking");
// allow
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("sac_scale", "alpine_hiking");
assertTrue(accessParser.getAccess(way).canSkip());
}

@Test
public void testMtbScaleAccess() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "path");
way.setTag("mtb:scale", "0");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("mtb:scale", "3");
way.setTag("sac_scale", "alpine_hiking");
assertTrue(accessParser.getAccess(way).canSkip());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ public void testUnchangedRelationShouldNotInfluencePriority() {

@Test
@Override
public void testSacScaleAccess() {
public void testSacScale() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "path");
way.setTag("sac_scale", "hiking");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void testSmoothness() {

@Test
@Override
public void testSacScaleAccess() {
public void testSacScale() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "service");
way.setTag("sac_scale", "hiking");
Expand All @@ -152,19 +152,6 @@ public void testSacScaleAccess() {
assertTrue(accessParser.getAccess(way).canSkip());
}

@Test
@Override
public void testMtbScaleAccess() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "path");
way.setTag("mtb:scale", "0");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("mtb:scale", "5");
assertTrue(accessParser.getAccess(way).isWay());
way.setTag("mtb:scale", "6");
assertTrue(accessParser.getAccess(way).canSkip());
}

@Test
public void testHandleWayTagsInfluencedByBikeAndMtbRelation() {
ReaderWay osmWay = new ReaderWay(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void testTrack() {

@Test
@Override
public void testSacScaleAccess() {
public void testSacScale() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "service");
way.setTag("sac_scale", "mountain_hiking");
Expand All @@ -128,14 +128,6 @@ public void testSacScaleAccess() {
assertTrue(accessParser.getAccess(way).canSkip());
}

@Test
@Override
public void testMtbScaleAccess() {
// Intentionally use the same accessibility as ordinary bikes as pushing a racebike is easier
// compared to an ordinary bike. The problem is more the shoes, which makes the situation comparable
super.testMtbScaleAccess();
}

@Test
public void testGetSpeed() {
EdgeIntAccess edgeIntAccess = ArrayEdgeIntAccess.createFromBytes(encodingManager.getBytesForFlags());
Expand Down

0 comments on commit 9d71c89

Please sign in to comment.