Search in sources :

Example 91 with IntsRef

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

the class OSMMtbRatingParserTest method checkRating.

private void checkRating(int expectedRating, String scaleString) {
    OSMMtbRatingParser parser = new OSMMtbRatingParser();
    EncodingManager em = new EncodingManager.Builder().add(parser).build();
    IntEncodedValue ev = em.getIntEncodedValue(MtbRating.KEY);
    IntsRef edgeFlags = em.createEdgeFlags();
    ReaderWay way = new ReaderWay(0);
    if (scaleString != null)
        way.setTag("mtb:scale", scaleString);
    parser.handleWayTags(edgeFlags, way, em.createRelationFlags());
    assertEquals(expectedRating, ev.getInt(false, edgeFlags), "unexpected rating for mtb:scale=" + scaleString);
}
Also used : EncodingManager(com.graphhopper.routing.util.EncodingManager) IntsRef(com.graphhopper.storage.IntsRef) ReaderWay(com.graphhopper.reader.ReaderWay) IntEncodedValue(com.graphhopper.routing.ev.IntEncodedValue)

Example 92 with IntsRef

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

the class OSMRoadClassParserTest method testIgnore.

@Test
public void testIgnore() {
    ReaderWay readerWay = new ReaderWay(1);
    IntsRef edgeFlags = em.createEdgeFlags();
    readerWay.setTag("route", "ferry");
    parser.handleWayTags(edgeFlags, readerWay, relFlags);
    assertEquals(RoadClass.OTHER, rcEnc.getEnum(false, edgeFlags));
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Example 93 with IntsRef

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

the class OSMRoadClassParserTest method testNoNPE.

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

Example 94 with IntsRef

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

the class OSMHazmatParserTest method testSimpleTags.

@Test
public void testSimpleTags() {
    ReaderWay readerWay = new ReaderWay(1);
    IntsRef intsRef = em.createEdgeFlags();
    readerWay.setTag("hazmat", "no");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(Hazmat.NO, hazEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay.setTag("hazmat", "yes");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(Hazmat.YES, hazEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay.setTag("hazmat", "designated");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(Hazmat.YES, hazEnc.getEnum(false, intsRef));
    intsRef = em.createEdgeFlags();
    readerWay.setTag("hazmat", "designated");
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(Hazmat.YES, hazEnc.getEnum(false, intsRef));
}
Also used : ReaderWay(com.graphhopper.reader.ReaderWay) IntsRef(com.graphhopper.storage.IntsRef) Test(org.junit.jupiter.api.Test)

Example 95 with IntsRef

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

the class OSMHazmatWaterParserTest method testNoNPE.

@Test
public void testNoNPE() {
    ReaderWay readerWay = new ReaderWay(1);
    IntsRef intsRef = em.createEdgeFlags();
    parser.handleWayTags(intsRef, readerWay, relFlags);
    assertEquals(HazmatWater.YES, hazWaterEnc.getEnum(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