 Timestamp:
 20100217T08:17:23+01:00 (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r2976 r2999 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.util.ArrayList; 10 11 import java.util.Collection; 11 12 import java.util.Collections; … … 216 217 int lower = 0; 217 218 int i = 0; 218 List<Node> newNodes = new LinkedList<Node>();219 List<Node> newNodes = new ArrayList<Node>(w.getNodesCount()); 219 220 while(i < w.getNodesCount()){ 220 221 if (isRequiredNode(w,w.getNode(i))) { … … 232 233 } 233 234 // ... and simplify them 234 buildSimplifiedNodeList(w , lower, Math.min(w.getNodesCount()1, i), threshold,newNodes);235 buildSimplifiedNodeList(w.getNodes(), lower, Math.min(w.getNodesCount()1, i), threshold,newNodes); 235 236 lower=i; 236 237 i++; … … 260 261 * @param threshold 261 262 */ 262 protected void buildSimplifiedNodeList(Way wnew, int from, int to, double threshold, List<Node> simplifiedNodes) { 263 264 Node fromN = wnew.getNode(from); 265 Node toN = wnew.getNode(to); 266 263 protected void buildSimplifiedNodeList(List<Node> wnew, int from, int to, double threshold, List<Node> simplifiedNodes) { 264 265 Node fromN = wnew.get(from); 266 Node toN = wnew.get(to); 267 268 // Get max xte 267 269 int imax = 1; 268 270 double xtemax = 0; 269 271 for (int i = from + 1; i < to; i++) { 270 Node n = wnew.get Node(i);272 Node n = wnew.get(i); 271 273 double xte = Math.abs(EARTH_RAD 272 274 * xtd(fromN.getCoor().lat() * Math.PI / 180, fromN.getCoor().lon() * Math.PI / 180, toN.getCoor().lat() * Math.PI … … 280 282 281 283 if (imax != 1 && xtemax >= threshold) { 284 // Segment cannot be simplified  try shorter segments 282 285 buildSimplifiedNodeList(wnew, from, imax,threshold,simplifiedNodes); 283 simplifiedNodes.add(wnew.getNode(imax));286 //simplifiedNodes.add(wnew.get(imax)); 284 287 buildSimplifiedNodeList(wnew, imax, to, threshold,simplifiedNodes); 285 288 } else { 289 // Simplify segment 286 290 if (simplifiedNodes.isEmpty()  simplifiedNodes.get(simplifiedNodes.size()1) != fromN) { 287 291 simplifiedNodes.add(fromN); 288 292 } 289 if ( simplifiedNodes.isEmpty()  simplifiedNodes.get(simplifiedNodes.size()1)!= toN) {293 if (fromN != toN) { 290 294 simplifiedNodes.add(toN); 291 295 }
Note: See TracChangeset
for help on using the changeset viewer.