Package org.openstreetmap.josm.data.osm

Examples of org.openstreetmap.josm.data.osm.RelationData


     * Remembers a relation in the hull
     *
     * @param r the relation
     */
    protected void rememberRelation(Relation r) {
        RelationData clone;
        if (isAlreadyRemembered(r)) {
            clone = (RelationData)mappedPrimitives.get(r);
        } else {
            clone = r.save();
            mappedPrimitives.put(r, clone);
        }

        List<RelationMemberData> newMembers = new ArrayList<>();
        for (RelationMember member: r.getMembers()) {
            newMembers.add(
                    new RelationMemberData(member.getRole(), mappedPrimitives.get(member.getMember())));

        }
        clone.setMembers(newMembers);
    }
View Full Code Here


    }

    protected void rememberRelationPartial(Relation r) {
        if (isAlreadyRemembered(r))
            return;
        RelationData clone = r.save();
        clone.getMembers().clear();
        mappedPrimitives.put(r, clone);
    }
View Full Code Here

                                    toLoadNext.put(n, date);
                                }
                            }
                            break;
                        case RELATION:
                            data = new RelationData();
                            List<RelationMemberData> members = ((HistoryRelation)hp).getMembers();
                            ((RelationData)data).setMembers(members);
                            break;
                        default: throw new AssertionError("Unknown primitive type");
                        }
View Full Code Here

                    // user clears undo/redo buffer after purge
                    PrimitiveData empty;
                    switch(osm.getType()) {
                    case NODE: empty = new NodeData(); break;
                    case WAY: empty = new WayData(); break;
                    case RELATION: empty = new RelationData(); break;
                    default: throw new AssertionError();
                    }
                    empty.setId(osm.getUniqueId());
                    empty.setIncomplete(true);
                    osm.load(empty);
View Full Code Here

        jumpToEnd();
        return id;
    }

    protected Relation parseRelation() throws XMLStreamException {
        RelationData rd = new RelationData();
        readCommon(rd);
        Relation r = new Relation(rd.getId(), rd.getVersion());
        r.setVisible(rd.isVisible());
        r.load(rd);
        externalIdMap.put(rd.getPrimitiveId(), r);

        Collection<RelationMemberData> members = new ArrayList<>();
        while (true) {
            int event = parser.next();
            if (event == XMLStreamConstants.START_ELEMENT) {
                switch (parser.getLocalName()) {
                case "member":
                    members.add(parseRelationMember(r));
                    break;
                case "tag":
                    parseTag(r);
                    break;
                default:
                    parseUnknown();
                }
            } else if (event == XMLStreamConstants.END_ELEMENT) {
                break;
            }
        }
        if (r.isDeleted() && !members.isEmpty()) {
            Main.info(tr("Deleted relation {0} contains members", r.getUniqueId()));
            members = new ArrayList<>();
        }
        relations.put(rd.getUniqueId(), members);
        return r;
    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.osm.RelationData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.