Changeset 15959 in osm
- Timestamp:
- 2009-06-17T08:42:11+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java
r12778 r15959 290 290 } 291 291 292 /* 292 293 public ArrayList<double[]> douglasPeuckerNR(ArrayList<double[]> nodes, double epsilon){ 293 /*294 294 command_stack = [(0, len(nodes) - 1)] 295 295 … … 351 351 return [nodes[0], nodes[-1]]; 352 352 } 353 return nodes; 354 } 353 355 */ 354 return nodes; 355 } 356 357 public ArrayList<double[]> douglasPeucker(ArrayList<double[]> nodes, double epsilon){ 356 357 public ArrayList<double[]> douglasPeucker(ArrayList<double[]> nodes, double epsilon, int depth){ 358 358 359 359 // Check if node list is empty 360 if(nodes.size()<=1 ){360 if(nodes.size()<=1 || depth > 500){ 361 361 return nodes; 362 362 } … … 383 383 384 384 if(farthest_dist > epsilon){ 385 seg_a = douglasPeucker(sublist(nodes,0,farthest_node+1),epsilon );386 seg_b = douglasPeucker(sublist(nodes,farthest_node,nodes.size()-1),epsilon );385 seg_a = douglasPeucker(sublist(nodes,0,farthest_node+1),epsilon, depth+1); 386 seg_b = douglasPeucker(sublist(nodes,farthest_node,nodes.size()-1),epsilon,depth+1); 387 387 388 388 new_nodes.addAll(seg_a); -
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerApp.java
r12778 r15959 48 48 System.out.println("After vertex reduction, "+nodelist.size()+" nodes remain."); 49 49 50 nodelist = lw.douglasPeucker(nodelist, dp );50 nodelist = lw.douglasPeucker(nodelist, dp, 0); 51 51 52 52 System.out.println("After dp approximation, "+nodelist.size()+" nodes remain."); -
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.java
r12778 r15959 1 1 package org.openstreetmap.josm.plugins.lakewalker; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 class LakewalkerException extends Exception { … … 6 8 public LakewalkerException(){ 7 9 super(); 8 this.error = "An unknown error has occured";10 this.error = tr("An unknown error has occurred"); 9 11 } 10 12
Note:
See TracChangeset
for help on using the changeset viewer.