private boolean isRequiredWay(Way way) { long wayId = way.getId(); if (requiredWays.get(wayId)) return true; return usedByTag && !isEmptyTagSet(way.getTags()); }
private void sendNodes() { // mark all nodes as required ReleasableIterator<WayContainer> wayIterator = allWays.iterate(); while (wayIterator.hasNext()) { Way way = wayIterator.next().getEntity(); if (!isRequiredWay(way)) continue; for (WayNode nodeReference : way.getWayNodes()) { long nodeId = nodeReference.getNodeId(); requiredNodes.set(nodeId); } } wayIterator.release(); ReleasableIterator<NodeContainer> nodeIterator = allNodes.iterate(); while (nodeIterator.hasNext()) { NodeContainer nodeContainer = nodeIterator.next(); if (!isRequiredNode(nodeContainer.getEntity())) { continue; } sink.process(nodeContainer); } nodeIterator.release(); }