/** * Extract and store relation information based on the relation member * * @param src The relation member to store information about */ public RelMember(RelationMember src) { role = src.getRole(); type = src.getType(); rel_id = 0; coor = new ArrayList<LatLon>(); if (src.isNode()) { Node r = src.getNode(); tags = r.getKeys(); coor = new ArrayList<LatLon>(1); coor.add(r.getCoor()); } if (src.isWay()) { Way r = src.getWay(); tags = r.getKeys(); List<Node> wNodes = r.getNodes(); coor = new ArrayList<LatLon>(wNodes.size()); for (Node wNode : wNodes) { coor.add(wNode.getCoor()); } } if (src.isRelation()) { Relation r = src.getRelation(); tags = r.getKeys(); rel_id = r.getId(); coor = new ArrayList<LatLon>(); } }
@Override public void visit(Relation r) { if (!r.isUsable() || r.hasIncompleteMembers()) return; List<RelationMember> rMembers = r.getMembers(); Map<String, String> rkeys = r.getKeys(); for (String key : ignoreKeys) rkeys.remove(key); RelationPair rKey = new RelationPair(rMembers, rkeys); relations.put(rKey, r); relations_nokeys.put(rMembers, r); }