Package org.openstreetmap.josm.data.osm

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


    }

    @Override
    protected void setValueAt(DefaultTableModel model, Object value, int row, int col) {
        if (model == getMergedTableModel() && col == 1) {
            RelationMember memberOld = getMergedEntries().get(row);
            RelationMember memberNew = new RelationMember((String)value,memberOld.getMember());
            getMergedEntries().remove(row);
            getMergedEntries().add(row,memberNew);
            fireModelDataChanged();
        }
    }
View Full Code Here


        fireModelDataChanged();
    }

    @Override
    protected RelationMember cloneEntryForMergedList(RelationMember entry) {
        return new RelationMember(entry.getRole(), getMyPrimitive(entry));
    }
View Full Code Here

    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
        // Do not edit empty or incomplete members ! (fix #5374 and #6315)
        if (value == null)
            return null;

        RelationMember member = (RelationMember)value;

        editor.setText(member.getRole());
        editor.selectAll();
        return editor;
    }
View Full Code Here

    protected Command buildResolveCommand(Relation relation, OsmPrimitive newPrimitive) {
        final Relation modifiedRelation = new Relation(relation);
        modifiedRelation.setMembers(null);
        boolean isChanged = false;
        for (int i=0; i < relation.getMembersCount(); i++) {
            final RelationMember member = relation.getMember(i);
            RelationMemberConflictDecision decision = getDecision(relation, i);
            if (decision == null) {
                modifiedRelation.addMember(member);
            } else {
                switch(decision.getDecision()) {
                case KEEP:
                    final RelationMember newMember = new RelationMember(decision.getRole(),newPrimitive);
                    modifiedRelation.addMember(newMember);
                    isChanged |= ! member.equals(newMember);
                    break;
                case REMOVE:
                    isChanged = true;
View Full Code Here

        if (inner.isEmpty()) return null;
        // Create new multipolygon relation and add all inner ways to it
        Relation newRel = new Relation();
        newRel.put("type", "multipolygon");
        for (Way w : inner) {
            newRel.addMember(new RelationMember("inner", w));
        }
        cmds.add(new AddCommand(newRel));
        addedRelations.add(newRel);

        // We don't add outer to the relation because it will be handed to fixRelations()
View Full Code Here

                multiouters.add(r);
                continue;
            }
            // Add it back!
            Relation newRel = new Relation(r.rel);
            newRel.addMember(new RelationMember(r.role, outer));
            cmds.add(new ChangeCommand(r.rel, newRel));
        }

        Relation newRel;
        switch (multiouters.size()) {
        case 0:
            return;
        case 1:
            // Found only one to be part of a multipolygon relation, so just add it back as well
            newRel = new Relation(multiouters.get(0).rel);
            newRel.addMember(new RelationMember(multiouters.get(0).role, outer));
            cmds.add(new ChangeCommand(multiouters.get(0).rel, newRel));
            return;
        default:
            // Create a new relation with all previous members and (Way)outer as outer.
            newRel = new Relation();
            for (RelationRole r : multiouters) {
                // Add members
                for (RelationMember rm : r.rel.getMembers())
                    if (!newRel.getMembers().contains(rm)) {
                        newRel.addMember(rm);
                    }
                // Add tags
                for (String key : r.rel.keySet()) {
                    newRel.put(key, r.rel.get(key));
                }
                // Delete old relation
                relationsToDelete.add(r.rel);
            }
            newRel.addMember(new RelationMember("outer", outer));
            cmds.add(new AddCommand(newRel));
        }
    }
View Full Code Here

                i++;
            }
            if (newRel != null) {
                for (Node n : newNodes) {
                    for (Map.Entry<String, Integer> role : rolesToReAdd.entrySet()) {
                        newRel.addMember(role.getValue() + 1, new RelationMember(role.getKey(), n));
                    }
                }
                cmds.add(new ChangeCommand(r, newRel));
            }
        }
View Full Code Here

        if (position < 0 || position >= relation.getMembersCount())
            return false;

        oldRole = relation.getMember(position).getRole();
        if (newRole.equals(oldRole)) return true;
        relation.setMember(position, new RelationMember(newRole, relation.getMember(position).getMember()));

        oldModified = relation.isModified();
        relation.setModified(true);
        return true;
    }
View Full Code Here

        return true;
    }

    @Override
    public void undoCommand() {
        relation.setMember(position, new RelationMember(oldRole, relation.getMember(position).getMember()));
        relation.setModified(oldModified);
    }
View Full Code Here

                if (e.parent != null) return;

                if (!left.matches(e.withPrimitive(r)))
                    return;
                for (int i=0; i < r.getMembersCount(); i++) {
                    RelationMember m = r.getMember(i);
                    if (m.getMember().equals(e.osm)) {
                        if (link.matches(e.withParentAndIndexAndLinkContext(r, i))) {
                            e.parent = r;
                            e.index = i;
                            return;
                        }
View Full Code Here

TOP

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

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.