Changeset 17205 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-10-15T15:17:57+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r17188 r17205 23 23 import org.openstreetmap.josm.command.AddCommand; 24 24 import org.openstreetmap.josm.command.ChangeCommand; 25 import org.openstreetmap.josm.command.ChangeMembersCommand; 25 26 import org.openstreetmap.josm.command.ChangeNodesCommand; 26 27 import org.openstreetmap.josm.command.Command; … … 298 299 * @param cmds List of commands that will contain the new "add node" command 299 300 * @param newNodes List of nodes that will contain the new node 300 * @return new way The modified way. Change command must be handled by the caller301 * @return The modified list of way nodes. Change command must be handled by the caller 301 302 */ 302 303 private static List<Node> modifyWay(Node originalNode, Way w, List<Command> cmds, List<Node> newNodes) { … … 332 333 continue; 333 334 } 334 Relation newRel = new Relation(r);335 List<RelationMember> newMembers = new ArrayList<>(r.getMembers()); 335 336 // loop backwards because we add or remove members, works also when nodes appear 336 337 // multiple times in the same relation … … 341 342 continue; 342 343 for (Node n : newNodes) { 343 new Rel.addMember(i + 1, new RelationMember(rm.getRole(), n));344 newMembers.add(i + 1, new RelationMember(rm.getRole(), n)); 344 345 } 345 346 if (ExistingBothNew.NEW == memberships) { 346 347 // remove old member 347 new Rel.removeMember(i);348 newMembers.remove(i); 348 349 } 349 350 changed = true; 350 351 } 351 352 if (changed) { 352 cmds.add(new Change Command(r, newRel));353 cmds.add(new ChangeMembersCommand(r, newMembers)); 353 354 } 354 355 } -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r17138 r17205 29 29 import org.openstreetmap.josm.data.osm.PrimitiveData; 30 30 import org.openstreetmap.josm.data.osm.Relation; 31 import org.openstreetmap.josm.data.osm.RelationMember; 31 32 import org.openstreetmap.josm.data.osm.RelationToChildReference; 32 33 import org.openstreetmap.josm.data.osm.Way; … … 307 308 if (!silent && !callback.checkAndConfirmOutlyingDelete(parents, null)) 308 309 return null; 309 return new DeleteCommand(parents .iterator().next().getDataSet(), parents);310 return new DeleteCommand(parents); 310 311 } 311 312 … … 457 458 .collect(Collectors.toSet()); 458 459 for (Relation cur : relationsToBeChanged) { 459 Relation rel = new Relation(cur);460 rel.removeMembersFor(primitivesToDelete);461 cmds.add(new Change Command(cur, rel));460 List<RelationMember> newMembers = cur.getMembers(); 461 cur.getMembersFor(primitivesToDelete).forEach(newMembers::remove); 462 cmds.add(new ChangeMembersCommand(cur, newMembers)); 462 463 } 463 464 … … 465 466 // 466 467 if (!primitivesToDelete.isEmpty()) { 467 cmds.add(new DeleteCommand(primitivesToDelete .iterator().next().getDataSet(), primitivesToDelete));468 cmds.add(new DeleteCommand(primitivesToDelete)); 468 469 } 469 470
Note:
See TracChangeset
for help on using the changeset viewer.