Search in sources :

Example 56 with IntsRef

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));
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Example 57 with 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);
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Example 58 with IntsRef

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);
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Example 59 with IntsRef

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);
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Example 60 with IntsRef

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);
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Aggregations

IntsRef (com.graphhopper.storage.IntsRef)108 Test (org.junit.jupiter.api.Test)96 ReaderWay (com.graphhopper.reader.ReaderWay)67 ReaderRelation (com.graphhopper.reader.ReaderRelation)7 GraphBuilder (com.graphhopper.storage.GraphBuilder)7 EncodingManager (com.graphhopper.routing.util.EncodingManager)5 Graph (com.graphhopper.storage.Graph)5 DecimalEncodedValue (com.graphhopper.routing.ev.DecimalEncodedValue)4 FlagEncoder (com.graphhopper.routing.util.FlagEncoder)4 CarFlagEncoder (com.graphhopper.routing.util.CarFlagEncoder)3 NodeAccess (com.graphhopper.storage.NodeAccess)3 BooleanEncodedValue (com.graphhopper.routing.ev.BooleanEncodedValue)2 RoadEnvironment (com.graphhopper.routing.ev.RoadEnvironment)2 VirtualEdgeIteratorState (com.graphhopper.routing.querygraph.VirtualEdgeIteratorState)2 TransportationMode (com.graphhopper.routing.util.TransportationMode)2 CountryRule (com.graphhopper.routing.util.countryrules.CountryRule)2 FastestWeighting (com.graphhopper.routing.weighting.FastestWeighting)2 EdgeIteratorState (com.graphhopper.util.EdgeIteratorState)2 PMap (com.graphhopper.util.PMap)2 PointList (com.graphhopper.util.PointList)2