Changeset 1617 in josm


Ignore:
Timestamp:
2009-05-24T12:21:41+02:00 (16 years ago)
Author:
stoecker
Message:

fix #2645 - patch by Teemu Koskinen - cleanup relation role handling on way reversing

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/corrector/TagCorrector.java

    r1614 r1617  
    2121import org.openstreetmap.josm.Main;
    2222import org.openstreetmap.josm.command.ChangeCommand;
     23import org.openstreetmap.josm.command.ChangeRelationMemberRoleCommand;
    2324import org.openstreetmap.josm.command.Command;
    2425import org.openstreetmap.josm.data.osm.Node;
     
    168169                    List<RoleCorrection> roleCorrections = roleCorrectionMap
    169170                            .get(primitive);
    170                     for (Relation relation : Main.ds.relations) {
    171                         Relation newRelation = new Relation(relation);
    172                         Boolean changed = false;
    173171
    174                         for (int i = 0; i < roleCorrections.size(); i++) {
    175                             RoleCorrection roleCorrection = roleCorrections.get(i);
    176                             if (roleCorrection.relation == relation &&
    177                                     roleTableMap.get(primitive).getCorrectionTableModel().getApply(i)) {
    178 
    179                                 RelationMember member = newRelation.members.get(roleCorrection.position);
    180 
    181                                 if (member.equals(roleCorrection.member)) {
    182                                     member.role = roleCorrection.newRole;
    183                                     changed = true;
    184                                 }
    185                             }
     172                    for (int i = 0; i < roleCorrections.size(); i++) {
     173                        RoleCorrection roleCorrection = roleCorrections.get(i);
     174                        if (roleTableMap.get(primitive).getCorrectionTableModel().getApply(i)) {
     175                            commands.add(new ChangeRelationMemberRoleCommand(roleCorrection.relation, roleCorrection.position, roleCorrection.newRole));
    186176                        }
    187                         if (changed)
    188                             commands.add(new ChangeCommand(relation, newRelation));
    189177                    }
    190178                }
Note: See TracChangeset for help on using the changeset viewer.