Changeset 7152 in josm for trunk/src/org
- Timestamp:
- 2014-05-20T19:04:32+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r7005 r7152 11 11 import java.util.Collection; 12 12 import java.util.Collections; 13 import java.util.HashMap; 13 14 import java.util.HashSet; 14 15 import java.util.LinkedList; 15 16 import java.util.List; 17 import java.util.Map; 16 18 import java.util.Set; 17 19 … … 325 327 private void fixRelations(Node originalNode, List<Command> cmds, List<Node> newNodes) { 326 328 // modify all relations containing the node 327 Relation newRel = null;328 HashSet<String> rolesToReAdd = null;329 329 for (Relation r : OsmPrimitive.getFilteredList(originalNode.getReferrers(), Relation.class)) { 330 330 if (r.isDeleted()) { 331 331 continue; 332 332 } 333 newRel = null; 334 rolesToReAdd = null; 333 Relation newRel = null; 334 HashMap<String, Integer> rolesToReAdd = null; // <role name, index> 335 int i = 0; 335 336 for (RelationMember rm : r.getMembers()) { 336 337 if (rm.isNode() && rm.getMember() == originalNode) { 337 338 if (newRel == null) { 338 339 newRel = new Relation(r); 339 rolesToReAdd = new Hash Set<>();340 rolesToReAdd = new HashMap<>(); 340 341 } 341 rolesToReAdd.add(rm.getRole()); 342 } 342 rolesToReAdd.put(rm.getRole(), i); 343 } 344 i++; 343 345 } 344 346 if (newRel != null) { 345 347 for (Node n : newNodes) { 346 for ( String role : rolesToReAdd) {347 newRel.addMember( new RelationMember(role, n));348 for (Map.Entry<String, Integer> role : rolesToReAdd.entrySet()) { 349 newRel.addMember(role.getValue() + 1, new RelationMember(role.getKey(), n)); 348 350 } 349 351 }
Note:
See TracChangeset
for help on using the changeset viewer.