use of com.slimjars.dist.gnu.trove.set.TLongSet in project osm4j-core by topobyte.
the class EntityFinderLogMissing method findMemberRelationsRecursively.
private void findMemberRelationsRecursively(Deque<OsmRelation> queue, Set<OsmRelation> outRelations) {
TLongSet ids = new TLongHashSet();
while (!queue.isEmpty()) {
OsmRelation relation = queue.remove();
for (OsmRelationMember member : OsmModelUtil.membersAsList(relation)) {
if (member.getType() != EntityType.Relation) {
continue;
}
long id = member.getId();
if (ids.contains(id)) {
continue;
}
ids.add(id);
try {
OsmRelation child = entityProvider.getRelation(id);
outRelations.add(child);
queue.add(child);
} catch (EntityNotFoundException e) {
logRelationNotFound(id);
}
}
}
}
use of com.slimjars.dist.gnu.trove.set.TLongSet in project osm4j-core by topobyte.
the class EntityFinderThrowMissing method findMemberRelationsRecursively.
private void findMemberRelationsRecursively(Deque<OsmRelation> queue, Set<OsmRelation> outRelations) throws EntityNotFoundException {
TLongSet ids = new TLongHashSet();
while (!queue.isEmpty()) {
OsmRelation relation = queue.remove();
for (OsmRelationMember member : OsmModelUtil.membersAsList(relation)) {
if (member.getType() != EntityType.Relation) {
continue;
}
long id = member.getId();
if (ids.contains(id)) {
continue;
}
ids.add(id);
OsmRelation child = entityProvider.getRelation(id);
outRelations.add(child);
queue.add(child);
}
}
}
use of com.slimjars.dist.gnu.trove.set.TLongSet in project osm4j-core by topobyte.
the class IdDataSetReader method read.
public static InMemorySetIdDataSet read(OsmIdReader reader) throws OsmInputException {
final InMemorySetIdDataSet dataSet = new InMemorySetIdDataSet();
final TLongSet nodeIds = dataSet.getNodeIds();
final TLongSet wayIds = dataSet.getWayIds();
final TLongSet relationIds = dataSet.getRelationIds();
reader.setIdHandler(new OsmIdHandler() {
@Override
public void handle(OsmBounds bounds) throws IOException {
dataSet.setBounds(bounds);
}
@Override
public void handleNode(long id) throws IOException {
nodeIds.add(id);
}
@Override
public void handleWay(long id) throws IOException {
wayIds.add(id);
}
@Override
public void handleRelation(long id) throws IOException {
relationIds.add(id);
}
@Override
public void complete() throws IOException {
// nothing to do here
}
});
reader.read();
return dataSet;
}
Aggregations