Search in sources :

Example 1 with OsmIteratorInput

use of de.topobyte.osm4j.core.access.OsmIteratorInput in project osm4j-core by topobyte.

the class TestNodeIterator method test.

@Test
public void test() throws IOException {
    InMemoryListDataSet data = ListDataSetLoader.read(createInput().createIterator(true, true), true, true, true);
    OsmIteratorInput input = createInput().createIterator(true, true);
    NodeIterator nodeIterator = new NodeIterator(input.getIterator());
    List<OsmNode> nodes = Lists.newArrayList(nodeIterator.iterator());
    input.close();
    assertEquals(data.getNodes().size(), nodes.size());
    for (int i = 0; i < nodes.size(); i++) {
        OsmNode a = nodes.get(i);
        OsmNode b = data.getNodes().get(i);
        assertTrue(EqualityUtil.equals(a, b));
    }
}
Also used : OsmNode(de.topobyte.osm4j.core.model.iface.OsmNode) OsmIteratorInput(de.topobyte.osm4j.core.access.OsmIteratorInput) InMemoryListDataSet(de.topobyte.osm4j.core.dataset.InMemoryListDataSet) Test(org.junit.Test)

Example 2 with OsmIteratorInput

use of de.topobyte.osm4j.core.access.OsmIteratorInput in project osm4j-core by topobyte.

the class TestRelationIterator method test.

@Test
public void test() throws IOException {
    InMemoryListDataSet data = ListDataSetLoader.read(createInput().createIterator(true, true), true, true, true);
    OsmIteratorInput input = createInput().createIterator(true, true);
    RelationIterator relationIterator = new RelationIterator(input.getIterator());
    List<OsmRelation> relations = Lists.newArrayList(relationIterator.iterator());
    input.close();
    assertEquals(data.getRelations().size(), relations.size());
    for (int i = 0; i < relations.size(); i++) {
        OsmRelation a = relations.get(i);
        OsmRelation b = data.getRelations().get(i);
        assertTrue(EqualityUtil.equals(a, b));
    }
}
Also used : OsmRelation(de.topobyte.osm4j.core.model.iface.OsmRelation) OsmIteratorInput(de.topobyte.osm4j.core.access.OsmIteratorInput) InMemoryListDataSet(de.topobyte.osm4j.core.dataset.InMemoryListDataSet) Test(org.junit.Test)

Example 3 with OsmIteratorInput

use of de.topobyte.osm4j.core.access.OsmIteratorInput in project osm4j-core by topobyte.

the class TestWayIterator method test.

@Test
public void test() throws IOException {
    InMemoryListDataSet data = ListDataSetLoader.read(createInput().createIterator(true, true), true, true, true);
    OsmIteratorInput input = createInput().createIterator(true, true);
    WayIterator wayIterator = new WayIterator(input.getIterator());
    List<OsmWay> ways = Lists.newArrayList(wayIterator.iterator());
    input.close();
    assertEquals(data.getWays().size(), ways.size());
    for (int i = 0; i < ways.size(); i++) {
        OsmWay a = ways.get(i);
        OsmWay b = data.getWays().get(i);
        assertTrue(EqualityUtil.equals(a, b));
    }
}
Also used : OsmWay(de.topobyte.osm4j.core.model.iface.OsmWay) OsmIteratorInput(de.topobyte.osm4j.core.access.OsmIteratorInput) InMemoryListDataSet(de.topobyte.osm4j.core.dataset.InMemoryListDataSet) Test(org.junit.Test)

Aggregations

OsmIteratorInput (de.topobyte.osm4j.core.access.OsmIteratorInput)3 InMemoryListDataSet (de.topobyte.osm4j.core.dataset.InMemoryListDataSet)3 Test (org.junit.Test)3 OsmNode (de.topobyte.osm4j.core.model.iface.OsmNode)1 OsmRelation (de.topobyte.osm4j.core.model.iface.OsmRelation)1 OsmWay (de.topobyte.osm4j.core.model.iface.OsmWay)1