Changeset 699 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-07-10T11:48:15+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r627 r699 148 148 } 149 149 150 Way newWay = new Way(selectedWays.get(0)); 150 // Find the most appropriate way to modify. 151 152 // Eventually this might want to be the way with the longest 153 // history or the longest selected way but for now just attempt 154 // to reuse an existing id. 155 Way modifyWay = selectedWays.peek(); 156 for (Way w : selectedWays) { 157 modifyWay = w; 158 if (w.id != 0) break; 159 } 160 Way newWay = new Way(modifyWay); 161 151 162 newWay.nodes.clear(); 152 163 newWay.nodes.addAll(nodeList); … … 179 190 180 191 LinkedList<Command> cmds = new LinkedList<Command>(); 181 cmds.add(new DeleteCommand(selectedWays.subList(1, selectedWays.size()))); 182 cmds.add(new ChangeCommand(selectedWays.peek(), newWay)); 192 LinkedList<Way> deletedWays = new LinkedList<Way>(selectedWays); 193 deletedWays.remove(modifyWay); 194 cmds.add(new DeleteCommand(deletedWays)); 195 cmds.add(new ChangeCommand(modifyWay, newWay)); 183 196 184 197 // modify all relations containing the now-deleted ways … … 197 210 } 198 211 for (String role : rolesToReAdd) { 199 newRel.members.add(new RelationMember(role, selectedWays.peek()));212 newRel.members.add(new RelationMember(role, modifyWay)); 200 213 } 201 214 cmds.add(new ChangeCommand(r, newRel)); 202 215 } 203 216 Main.main.undoRedo.add(new SequenceCommand(tr("Combine {0} ways", selectedWays.size()), cmds)); 204 Main.ds.setSelected( selectedWays.peek());217 Main.ds.setSelected(modifyWay); 205 218 } 206 219
Note:
See TracChangeset
for help on using the changeset viewer.