Search in sources :

Example 66 with ReaderWay

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

Example 67 with ReaderWay

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

Example 68 with ReaderWay

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

Example 69 with ReaderWay

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

Example 70 with ReaderWay

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

Aggregations

ReaderWay (com.graphhopper.reader.ReaderWay)157 Test (org.junit.jupiter.api.Test)119 IntsRef (com.graphhopper.storage.IntsRef)67 Test (org.junit.Test)24 EncodingManager (com.graphhopper.routing.util.EncodingManager)9 GraphBuilder (com.graphhopper.storage.GraphBuilder)9 ReaderRelation (com.graphhopper.reader.ReaderRelation)8 ConditionalTagInspector (com.graphhopper.reader.ConditionalTagInspector)7 Graph (com.graphhopper.storage.Graph)7 DateFormat (java.text.DateFormat)6 Date (java.util.Date)6 DecimalEncodedValue (com.graphhopper.routing.ev.DecimalEncodedValue)5 EdgeIteratorState (com.graphhopper.util.EdgeIteratorState)5 CarFlagEncoder (com.graphhopper.routing.util.CarFlagEncoder)4 PMap (com.graphhopper.util.PMap)4 BooleanEncodedValue (com.graphhopper.routing.ev.BooleanEncodedValue)3 DataFlagEncoder (com.graphhopper.routing.util.DataFlagEncoder)3 FlagEncoder (com.graphhopper.routing.util.FlagEncoder)3 GHPoint (com.graphhopper.util.shapes.GHPoint)3 LongIndexedContainer (com.carrotsearch.hppc.LongIndexedContainer)2