- Timestamp:
- 2010-09-18T13:06:48+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r3242 r3538 193 193 /** 194 194 * Checks if the selection consists of something we can work with. 195 * Checks only if the number and type of items selected looks good; 196 * does not check whether the selected items are really a valid 197 * input for splitting (this would be too expensive to be carried 198 * out from the selectionChanged listener). 195 * Checks only if the number and type of items selected looks good. 199 196 * 200 197 * If this method returns "true", selectedNode and selectedWay will … … 233 230 /** 234 231 * Checks if the selection consists of something we can work with. 235 * Checks only if the number and type of items selected looks good; 236 * does not check whether the selected items are really a valid 237 * input for splitting (this would be too expensive to be carried 238 * out from the selectionChanged listener). 232 * Checks only if the number and type of items selected looks good. 239 233 * 240 234 * Returns true if one way and any number of nodes that are part of … … 347 341 private void unglueWays() { 348 342 LinkedList<Command> cmds = new LinkedList<Command>(); 349 List<Node> newNodes = new LinkedList<Node>(); 343 LinkedList<Node> newNodes = new LinkedList<Node>(); 350 344 351 345 if (selectedWay == null) { 352 boolean firstway = true; 353 // modify all ways containing the nodes 354 for (Way w : OsmPrimitive.getFilteredList(selectedNode.getReferrers(), Way.class)) { 355 if (w.isDeleted() || w.isIncomplete()) { 356 continue; 357 } 358 if (!firstway) { 359 cmds.add(new ChangeCommand(w, modifyWay(selectedNode, w, cmds, newNodes))); 360 } 361 firstway = false; 346 Way wayWithSelectedNode = null; 347 LinkedList<Way> parentWays = new LinkedList<Way>(); 348 for (OsmPrimitive osm : selectedNode.getReferrers()) { 349 if (osm.isUsable() && osm instanceof Way) { 350 Way w = (Way) osm; 351 if (wayWithSelectedNode == null && !w.isFirstLastNode(selectedNode)) { 352 wayWithSelectedNode = w; 353 } else { 354 parentWays.add(w); 355 } 356 } 357 } 358 if (wayWithSelectedNode == null) { 359 wayWithSelectedNode = parentWays.removeFirst(); 360 } 361 for (Way w : parentWays) { 362 cmds.add(new ChangeCommand(w, modifyWay(selectedNode, w, cmds, newNodes))); 362 363 } 363 364 } else { … … 368 369 369 370 Main.main.undoRedo.add(new SequenceCommand(tr("Dupe into {0} nodes", newNodes.size()+1), cmds)); 370 if (selectedWay == null) { // if a node has been selected, new selection is ALL nodes 371 newNodes.add(selectedNode); 372 } // if a node and a way has been selected, new selection is only the new node that was added to the selected way 373 getCurrentDataSet().setSelected(newNodes); 371 // select one of the new nodes 372 getCurrentDataSet().setSelected(newNodes.getFirst()); 374 373 } 375 374
Note:
See TracChangeset
for help on using the changeset viewer.