Search in sources :

Example 66 with IntsRef

use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.

the class OSMHazmatTunnelParserTest method testNoNPE.

@Test
public void testNoNPE() {
    ReaderWay readerWay = new ReaderWay(1);
    IntsRef intsRef = em.createEdgeFlags();
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.A, hazTunnelEnc.getEnum(false, intsRef));
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Example 67 with IntsRef

use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.

the class OSMHazmatTunnelParserTest method testADRTunnelCat.

@Test
public void testADRTunnelCat() {
    IntsRef intsRef = em.createEdgeFlags();
    ReaderWay readerWay = new ReaderWay(1);
    readerWay.setTag("hazmat:adr_tunnel_cat", "A");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.A, hazTunnelEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay = new ReaderWay(1);
    readerWay.setTag("hazmat:adr_tunnel_cat", "B");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.B, hazTunnelEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay = new ReaderWay(1);
    readerWay.setTag("hazmat:adr_tunnel_cat", "C");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.C, hazTunnelEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay = new ReaderWay(1);
    readerWay.setTag("hazmat:adr_tunnel_cat", "D");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.D, hazTunnelEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay = new ReaderWay(1);
    readerWay.setTag("hazmat:adr_tunnel_cat", "E");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.E, hazTunnelEnc.getEnum(false, intsRef));
}
Also used : IntsRef(com.graphhopper.storage.IntsRef) ReaderWay(com.graphhopper.reader.ReaderWay) Test(org.junit.jupiter.api.Test)

Example 68 with IntsRef

use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.

the class OSMHazmatTunnelParserTest method testOrder.

@Test
public void testOrder() {
    IntsRef intsRef = em.createEdgeFlags();
    ReaderWay readerWay = new ReaderWay(1);
    readerWay.setTag("tunnel", "yes");
    readerWay.setTag("hazmat:A", "no");
    readerWay.setTag("hazmat:B", "no");
    readerWay.setTag("hazmat:C", "no");
    readerWay.setTag("hazmat:D", "no");
    readerWay.setTag("hazmat:E", "no");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.E, hazTunnelEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay = new ReaderWay(1);
    readerWay.setTag("tunnel", "yes");
    readerWay.setTag("hazmat:A", "no");
    readerWay.setTag("hazmat:B", "no");
    readerWay.setTag("hazmat:C", "no");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.C, hazTunnelEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay = new ReaderWay(1);
    readerWay.setTag("tunnel", "yes");
    readerWay.setTag("hazmat:B", "no");
    readerWay.setTag("hazmat:E", "no");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatTunnel.E, hazTunnelEnc.getEnum(false, intsRef));
}
Also used : IntsRef(com.graphhopper.storage.IntsRef) ReaderWay(com.graphhopper.reader.ReaderWay) Test(org.junit.jupiter.api.Test)

Example 69 with IntsRef

use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.

the class OSMLanesParserTest method notTagged.

@Test
void notTagged() {
    ReaderWay readerWay = new ReaderWay(1);
    IntsRef intsRef = em.createEdgeFlags();
    parser.handleWayTags(intsRef, readerWay, em.createRelationFlags());
    Assertions.assertEquals(1, em.getIntEncodedValue(Lanes.KEY).getInt(false, intsRef));
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Example 70 with IntsRef

use of com.graphhopper.storage.IntsRef in project graphhopper by graphhopper.

the class OSMLanesParserTest method basic.

@Test
void basic() {
    ReaderWay readerWay = new ReaderWay(1);
    IntsRef intsRef = em.createEdgeFlags();
    readerWay.setTag("lanes", "4");
    parser.handleWayTags(intsRef, readerWay, em.createRelationFlags());
    Assertions.assertEquals(4, em.getIntEncodedValue(Lanes.KEY).getInt(false, intsRef));
}
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