source: josm/trunk/src/org/openstreetmap/josm/gui/download/TileSelection.java@ 3094

Last change on this file since 3094 was 3094, checked in by Gubaer, 14 years ago

Improved widget for selecting a bounding box based on a grid of OSM tiles (see Haiti Lessons Learned).
Also moving the various widgets for selecting a bounding box into a new package org.openstreetmap.josm.gui.bbox. Going to need them shortly in the Changeset Query Dialog and in an upcoming XAPI plugin.

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. See LICENSE file for details.
2package org.openstreetmap.josm.gui.download;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.beans.PropertyChangeEvent;
7import java.beans.PropertyChangeListener;
8
9import org.openstreetmap.josm.data.Bounds;
10import org.openstreetmap.josm.gui.bbox.BBoxChooser;
11import org.openstreetmap.josm.gui.bbox.TileSelectionBBoxChooser;
12/**
13 * Tile selector.
14 *
15 * Provides a tile coordinate input field.
16 *
17 * @author Frederik Ramm <frederik@remote.org>
18 *
19 */
20public class TileSelection implements DownloadSelection, PropertyChangeListener {
21
22 private TileSelectionBBoxChooser chooser;
23 private DownloadDialog parent;
24
25 protected void build() {
26 chooser = new TileSelectionBBoxChooser();
27 chooser.addPropertyChangeListener(this);
28 }
29
30 public TileSelection() {
31 build();
32 }
33
34 public void addGui(final DownloadDialog gui) {
35 gui.addDownloadAreaSelector(chooser, tr("Tile Numbers"));
36 parent = gui;
37 }
38
39 public void setDownloadArea(Bounds area) {
40 chooser.setBoundingBox(area);
41 }
42
43 @Override
44 public void propertyChange(PropertyChangeEvent evt) {
45 if (evt.getPropertyName().equals(BBoxChooser.BBOX_PROP)) {
46 Bounds bbox = (Bounds)evt.getNewValue();
47 parent.boundingBoxChanged(bbox, this);
48 }
49 }
50}
Note: See TracBrowser for help on using the repository browser.