Changeset 15959 in osm


Ignore:
Timestamp:
2009-06-17T08:42:11+02:00 (15 years ago)
Author:
stoecker
Message:

close #1733

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  
    290290    }
    291291
     292        /*
    292293    public ArrayList<double[]> douglasPeuckerNR(ArrayList<double[]> nodes, double epsilon){
    293         /*
    294294        command_stack = [(0, len(nodes) - 1)]
    295295
     
    351351            return [nodes[0], nodes[-1]];
    352352        }
     353        return nodes;
     354    }
    353355        */
    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){
    358358
    359359        // Check if node list is empty
    360         if(nodes.size()<=1){
     360        if(nodes.size()<=1 || depth > 500){
    361361            return nodes;
    362362        }
     
    383383
    384384        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);
    387387
    388388            new_nodes.addAll(seg_a);
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerApp.java

    r12778 r15959  
    4848        System.out.println("After vertex reduction, "+nodelist.size()+" nodes remain.");
    4949
    50         nodelist = lw.douglasPeucker(nodelist, dp);
     50        nodelist = lw.douglasPeucker(nodelist, dp, 0);
    5151
    5252        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  
    11package org.openstreetmap.josm.plugins.lakewalker;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35class LakewalkerException extends Exception {
     
    68    public LakewalkerException(){
    79        super();
    8         this.error = "An unknown error has occured";
     10        this.error = tr("An unknown error has occurred");
    911    }
    1012
Note: See TracChangeset for help on using the changeset viewer.