Search in sources :

Example 1 with IdContainer

use of de.topobyte.osm4j.core.model.iface.IdContainer in project osm4j-core by topobyte.

the class IdDataSetReader method read.

public static InMemorySetIdDataSet read(OsmIdIterator iterator) throws IOException {
    InMemorySetIdDataSet dataSet = new InMemorySetIdDataSet();
    TLongSet nodeIds = dataSet.getNodeIds();
    TLongSet wayIds = dataSet.getWayIds();
    TLongSet relationIds = dataSet.getRelationIds();
    if (iterator.hasBounds()) {
        dataSet.setBounds(iterator.getBounds());
    }
    while (iterator.hasNext()) {
        IdContainer container = iterator.next();
        switch(container.getType()) {
            case Node:
                nodeIds.add(container.getId());
                break;
            case Way:
                wayIds.add(container.getId());
                break;
            case Relation:
                relationIds.add(container.getId());
                break;
        }
    }
    return dataSet;
}
Also used : TLongSet(com.slimjars.dist.gnu.trove.set.TLongSet) IdContainer(de.topobyte.osm4j.core.model.iface.IdContainer)

Aggregations

TLongSet (com.slimjars.dist.gnu.trove.set.TLongSet)1 IdContainer (de.topobyte.osm4j.core.model.iface.IdContainer)1