use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class AbstractBikeFlagEncoderTester method testPreferenceForSlowSpeed.
@Test
public void testPreferenceForSlowSpeed() {
ReaderWay osmWay = new ReaderWay(1);
osmWay.setTag("highway", "tertiary");
IntsRef edgeFlags = encodingManager.createEdgeFlags();
avgSpeedEnc.setDecimal(false, edgeFlags, encoder.applyMaxSpeed(osmWay, 49));
assertEquals(30, avgSpeedEnc.getDecimal(false, edgeFlags), 1e-1);
assertPriority(PREFER.getValue(), osmWay);
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class AbstractBikeFlagEncoderTester method testAccess.
@Test
public void testAccess() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "motorway");
assertTrue(encoder.getAccess(way).canSkip());
way.setTag("highway", "motorway");
way.setTag("bicycle", "yes");
assertTrue(encoder.getAccess(way).isWay());
way.setTag("highway", "footway");
assertTrue(encoder.getAccess(way).isWay());
way.setTag("bicycle", "no");
assertTrue(encoder.getAccess(way).canSkip());
way.setTag("highway", "footway");
way.setTag("bicycle", "yes");
assertTrue(encoder.getAccess(way).isWay());
way.setTag("highway", "pedestrian");
way.setTag("bicycle", "no");
assertTrue(encoder.getAccess(way).canSkip());
way.setTag("highway", "pedestrian");
way.setTag("bicycle", "yes");
assertTrue(encoder.getAccess(way).isWay());
way.setTag("bicycle", "yes");
way.setTag("highway", "cycleway");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "path");
assertTrue(encoder.getAccess(way).isWay());
way.setTag("highway", "path");
way.setTag("bicycle", "yes");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "track");
way.setTag("bicycle", "yes");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "track");
assertTrue(encoder.getAccess(way).isWay());
way.setTag("mtb", "yes");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "path");
way.setTag("foot", "official");
assertTrue(encoder.getAccess(way).isWay());
way.setTag("bicycle", "official");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "service");
way.setTag("access", "no");
assertTrue(encoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "tertiary");
way.setTag("motorroad", "yes");
assertTrue(encoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "track");
way.setTag("ford", "yes");
assertTrue(encoder.getAccess(way).canSkip());
way.setTag("bicycle", "yes");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "secondary");
way.setTag("access", "no");
assertTrue(encoder.getAccess(way).canSkip());
way.setTag("bicycle", "dismount");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "secondary");
way.setTag("vehicle", "no");
assertTrue(encoder.getAccess(way).canSkip());
way.setTag("bicycle", "dismount");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "cycleway");
way.setTag("cycleway", "track");
way.setTag("railway", "abandoned");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "platform");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "platform");
way.setTag("bicycle", "dismount");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "platform");
way.setTag("bicycle", "no");
assertTrue(encoder.getAccess(way).canSkip());
DateFormat simpleDateFormat = Helper.createFormatter("yyyy MMM dd");
way.clearTags();
way.setTag("highway", "road");
way.setTag("bicycle:conditional", "no @ (" + simpleDateFormat.format(new Date().getTime()) + ")");
assertTrue(encoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "road");
way.setTag("access", "no");
way.setTag("bicycle:conditional", "yes @ (" + simpleDateFormat.format(new Date().getTime()) + ")");
assertTrue(encoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "track");
way.setTag("vehicle", "forestry");
assertTrue(encoder.getAccess(way).canSkip());
way.setTag("bicycle", "yes");
assertTrue(encoder.getAccess(way).isWay());
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class AbstractBikeFlagEncoderTester method testSacScale.
@Test
public void testSacScale() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "service");
way.setTag("sac_scale", "hiking");
// allow
assertTrue(encoder.getAccess(way).isWay());
way.setTag("sac_scale", "alpine_hiking");
assertTrue(encoder.getAccess(way).canSkip());
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class AbstractBikeFlagEncoderTester method testService.
@Test
public void testService() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "service");
assertEquals(14, encoder.getSpeed(way));
assertPriority(PREFER.getValue(), way);
way.setTag("service", "parking_aisle");
assertEquals(6, encoder.getSpeed(way));
assertPriority(SLIGHT_AVOID.getValue(), way);
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class AbstractBikeFlagEncoderTester method testReduceToMaxSpeed.
@Test
public void testReduceToMaxSpeed() {
ReaderWay way = new ReaderWay(12);
way.setTag("maxspeed", "90");
assertEquals(12, encoder.applyMaxSpeed(way, 12), 1e-2);
}
Aggregations