use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class FootFlagEncoderTest method testSlowHiking.
@Test
public void testSlowHiking() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "track");
way.setTag("sac_scale", "hiking");
IntsRef flags = footEncoder.handleWayTags(encodingManager.createEdgeFlags(), way);
assertEquals(FootFlagEncoder.MEAN_SPEED, footAvgSpeedEnc.getDecimal(false, flags), 1e-1);
way.setTag("highway", "track");
way.setTag("sac_scale", "mountain_hiking");
flags = footEncoder.handleWayTags(encodingManager.createEdgeFlags(), way);
assertEquals(FootFlagEncoder.SLOW_SPEED, footAvgSpeedEnc.getDecimal(false, flags), 1e-1);
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class FootFlagEncoderTest method testRailPlatformIssue366.
@Test
public void testRailPlatformIssue366() {
ReaderWay way = new ReaderWay(1);
way.setTag("railway", "platform");
IntsRef flags = footEncoder.handleWayTags(encodingManager.createEdgeFlags(), way);
assertFalse(flags.isEmpty());
way.clearTags();
way.setTag("highway", "track");
way.setTag("railway", "platform");
flags = footEncoder.handleWayTags(encodingManager.createEdgeFlags(), way);
assertFalse(flags.isEmpty());
way.clearTags();
// only tram, no highway => no access
way.setTag("railway", "tram");
flags = footEncoder.handleWayTags(encodingManager.createEdgeFlags(), way);
assertTrue(flags.isEmpty());
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class FootFlagEncoderTest method testAccess.
@Test
public void testAccess() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "motorway");
way.setTag("sidewalk", "yes");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("sidewalk", "left");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("sidewalk", "none");
assertTrue(footEncoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "tertiary");
way.setTag("sidewalk", "left");
way.setTag("access", "private");
assertTrue(footEncoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "pedestrian");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("highway", "footway");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("highway", "platform");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("highway", "motorway");
assertTrue(footEncoder.getAccess(way).canSkip());
way.setTag("highway", "path");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("bicycle", "official");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("foot", "no");
assertTrue(footEncoder.getAccess(way).canSkip());
way.setTag("foot", "official");
assertTrue(footEncoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "service");
way.setTag("access", "no");
assertTrue(footEncoder.getAccess(way).canSkip());
way.setTag("foot", "yes");
assertTrue(footEncoder.getAccess(way).isWay());
way.clearTags();
way.setTag("highway", "service");
way.setTag("vehicle", "no");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("foot", "no");
assertTrue(footEncoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "tertiary");
way.setTag("motorroad", "yes");
assertTrue(footEncoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "cycleway");
assertTrue(footEncoder.getAccess(way).isWay());
way.setTag("foot", "no");
assertTrue(footEncoder.getAccess(way).canSkip());
way.setTag("access", "yes");
assertTrue(footEncoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "service");
way.setTag("foot", "yes");
way.setTag("access", "no");
assertTrue(footEncoder.getAccess(way).isWay());
way.clearTags();
way.setTag("route", "ferry");
assertTrue(footEncoder.getAccess(way).isFerry());
way.setTag("foot", "no");
assertTrue(footEncoder.getAccess(way).canSkip());
// #1562, test if ferry route with foot
way.clearTags();
way.setTag("route", "ferry");
way.setTag("foot", "yes");
assertTrue(footEncoder.getAccess(way).isFerry());
way.setTag("foot", "designated");
assertTrue(footEncoder.getAccess(way).isFerry());
way.setTag("foot", "official");
assertTrue(footEncoder.getAccess(way).isFerry());
way.setTag("foot", "permissive");
assertTrue(footEncoder.getAccess(way).isFerry());
way.setTag("foot", "no");
assertTrue(footEncoder.getAccess(way).canSkip());
way.setTag("foot", "designated");
way.setTag("access", "private");
assertTrue(footEncoder.getAccess(way).canSkip());
DateFormat simpleDateFormat = Helper.createFormatter("yyyy MMM dd");
way.clearTags();
way.setTag("highway", "footway");
way.setTag("access:conditional", "no @ (" + simpleDateFormat.format(new Date().getTime()) + ")");
assertTrue(footEncoder.getAccess(way).canSkip());
way.clearTags();
way.setTag("highway", "footway");
way.setTag("access", "no");
way.setTag("access:conditional", "yes @ (" + simpleDateFormat.format(new Date().getTime()) + ")");
assertTrue(footEncoder.getAccess(way).isWay());
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class MountainBikeFlagEncoderTest method testHandleWayTagsInfluencedByRelation.
@Test
public void testHandleWayTagsInfluencedByRelation() {
ReaderWay osmWay = new ReaderWay(1);
osmWay.setTag("highway", "track");
ReaderRelation osmRel = new ReaderRelation(1);
IntsRef relFlags = encodingManager.handleRelationTags(osmRel, encodingManager.createRelationFlags());
// unchanged
IntsRef flags = encodingManager.handleWayTags(osmWay, relFlags);
assertEquals(18, avgSpeedEnc.getDecimal(false, flags), 1e-1);
assertPriority(PriorityCode.PREFER.getValue(), osmWay);
// relation code is PREFER
osmRel.setTag("route", "bicycle");
osmRel.setTag("network", "lcn");
relFlags = encodingManager.handleRelationTags(osmRel, encodingManager.createRelationFlags());
flags = encodingManager.handleWayTags(osmWay, relFlags);
assertEquals(18, avgSpeedEnc.getDecimal(false, flags), 1e-1);
assertPriority(PriorityCode.PREFER.getValue(), osmWay);
// relation code is PREFER
osmRel.setTag("network", "rcn");
relFlags = encodingManager.handleRelationTags(osmRel, encodingManager.createRelationFlags());
flags = encodingManager.handleWayTags(osmWay, relFlags);
assertPriority(PriorityCode.PREFER.getValue(), osmWay);
assertEquals(18, avgSpeedEnc.getDecimal(false, flags), 1e-1);
// relation code is PREFER
osmRel.setTag("network", "ncn");
relFlags = encodingManager.handleRelationTags(osmRel, encodingManager.createRelationFlags());
flags = encodingManager.handleWayTags(osmWay, relFlags);
assertPriority(PriorityCode.PREFER.getValue(), osmWay);
assertEquals(18, avgSpeedEnc.getDecimal(false, flags), 1e-1);
// PREFER relation, but tertiary road
// => no pushing section but road wayTypeCode and faster
osmWay.clearTags();
osmWay.setTag("highway", "tertiary");
osmRel.setTag("route", "bicycle");
osmRel.setTag("network", "lcn");
relFlags = encodingManager.handleRelationTags(osmRel, encodingManager.createRelationFlags());
flags = encodingManager.handleWayTags(osmWay, relFlags);
assertEquals(18, avgSpeedEnc.getDecimal(false, flags), 1e-1);
assertPriority(PriorityCode.PREFER.getValue(), osmWay);
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class RacingBikeFlagEncoderTest method testClassBicycle.
@Test
public void testClassBicycle() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "tertiary");
way.setTag("class:bicycle:roadcycling", "3");
assertPriority(BEST.getValue(), way);
way.setTag("class:bicycle", "-2");
assertPriority(BEST.getValue(), way);
}
Aggregations