Ignore:
Timestamp:
2008-02-14T07:06:04+01:00 (17 years ago)
Author:
jrreid
Message:

Update lakewalker plugin to automatically break ways up into sections of length as specified in preferences

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/LakewalkerAction.java

    r6789 r6874  
    9595    target += " --top=" + topLeft.lat();
    9696    target += " --bottom=" + botRight.lat();
     97    target += " --waylength=" + Main.pref.get(LakewalkerPreferences.PREF_MAX_SEG, "500");
    9798    target += " --maxnodes=" + Main.pref.get(LakewalkerPreferences.PREF_MAX_NODES, "50000");
    9899    target += " --threshold=" + Main.pref.get(LakewalkerPreferences.PREF_THRESHOLD, "35");
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java

    r6789 r6874  
    7474   
    7575    pythonConfig.setValue(Main.pref.get(PREF_PYTHON, "python.exe"));
    76     maxSegsConfig.setValue(Main.pref.get(PREF_MAX_SEG, "250"));
     76    maxSegsConfig.setValue(Main.pref.get(PREF_MAX_SEG, "500"));
    7777    maxNodesConfig.setValue(Main.pref.get(PREF_MAX_NODES, "50000"));
    7878    thresholdConfig.setValue(Main.pref.get(PREF_THRESHOLD, "35"));
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java

    r6127 r6874  
    5959    try {
    6060       
    61       Node fn = null; //new Node(new LatLon(0,0));
     61          Node n = null;  // The current node being created
     62          Node tn = null; // The last node of the previous way
     63      Node fn = null; // Node to hold the first node in the trace
    6264       
    6365      while ((line = input.readLine()) != null) {
     
    7072        case 'n':
    7173          String[] tokens = line.split(" ");
    72           try {
    73             LatLon ll = new LatLon(Double.parseDouble(tokens[1])+northOffset, Double.parseDouble(tokens[2])+eastOffset);
    74             Node n = new Node(ll);
    75             commands.add(new AddCommand(n));
    76             way.nodes.add(n);
    77             if(fn==null){
    78                 fn = n;
    79             }
     74         
     75          if(tn==null){
     76                      try {             
     77                        LatLon ll = new LatLon(Double.parseDouble(tokens[1])+northOffset, Double.parseDouble(tokens[2])+eastOffset);
     78                        n = new Node(ll);
     79                        if(fn==null){
     80                          fn = n;
     81                        }
     82                        commands.add(new AddCommand(n));
     83                      }
     84                  catch (Exception ex) {
     85                         
     86                      }
     87         
     88          } else {
     89            // If there is a last node, and this node has the same coordinates
     90            // then we substitute for the previous node
     91                n = tn;
     92                tn = null;             
    8093          }
    81           catch (Exception ex) {
    82 
    83           }
     94             
     95              way.nodes.add(n);
     96         
    8497          break;
    8598
     
    99112         
    100113          break;
     114       
     115        case 't':       
     116                way = new Way();
     117                tn = n;
     118                break;
    101119         
    102120        case 'e':
     
    107125      }
    108126      input.close();
     127
     128      // Add the start node to the end of the trace to form a closed shape
    109129      way.nodes.add(fn);
    110130    }
Note: See TracChangeset for help on using the changeset viewer.