Ignore:
Timestamp:
2006-07-03T00:31:24+02:00 (18 years ago)
Author:
imi
Message:
  • started i18n
  • started "download incomplete ways" action
  • added straight line selection mode
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/actions/DownloadAction.java

    r103 r104  
    11package org.openstreetmap.josm.actions;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import java.awt.Dimension;
     
    4244import org.openstreetmap.josm.gui.layer.RawGpsLayer;
    4345import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint;
    44 import org.openstreetmap.josm.io.OsmServerReader;
     46import org.openstreetmap.josm.io.BoundingBoxDownloader;
    4547import org.openstreetmap.josm.tools.GBC;
    4648import org.xml.sax.SAXException;
     
    5557 */
    5658public class DownloadAction extends JosmAction {
    57 
    5859        /**
    5960         * Open the download dialog and download the data.
     
    6162         */
    6263        private final class DownloadOsmTask extends PleaseWaitRunnable {
    63                 private final OsmServerReader reader;
     64                private final BoundingBoxDownloader reader;
    6465                private DataSet dataSet;
    6566
    66                 private DownloadOsmTask(OsmServerReader reader) {
    67                         super("Downloading data");
     67                private DownloadOsmTask(BoundingBoxDownloader reader) {
     68                        super(tr("Downloading data"));
    6869                        this.reader = reader;
    6970                        reader.setProgressInformation(currentAction, progress);
     
    7778                        if (dataSet == null)
    7879                                return; // user cancelled download or error occoured
    79                         if (dataSet.nodes.isEmpty())
    80                                 errorMessage = "No data imported.";
    81                         Main.main.addLayer(new OsmDataLayer(dataSet, "Data Layer", false));
     80                        if (dataSet.allPrimitives().isEmpty())
     81                                errorMessage = tr("No data imported.");
     82                        Main.main.addLayer(new OsmDataLayer(dataSet, tr("Data Layer"), false));
    8283                }
    8384
     
    8990
    9091        private final class DownloadGpsTask extends PleaseWaitRunnable {
    91                 private final OsmServerReader reader;
     92                private final BoundingBoxDownloader reader;
    9293                private Collection<Collection<GpsPoint>> rawData;
    9394
    94                 private DownloadGpsTask(OsmServerReader reader) {
    95                         super("Downloading GPS data");
     95                private DownloadGpsTask(BoundingBoxDownloader reader) {
     96                        super(tr("Downloading GPS data"));
    9697                        this.reader = reader;
    9798                        reader.setProgressInformation(currentAction, progress);
     
    123124                        new JTextField(9),
    124125                        new JTextField(9)};
    125         JCheckBox rawGps = new JCheckBox("Open as raw gps data", false);
     126        JCheckBox rawGps = new JCheckBox(tr("Open as raw gps data"), false);
    126127
    127128        public DownloadAction() {
    128                 super("Download from OSM", "download", "Download map data from the OSM server.", "Ctrl-Shift-D",
     129                super(tr("Download from OSM"), "download", tr("Download map data from the OSM server."), tr("Ctrl-Shift-D"),
    129130                                KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
    130131                // TODO remove when bug in Java6 is fixed
     
    139140                WorldChooser wc = new WorldChooser();
    140141                dlg.add(wc, GBC.eop());
    141                 wc.setToolTipText("Move and zoom the image like the main map. Select an area to download by dragging.");
     142                wc.setToolTipText(tr("Move and zoom the image like the main map. Select an area to download by dragging."));
    142143
    143144                // Bounding box edits
    144                 dlg.add(new JLabel("Bounding box"), GBC.eol());
    145                 dlg.add(new JLabel("min lat"), GBC.std().insets(10,0,5,0));
     145                dlg.add(new JLabel(tr("Bounding box")), GBC.eol());
     146                dlg.add(new JLabel(tr("min lat")), GBC.std().insets(10,0,5,0));
    146147                dlg.add(latlon[0], GBC.std());
    147                 dlg.add(new JLabel("min lon"), GBC.std().insets(10,0,5,0));
     148                dlg.add(new JLabel(tr("min lon")), GBC.std().insets(10,0,5,0));
    148149                dlg.add(latlon[1], GBC.eol());
    149                 dlg.add(new JLabel("max lat"), GBC.std().insets(10,0,5,0));
     150                dlg.add(new JLabel(tr("max lat")), GBC.std().insets(10,0,5,0));
    150151                dlg.add(latlon[2], GBC.std());
    151                 dlg.add(new JLabel("max lon"), GBC.std().insets(10,0,5,0));
     152                dlg.add(new JLabel(tr("max lon")), GBC.std().insets(10,0,5,0));
    152153                dlg.add(latlon[3], GBC.eol());
    153154                if (Main.map != null) {
     
    161162
    162163                // OSM url edit
    163                 dlg.add(new JLabel("URL from www.openstreetmap.org"), GBC.eol());
     164                dlg.add(new JLabel(tr("URL from www.openstreetmap.org")), GBC.eol());
    164165                final JTextField osmUrl = new JTextField();
    165166                dlg.add(osmUrl, GBC.eop().fill(GBC.HORIZONTAL));
     
    214215
    215216                // Bookmarks
    216                 dlg.add(new JLabel("Bookmarks"), GBC.eol());
     217                dlg.add(new JLabel(tr("Bookmarks")), GBC.eol());
    217218                final BookmarkList bookmarks = new BookmarkList();
    218219                bookmarks.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
     
    231232
    232233                JPanel buttons = new JPanel(new GridLayout(1,2));
    233                 JButton add = new JButton("Add");
     234                JButton add = new JButton(tr("Add"));
    234235                add.addActionListener(new ActionListener(){
    235236                        public void actionPerformed(ActionEvent e) {
    236237                                Bookmark b = readBookmark();
    237238                                if (b == null) {
    238                                         JOptionPane.showMessageDialog(Main.parent, "Please enter the desired coordinates first.");
     239                                        JOptionPane.showMessageDialog(Main.parent, tr("Please enter the desired coordinates first."));
    239240                                        return;
    240241                                }
    241                                 b.name = JOptionPane.showInputDialog(Main.parent, "Please enter a name for the location.");
     242                                b.name = JOptionPane.showInputDialog(Main.parent,tr("Please enter a name for the location."));
    242243                                if (b.name != null && !b.name.equals("")) {
    243244                                        ((DefaultListModel)bookmarks.getModel()).addElement(b);
     
    247248                });
    248249                buttons.add(add);
    249                 JButton remove = new JButton("Remove");
     250                JButton remove = new JButton(tr("Remove"));
    250251                remove.addActionListener(new ActionListener(){
    251252                        public void actionPerformed(ActionEvent e) {
    252253                                Object sel = bookmarks.getSelectedValue();
    253254                                if (sel == null) {
    254                                         JOptionPane.showMessageDialog(Main.parent, "Select a bookmark first.");
     255                                        JOptionPane.showMessageDialog(Main.parent,tr("Select a bookmark first."));
    255256                                        return;
    256257                                }
     
    270271                do {
    271272                        final JOptionPane pane = new JOptionPane(dlg, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
    272                         final JDialog panedlg = pane.createDialog(Main.parent, "Choose an area");
     273                        final JDialog panedlg = pane.createDialog(Main.parent, tr("Choose an area"));
    273274                        bookmarks.addMouseListener(new MouseAdapter(){
    274275                                @Override public void mouseClicked(MouseEvent e) {
     
    285286                        b = readBookmark();
    286287                        if (b == null)
    287                                 JOptionPane.showMessageDialog(Main.parent, "Please enter the desired coordinates or click on a bookmark.");
     288                                JOptionPane.showMessageDialog(Main.parent,tr("Please enter the desired coordinates or click on a bookmark."));
    288289                } while (b == null);
    289290
     
    365366         */
    366367        public void download(boolean rawGps, double minlat, double minlon, double maxlat, double maxlon) {
    367                 OsmServerReader reader = new OsmServerReader(minlat, minlon, maxlat, maxlon);
     368                BoundingBoxDownloader reader = new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon);
    368369                PleaseWaitRunnable task = rawGps ? new DownloadGpsTask(reader) : new DownloadOsmTask(reader);
    369370                Main.worker.execute(task);
Note: See TracChangeset for help on using the changeset viewer.