* Relation to be sent.
*/
private void emitRelation(RelationContainer relationContainer) {
if (clipIncompleteEntities) {
RelationContainer filteredRelationContainer;
Relation filteredRelation;
filteredRelationContainer = relationContainer.getWriteableInstance();
filteredRelation = filteredRelationContainer.getEntity();
// Remove members for entities that are unavailable.
for (Iterator<RelationMember> i = filteredRelation.getMembers().iterator(); i.hasNext();) {
RelationMember member = i.next();
EntityType memberType;
long memberId;
memberType = member.getMemberType();
memberId = member.getMemberId();
switch (memberType) {
case Node:
if (!availableNodes.get(memberId)) {
i.remove();
}
break;
case Way:
if (!availableWays.get(memberId)) {
i.remove();
}
break;
case Relation:
if (!availableRelations.get(memberId)) {
i.remove();
}
break;
default:
break;
}
}
// Only add relations that contain entities.
if (filteredRelation.getMembers().size() > 0) {
sink.process(filteredRelationContainer);
}
} else {
sink.process(relationContainer);