Search in sources :

Example 11 with ReaderRelation

use of com.graphhopper.reader.ReaderRelation in project graphhopper by graphhopper.

the class OSMReaderTest method testRelation.

@Test
public void testRelation() {
    EncodingManager manager = EncodingManager.create("bike");
    ReaderRelation osmRel = new ReaderRelation(1);
    osmRel.add(new ReaderRelation.Member(ReaderRelation.WAY, 1, ""));
    osmRel.add(new ReaderRelation.Member(ReaderRelation.WAY, 2, ""));
    osmRel.setTag("route", "bicycle");
    osmRel.setTag("network", "lcn");
    IntsRef flags = manager.createRelationFlags();
    manager.handleRelationTags(osmRel, flags);
    assertFalse(flags.isEmpty());
    // unchanged network
    IntsRef before = IntsRef.deepCopyOf(flags);
    manager.handleRelationTags(osmRel, flags);
    assertEquals(before, flags);
    // overwrite network
    osmRel.setTag("network", "ncn");
    manager.handleRelationTags(osmRel, flags);
    assertNotEquals(before, flags);
}
Also used : ReaderRelation(com.graphhopper.reader.ReaderRelation) Test(org.junit.jupiter.api.Test) GraphHopperTest(com.graphhopper.GraphHopperTest)

Aggregations

ReaderRelation (com.graphhopper.reader.ReaderRelation)11 Test (org.junit.jupiter.api.Test)9 ReaderWay (com.graphhopper.reader.ReaderWay)8 IntsRef (com.graphhopper.storage.IntsRef)7 GraphHopperTest (com.graphhopper.GraphHopperTest)1 Osmformat (org.openstreetmap.osmosis.osmbinary.Osmformat)1