Ignore:
Timestamp:
2007-12-21T03:27:11+01:00 (17 years ago)
Author:
jrreid
Message:

Add preference to select the default tag applied to the ways, and correct a bug that resulted in the ways not being closed. Also update build.xml to call javac to compile automatically.

Location:
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java

    r5979 r6127  
    1414
    1515  public static final String[] DIRECTIONS = new String[] {"east", "northeast", "north", "northwest", "west", "southwest", "south", "southeast"};
     16  public static final String[] WAYTYPES = new String[] {"water", "coastline", "land", "none"};
    1617
    1718  public static final String PREF_PYTHON = "lakewalker.python";
     
    2526  public static final String PREF_NORTH_OFFSET = "lakewalker.north_offset";
    2627  public static final String PREF_START_DIR = "lakewalker.startdir";
     28  public static final String PREF_WAYTYPE = "lakewalker.waytype";
    2729   
    2830  protected StringConfigurer pythonConfig = new StringConfigurer();
     
    4547  protected JLabel northOffsetLabel = new JLabel(tr("Shift all traces to north (degrees)"));
    4648  protected StringEnumConfigurer startDirConfig = new StringEnumConfigurer(DIRECTIONS);
    47   protected JLabel startDirLabel = new JLabel(tr("Direction to search for land"));
     49  protected JLabel startDirLabel = new JLabel(tr("Direction to search for land")); 
     50  protected StringEnumConfigurer lakeTypeConfig = new StringEnumConfigurer(WAYTYPES);
     51  protected JLabel lakeTypeLabel = new JLabel(tr("Tag ways as"));
    4852 
    4953  public void addGui(PreferenceDialog gui) {
     
    5761    eastOffsetConfig.setToolTipText(tr("Offset all points in East direction (degrees). Default 0."));   
    5862    northOffsetConfig.setToolTipText(tr("Offset all points in North direction (degrees). Default 0."));   
    59     startDirConfig.setToolTipText(tr("Direction to search for land. Default east."));   
     63    startDirConfig.setToolTipText(tr("Direction to search for land. Default east."));
     64    lakeTypeConfig.setToolTipText(tr("Tag ways as water, coastline, land or nothing. Default is water."));
    6065
    6166    String description = tr("An interlude to the Lakewalker Python module to trace water bodies on Landsat imagery.<br><br>Version: {0}", LakewalkerPlugin.VERSION);
     
    7378    northOffsetConfig.setValue(Main.pref.get(PREF_NORTH_OFFSET, "0.0"));
    7479    startDirConfig.setValue(Main.pref.get(PREF_START_DIR, "east"));
     80    lakeTypeConfig.setValue(Main.pref.get(PREF_WAYTYPE, "water"));
    7581  }
    7682 
     
    98104    prefPanel.add(northOffsetConfig.getControls(), dataConstraints);
    99105    prefPanel.add(startDirLabel, labelConstraints);
    100     prefPanel.add(startDirConfig.getControls(), dataConstraints);
     106    prefPanel.add(startDirConfig.getControls(), dataConstraints);   
     107    prefPanel.add(lakeTypeLabel, labelConstraints);
     108    prefPanel.add(lakeTypeConfig.getControls(), dataConstraints);
    101109  }
    102110
     
    115123    Main.pref.put(PREF_NORTH_OFFSET, northOffsetConfig.getValueString());
    116124    Main.pref.put(PREF_START_DIR, startDirConfig.getValueString());
     125    Main.pref.put(PREF_WAYTYPE, lakeTypeConfig.getValueString());
    117126  }
    118127 
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java

    r5979 r6127  
    5858   
    5959    try {
     60       
     61      Node fn = null; //new Node(new LatLon(0,0));
     62       
    6063      while ((line = input.readLine()) != null) {
    6164        if (cancel) {
     
    7275            commands.add(new AddCommand(n));
    7376            way.nodes.add(n);
     77            if(fn==null){
     78                fn = n;
     79            }
    7480          }
    7581          catch (Exception ex) {
     
    8389         
    8490        case 'x':
     91          String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water");
     92         
     93          if(!waytype.equals("none")){
     94                  way.put("natural",waytype);
     95          }
     96         
    8597          way.put("created_by", "Dshpak_landsat_lakes");
    8698          commands.add(new AddCommand(way));
     99         
    87100          break;
    88101         
     
    94107      }
    95108      input.close();
     109      way.nodes.add(fn);
    96110    }
    97111
Note: See TracChangeset for help on using the changeset viewer.