use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class OSMGetOffBikeParserTest method testHandleCommonWayTags.
@Test
public void testHandleCommonWayTags() {
ReaderWay way = new ReaderWay(1);
way.setTag("highway", "steps");
assertTrue(isGetOffBike(way));
way.setTag("highway", "footway");
assertTrue(isGetOffBike(way));
way.setTag("highway", "footway");
way.setTag("surface", "pebblestone");
assertTrue(isGetOffBike(way));
way.setTag("highway", "residential");
assertFalse(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "residential");
way.setTag("bicycle", "yes");
assertFalse(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "cycleway");
assertEquals(getRoadClass(way), RoadClass.CYCLEWAY);
way.setTag("highway", "footway");
way.setTag("surface", "grass");
assertTrue(isGetOffBike(way));
way.setTag("bicycle", "yes");
assertFalse(isGetOffBike(way));
way.setTag("bicycle", "designated");
assertFalse(isGetOffBike(way));
way.setTag("bicycle", "official");
assertFalse(isGetOffBike(way));
way.setTag("bicycle", "permissive");
assertFalse(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("railway", "platform");
assertTrue(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "secondary");
way.setTag("bicycle", "dismount");
assertTrue(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "platform");
way.setTag("bicycle", "yes");
assertFalse(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "track");
way.setTag("foot", "yes");
assertFalse(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "pedestrian");
assertTrue(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "path");
way.setTag("surface", "concrete");
assertTrue(isGetOffBike(way));
way.setTag("bicycle", "yes");
assertFalse(isGetOffBike(way));
way.setTag("bicycle", "designated");
assertFalse(isGetOffBike(way));
way.setTag("bicycle", "official");
assertFalse(isGetOffBike(way));
way.setTag("bicycle", "permissive");
assertFalse(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "track");
assertFalse(isGetOffBike(way));
way = new ReaderWay(1);
way.setTag("highway", "path");
way.setTag("foot", "designated");
assertTrue(isGetOffBike(way));
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class OSMMaxAxleLoadParserTest method testRounding.
@Test
public void testRounding() {
ReaderWay readerWay = new ReaderWay(1);
IntsRef intsRef = em.createEdgeFlags();
readerWay.setTag("maxaxleload", "4.8");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(5.0, malEnc.getDecimal(false, intsRef), .01);
intsRef = em.createEdgeFlags();
readerWay.setTag("maxaxleload", "3.6");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(3.5, malEnc.getDecimal(false, intsRef), .01);
intsRef = em.createEdgeFlags();
readerWay.setTag("maxaxleload", "2.4");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(2.5, malEnc.getDecimal(false, intsRef), .01);
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class OSMMaxAxleLoadParserTest method testSimpleTags.
@Test
public void testSimpleTags() {
ReaderWay readerWay = new ReaderWay(1);
IntsRef intsRef = em.createEdgeFlags();
readerWay.setTag("maxaxleload", "11.5");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(11.5, malEnc.getDecimal(false, intsRef), .01);
// if value is beyond the maximum then do not use infinity instead fallback to more restrictive maximum
intsRef = em.createEdgeFlags();
readerWay.setTag("maxaxleload", "80");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(malEnc.getMaxDecimal(), malEnc.getDecimal(false, intsRef), .01);
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class OSMMaxAxleLoadParserTest method testNoLimit.
@Test
public void testNoLimit() {
ReaderWay readerWay = new ReaderWay(1);
IntsRef intsRef = em.createEdgeFlags();
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(Double.POSITIVE_INFINITY, malEnc.getDecimal(false, intsRef), .01);
}
use of com.graphhopper.reader.ReaderWay in project graphhopper by graphhopper.
the class OSMMaxWeightParserTest method testSimpleTags.
@Test
public void testSimpleTags() {
ReaderWay readerWay = new ReaderWay(1);
IntsRef intsRef = em.createEdgeFlags();
readerWay.setTag("highway", "primary");
readerWay.setTag("maxweight", "5");
parser.handleWayTags(intsRef, readerWay, em.createRelationFlags());
assertEquals(5.0, mwEnc.getDecimal(false, intsRef), .01);
// if value is beyond the maximum then do not use infinity instead fallback to more restrictive maximum
intsRef = em.createEdgeFlags();
readerWay.setTag("maxweight", "50");
parser.handleWayTags(intsRef, readerWay, em.createRelationFlags());
assertEquals(mwEnc.getMaxDecimal(), mwEnc.getDecimal(false, intsRef), .01);
}
Aggregations