Ignore:
Timestamp:
2009-11-27T21:46:49+01:00 (10 years ago)
Author:
jttt
Message:

Fixed #3704 Relation memberships are not handled at all when a way is splitted or deleted by deleting a segment, rewritten DeleteAction a bit (delete commands are no longer build in updateCursor())

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r2512 r2521  
    2323
    2424import org.openstreetmap.josm.Main;
     25import org.openstreetmap.josm.actions.SplitWayAction;
    2526import org.openstreetmap.josm.data.osm.BackreferencedDataSet;
    2627import org.openstreetmap.josm.data.osm.Node;
     
    253254    protected static Collection<Node> computeNodesToDelete(BackreferencedDataSet backreferences, OsmDataLayer layer, Collection<OsmPrimitive> primitivesToDelete) {
    254255        Collection<Node> nodesToDelete = new HashSet<Node>();
    255         //CollectBackReferencesVisitor v = new CollectBackReferencesVisitor(layer.data, false);
    256256        for (Way way : OsmPrimitive.getFilteredList(primitivesToDelete, Way.class)) {
    257257            for (Node n : way.getNodes()) {
     
    259259                    continue;
    260260                }
    261                 //v.initialize();
    262                 //n.visit(v);
    263261                Collection<OsmPrimitive> referringPrimitives = backreferences.getParents(n);
    264262                referringPrimitives.removeAll(primitivesToDelete);
     
    385383    public static Command deleteWaySegment(OsmDataLayer layer, WaySegment ws) {
    386384        if (ws.way.getNodesCount() < 3)
    387             return new DeleteCommand(layer, Collections.singleton(ws.way));
     385            return delete(layer, Collections.singleton(ws.way));
    388386
    389387        if (ws.way.firstNode() == ws.way.lastNode()) {
     
    416414            return new ChangeCommand(ws.way, wnew);
    417415        } else {
    418             Collection<Command> cmds = new LinkedList<Command>();
    419 
    420             wnew.setNodes(n1);
    421             cmds.add(new ChangeCommand(ws.way, wnew));
    422 
    423             Way wnew2 = new Way();
    424             wnew2.setKeys(wnew.getKeys());
    425             wnew2.setNodes(n2);
    426             cmds.add(new AddCommand(wnew2));
    427 
    428             // FIXME: relation memberships are not handled
    429 
    430             return new SequenceCommand(tr("Split way segment"), cmds);
     416            List<List<Node>> chunks = new ArrayList<List<Node>>(2);
     417            chunks.add(n1);
     418            chunks.add(n2);
     419            return SplitWayAction.splitWay(ws.way, chunks).getCommand();
    431420        }
    432421    }
Note: See TracChangeset for help on using the changeset viewer.