Changeset 6789 in osm


Ignore:
Timestamp:
2008-02-07T04:54:29+01:00 (16 years ago)
Author:
jrreid
Message:

Update lakewalker to have a preference for the WMS layer to use

Location:
applications/editors/josm/plugins/lakewalker
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/lakewalker/Lakewalker/lakewalker.py

    r4096 r6789  
    8585def download_landsat(c1, c2, width, height, fname):
    8686    layer = "global_mosaic_base"
    87     style = "IR1"
     87    style = options.wmslayer
    8888
    8989    (min_lat, min_lon) = c1
     
    122122            bottom_left_xy = (int(math.floor(x / options.tilesize)) * options.tilesize, int(math.floor(y / options.tilesize)) * options.tilesize)
    123123            top_right_xy = (bottom_left_xy[0] + options.tilesize, bottom_left_xy[1] + options.tilesize)
    124             fname = "landsat_%d_%d_xy_%d_%d.png" % (options.resolution, options.tilesize, bottom_left_xy[0], bottom_left_xy[1])
     124            fname = options.wmslayer+"/landsat_%d_%d_xy_%d_%d.png" % (options.resolution, options.tilesize, bottom_left_xy[0], bottom_left_xy[1])
    125125            im = self.images.get(fname, None)
    126126            if im is None:
     
    446446    parser.add_option("--bottom", type="float", metavar="LATITUDE", default=-90, help="Bottom (south) latitude for bounding box")
    447447    parser.add_option("--josm", action="store_true", dest="josm_mode", default=False, help="Operate in JOSM plugin mode")
     448    parser.add_option("--wms", type="string", dest="wmslayer", default="IR1", help="WMS layer to use")
    448449
    449450    global options # Ugly, I know...
  • applications/editors/josm/plugins/lakewalker/build.xml

    r6127 r6789  
    6464    <copy todir="${josm.plugins.dir}/Lakewalker">
    6565      <fileset dir="Lakewalker">
    66         <filename name = "*.py"/>
     66                <filename name = "*.py"/>
    6767      </fileset>
    6868    </copy>
     69        <mkdir dir="${josm.plugins.dir}/Lakewalker/IR1"></mkdir>
     70        <mkdir dir="${josm.plugins.dir}/Lakewalker/IR2"></mkdir>
     71        <mkdir dir="${josm.plugins.dir}/Lakewalker/IR3"></mkdir>
    6972  </target>
    7073
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.java

    r5979 r6789  
    101101    target += " --tilesize=" + Main.pref.get(LakewalkerPreferences.PREF_LANDSAT_SIZE, "2000");
    102102    target += " --startdir=" + Main.pref.get(LakewalkerPreferences.PREF_START_DIR, "east");
     103    target += " --wms=" + Main.pref.get(LakewalkerPreferences.PREF_WMS, "IR1");   
    103104    target += " --josm";
    104105   
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java

    r6127 r6789  
    1515  public static final String[] DIRECTIONS = new String[] {"east", "northeast", "north", "northwest", "west", "southwest", "south", "southeast"};
    1616  public static final String[] WAYTYPES = new String[] {"water", "coastline", "land", "none"};
     17  public static final String[] WMSLAYERS = new String[] {"IR1", "IR2", "IR3"};
    1718
    1819  public static final String PREF_PYTHON = "lakewalker.python";
     
    2728  public static final String PREF_START_DIR = "lakewalker.startdir";
    2829  public static final String PREF_WAYTYPE = "lakewalker.waytype";
     30  public static final String PREF_WMS = "lakewalker.wms";
    2931   
    3032  protected StringConfigurer pythonConfig = new StringConfigurer();
     
    5052  protected StringEnumConfigurer lakeTypeConfig = new StringEnumConfigurer(WAYTYPES);
    5153  protected JLabel lakeTypeLabel = new JLabel(tr("Tag ways as"));
     54  protected StringEnumConfigurer wmsConfig = new StringEnumConfigurer(WMSLAYERS);
     55  protected JLabel wmsLabel = new JLabel(tr("WMS Layer"));
    5256 
    5357  public void addGui(PreferenceDialog gui) {
     
    6367    startDirConfig.setToolTipText(tr("Direction to search for land. Default east."));
    6468    lakeTypeConfig.setToolTipText(tr("Tag ways as water, coastline, land or nothing. Default is water."));
     69    wmsConfig.setToolTipText(tr("Which WMS layer to use for tracing against. Default is IR1."));
    6570
    6671    String description = tr("An interlude to the Lakewalker Python module to trace water bodies on Landsat imagery.<br><br>Version: {0}", LakewalkerPlugin.VERSION);
     
    7984    startDirConfig.setValue(Main.pref.get(PREF_START_DIR, "east"));
    8085    lakeTypeConfig.setValue(Main.pref.get(PREF_WAYTYPE, "water"));
     86    wmsConfig.setValue(Main.pref.get(PREF_WMS, "IR1"));
    8187  }
    8288 
     
    107113    prefPanel.add(lakeTypeLabel, labelConstraints);
    108114    prefPanel.add(lakeTypeConfig.getControls(), dataConstraints);
     115    prefPanel.add(wmsLabel, labelConstraints);
     116    prefPanel.add(wmsConfig.getControls(), dataConstraints);
    109117  }
    110118
     
    124132    Main.pref.put(PREF_START_DIR, startDirConfig.getValueString());
    125133    Main.pref.put(PREF_WAYTYPE, lakeTypeConfig.getValueString());
     134    Main.pref.put(PREF_WMS, wmsConfig.getValueString());
    126135  }
    127136 
Note: See TracChangeset for help on using the changeset viewer.