use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.
the class OSMHazmatWaterParserTest method testSimpleTags.
@Test
public void testSimpleTags() {
ReaderWay readerWay = new ReaderWay(1);
IntsRef intsRef = em.createEdgeFlags();
readerWay.setTag("hazmat:water", "no");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatWater.NO, hazWaterEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay.setTag("hazmat:water", "yes");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatWater.YES, hazWaterEnc.getEnum(false, intsRef));
intsRef = em.createEdgeFlags();
readerWay.setTag("hazmat:water", "permissive");
parser.handleWayTags(intsRef, readerWay, relFlags);
assertEquals(HazmatWater.PERMISSIVE, hazWaterEnc.getEnum(false, intsRef));
}
use of com.graphhopper.storage.IntsRef 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.storage.IntsRef 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.storage.IntsRef 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.storage.IntsRef 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