Changeset 6411 in josm for trunk/src/org/openstreetmap/josm/actions
 Timestamp:
 20131125T02:03:59+01:00 (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r6380 r6411 35 35 /** 36 36 * Delete unnecessary nodes from a way 37 * @since 2575 37 38 */ 38 39 public class SimplifyWayAction extends JosmAction { … … 110 111 Collection<Command> allCommands = new LinkedList<Command>(); 111 112 for (Way way: ways) { 112 SequenceCommand simplifyCommand = simplifyWay(way , ds);113 SequenceCommand simplifyCommand = simplifyWay(way); 113 114 if (simplifyCommand == null) { 114 115 continue; … … 152 153 153 154 /** 154 * Simplifies a way 155 * Simplifies a way with default threshold (read from preferences). 155 156 * 156 157 * @param w the way to simplify 157 */ 158 public SequenceCommand simplifyWay(Way w, DataSet ds) { 159 double threshold = Main.pref.getDouble("simplifyway.maxerror", 3.0); 158 * @return The sequence of commands to run 159 * @since 6411 160 */ 161 public final SequenceCommand simplifyWay(Way w) { 162 return simplifyWay(w, Main.pref.getDouble("simplifyway.maxerror", 3.0)); 163 } 164 165 /** 166 * Simplifies a way with a given threshold. 167 * 168 * @param w the way to simplify 169 * @return The sequence of commands to run 170 * @since 6411 171 */ 172 public SequenceCommand simplifyWay(Way w, double threshold) { 160 173 int lower = 0; 161 174 int i = 0; … … 163 176 while(i < w.getNodesCount()){ 164 177 if (isRequiredNode(w,w.getNode(i))) { 165 // copy a required node to the list of new nodes. Simplify not 166 // possible 178 // copy a required node to the list of new nodes. Simplify not possible 167 179 newNodes.add(w.getNode(i)); 168 180 i++; … … 192 204 cmds.add(new ChangeCommand(w, newWay)); 193 205 cmds.add(new DeleteCommand(delNodes)); 194 ds.clearSelection(delNodes);206 w.getDataSet().clearSelection(delNodes); 195 207 return new SequenceCommand(trn("Simplify Way (remove {0} node)", "Simplify Way (remove {0} nodes)", delNodes.size(), delNodes.size()), cmds); 196 208 }
Note: See TracChangeset
for help on using the changeset viewer.