Ignore:
Timestamp:
2007-12-09T13:41:19+01:00 (17 years ago)
Author:
brent
Message:

Add start search direction preference

Location:
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker
Files:
1 added
9 edited

Legend:

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

    r4209 r5979  
    22 * $Id: BooleanConfigurer.java 705 2005-09-15 13:24:50 +0000 (Thu, 15 Sep 2005) rodneykinney $
    33 *
    4  * Copyright (c) 2000-2003 by Rodney Kinney
     4 * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
    55 *
    66 * This library is free software; you can redistribute it and/or
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java

    r4095 r5979  
    22 * $Id: Configurer.java 2175 2007-06-04 04:19:59 +0000 (Mon, 04 Jun 2007) rodneykinney $
    33 *
    4  * Copyright (c) 2000-2003 by Rodney Kinney
     4 * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
    55 *
    66 * This library is free software; you can redistribute it and/or
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java

    r4209 r5979  
    22 * $Id: DoubleConfigurer.java 5 2003-10-02 15:11:38 +0000 (Thu, 02 Oct 2003) rodneykinney $
    33 *
    4  * Copyright (c) 2000-2003 by Rodney Kinney
     4 * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
    55 *
    66 * This library is free software; you can redistribute it and/or
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java

    r4095 r5979  
    22 * $Id: IntConfigurer.java 874 2006-03-15 14:20:56 +0000 (Wed, 15 Mar 2006) rodneykinney $
    33 *
    4  * Copyright (c) 2000-2003 by Rodney Kinney
     4 * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
    55 *
    66 * This library is free software; you can redistribute it and/or
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java

    r4209 r5979  
    1212import java.io.File;
    1313import java.io.InputStreamReader;
    14 import java.nio.channels.ClosedByInterruptException;
    1514import java.util.ArrayList;
    16 import java.util.Collection;
    17 import java.util.LinkedList;
    1815import java.util.List;
    1916
    2017import javax.swing.JOptionPane;
    21 import javax.swing.ProgressMonitor;
    2218
    2319import org.openstreetmap.josm.Main;
    2420import org.openstreetmap.josm.actions.JosmAction;
    25 import org.openstreetmap.josm.command.AddCommand;
    26 import org.openstreetmap.josm.command.Command;
    27 import org.openstreetmap.josm.command.SequenceCommand;
    2821import org.openstreetmap.josm.data.coor.LatLon;
    2922import org.openstreetmap.josm.data.osm.Node;
    3023import org.openstreetmap.josm.data.osm.OsmPrimitive;
    31 import org.openstreetmap.josm.data.osm.Segment;
    32 import org.openstreetmap.josm.data.osm.Way;
    3324import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    3425import org.openstreetmap.josm.tools.ImageProvider;
     
    109100    target += " --landsat-res=" + Main.pref.get(LakewalkerPreferences.PREF_LANDSAT_RES, "4000");
    110101    target += " --tilesize=" + Main.pref.get(LakewalkerPreferences.PREF_LANDSAT_SIZE, "2000");
     102    target += " --startdir=" + Main.pref.get(LakewalkerPreferences.PREF_START_DIR, "east");
    111103    target += " --josm";
    112104   
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.java

    r4095 r5979  
    1717public class LakewalkerPlugin extends Plugin {
    1818
    19   public static final String VERSION = "0.3";
     19  public static final String VERSION = "0.4";
    2020 
    2121  protected String name;
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java

    r4209 r5979  
    1313public class LakewalkerPreferences implements PreferenceSetting {
    1414
     15  public static final String[] DIRECTIONS = new String[] {"east", "northeast", "north", "northwest", "west", "southwest", "south", "southeast"};
     16
    1517  public static final String PREF_PYTHON = "lakewalker.python";
    1618  public static final String PREF_MAX_SEG = "lakewalker.max_segs_in_way";
     
    2224  public static final String PREF_EAST_OFFSET = "lakewalker.east_offset";
    2325  public static final String PREF_NORTH_OFFSET = "lakewalker.north_offset";
    24  
     26  public static final String PREF_START_DIR = "lakewalker.startdir";
     27   
    2528  protected StringConfigurer pythonConfig = new StringConfigurer();
    2629  protected JLabel pythonLabel = new JLabel(tr("Python executable"));
     
    4144  protected DoubleConfigurer northOffsetConfig = new DoubleConfigurer();
    4245  protected JLabel northOffsetLabel = new JLabel(tr("Shift all traces to north (degrees)"));
     46  protected StringEnumConfigurer startDirConfig = new StringEnumConfigurer(DIRECTIONS);
     47  protected JLabel startDirLabel = new JLabel(tr("Direction to search for land"));
    4348 
    4449  public void addGui(PreferenceDialog gui) {
     
    5257    eastOffsetConfig.setToolTipText(tr("Offset all points in East direction (degrees). Default 0."));   
    5358    northOffsetConfig.setToolTipText(tr("Offset all points in North direction (degrees). Default 0."));   
     59    startDirConfig.setToolTipText(tr("Direction to search for land. Default east."));   
    5460
    5561    String description = tr("An interlude to the Lakewalker Python module to trace water bodies on Landsat imagery.<br><br>Version: {0}", LakewalkerPlugin.VERSION);
     
    6672    eastOffsetConfig.setValue(Main.pref.get(PREF_EAST_OFFSET, "0.0"));
    6773    northOffsetConfig.setValue(Main.pref.get(PREF_NORTH_OFFSET, "0.0"));
     74    startDirConfig.setValue(Main.pref.get(PREF_START_DIR, "east"));
    6875  }
    6976 
     
    9097    prefPanel.add(northOffsetLabel, labelConstraints);
    9198    prefPanel.add(northOffsetConfig.getControls(), dataConstraints);
     99    prefPanel.add(startDirLabel, labelConstraints);
     100    prefPanel.add(startDirConfig.getControls(), dataConstraints);
    92101  }
    93102
     
    105114    Main.pref.put(PREF_EAST_OFFSET, eastOffsetConfig.getValueString());
    106115    Main.pref.put(PREF_NORTH_OFFSET, northOffsetConfig.getValueString());
     116    Main.pref.put(PREF_START_DIR, startDirConfig.getValueString());
    107117  }
    108118 
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerReader.java

    r4209 r5979  
    1919import org.openstreetmap.josm.data.coor.LatLon;
    2020import org.openstreetmap.josm.data.osm.Node;
    21 import org.openstreetmap.josm.data.osm.Segment;
    2221import org.openstreetmap.josm.data.osm.Way;
    2322
     
    4544
    4645    Way way = new Way();
    47     Node lastNode = null;
    48     Node firstNode = null;
    4946    String line;
    5047    setStatus("Initializing");
     
    5855     
    5956    }
    60 
     57    char option = ' ';
     58   
    6159    try {
    6260      while ((line = input.readLine()) != null) {
     
    6563        }
    6664        System.out.println(line);
    67         char option = line.charAt(0);
     65        option = line.charAt(0);
    6866        switch (option) {
    6967        case 'n':
     
    7371            Node n = new Node(ll);
    7472            commands.add(new AddCommand(n));
    75             if (lastNode != null) {
    76               Segment s = new Segment(lastNode, n);
    77               commands.add(new AddCommand(s));
    78               way.segments.add(s);
    79             }
    80             else {
    81               firstNode = n;
    82             }
    83             lastNode = n;
     73            way.nodes.add(n);
    8474          }
    8575          catch (Exception ex) {
     
    9383         
    9484        case 'x':
    95           Segment s = new Segment(lastNode, firstNode);
    96           commands.add(new AddCommand(s));
    97           way.segments.add(s);
    9885          way.put("created_by", "Dshpak_landsat_lakes");
    9986          commands.add(new AddCommand(way));
     87          break;
     88         
     89        case 'e':
     90          String error = line.substring(2);
     91          cancel = true;
    10092          break;
    10193        }
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.java

    r4095 r5979  
    22 * $Id: StringConfigurer.java 2073 2007-05-10 14:34:31 +0000 (Thu, 10 May 2007) rodneykinney $
    33 *
    4  * Copyright (c) 2000-2003 by Rodney Kinney
     4 * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton
    55 *
    66 * This library is free software; you can redistribute it and/or
Note: See TracChangeset for help on using the changeset viewer.