Changeset 28912 in osm for applications


Ignore:
Timestamp:
2012-11-09T18:38:59+01:00 (12 years ago)
Author:
roland
Message:

Fixed bug 7660.

Location:
applications/editors/josm/plugins/mirrored_download/src/mirrored_download
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mirrored_download/src/mirrored_download/MirroredDownloadAction.java

    r28418 r28912  
    162162            return overpassQuery.isEmpty() && "*".equals(overpassType)
    163163                    ? super.getRequestForBbox(lon1, lat1, lon2, lat2)
    164                     : overpassType + "[bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2 + "][@meta]" + overpassQuery;
     164                    : overpassType + "[bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2 + "]"
     165                        + (MirroredDownloadPlugin.getAddMeta() ? "[@meta]" : "") + overpassQuery;
    165166        }
    166167
  • applications/editors/josm/plugins/mirrored_download/src/mirrored_download/MirroredDownloadPlugin.java

    r28911 r28912  
    1515    }
    1616    private static String downloadUrl = null;
     17    private static boolean addMeta = true;
    1718
    1819    public static String getDownloadUrl() {
     
    2223            if (downloadUrl == null)
    2324                downloadUrl = "http://overpass-api.de/api/xapi?";
     25               
     26            String metaFlag = Main.pref.get("plugin.mirrored_download.preferred-meta-flag");
     27            addMeta = !("void".equals(metaFlag));
    2428        }
    2529        return downloadUrl;
     30    }
     31   
     32    public static boolean getAddMeta() {
     33        return addMeta;
    2634    }
    2735
     
    2937        downloadUrl = downloadUrl_;
    3038    }
     39
     40    public static void setAddMeta(boolean addMeta_) {
     41        addMeta = addMeta_;
     42    }
     43
    3144}
  • applications/editors/josm/plugins/mirrored_download/src/mirrored_download/UrlSelectionDialog.java

    r28108 r28912  
    3030import javax.swing.DefaultListModel;
    3131import javax.swing.JButton;
     32import javax.swing.JCheckBox;
    3233import javax.swing.JComboBox;
    3334import javax.swing.JComponent;
     
    7576  private JTabbedPane tabbedPane = null;
    7677  private JComboBox cbSelectUrl = null;
     78  private JCheckBox cbAddMeta = null;
    7779
    7880  public UrlSelectionDialog() {
     
    105107    cbSelectUrl.setEditable(true);
    106108
    107     String preferredUrl = Main.pref.get("plugin.mirrored_download.preferred-url");
    108     if (preferredUrl != null && !"".equals(preferredUrl))
    109       cbSelectUrl.addItem(preferredUrl);
     109    cbSelectUrl.addItem(MirroredDownloadPlugin.getDownloadUrl());
    110110
    111111    for (String url: getURLs()) {
     
    118118    layoutCons.gridx = 0;
    119119    layoutCons.gridy = 1;
    120     layoutCons.gridwidth = 1;
     120    layoutCons.gridwidth = 2;
    121121    layoutCons.weightx = 0.0;
    122122    layoutCons.weighty = 0.0;
     
    124124    gridbag.setConstraints(cbSelectUrl, layoutCons);
    125125    contentPane.add(cbSelectUrl);
     126
     127    cbAddMeta = new JCheckBox(tr("Enforce meta data"));
     128    cbAddMeta.setEnabled(true);
     129    cbAddMeta.setSelected(MirroredDownloadPlugin.getAddMeta());
     130
     131    cbAddMeta.setActionCommand("selectMetaFlag");
     132    cbAddMeta.addActionListener(new MetaFlagChangedAction());
     133
     134    layoutCons.gridx = 0;
     135    layoutCons.gridy = 2;
     136    layoutCons.gridwidth = 2;
     137    layoutCons.weightx = 0.0;
     138    layoutCons.weighty = 0.0;
     139    layoutCons.fill = GridBagConstraints.BOTH;
     140    gridbag.setConstraints(cbAddMeta, layoutCons);
     141    contentPane.add(cbAddMeta);
    126142
    127143    jDialog.pack();
     
    164180  }
    165181
     182  public class MetaFlagChangedAction implements ActionListener {
     183
     184    public void actionPerformed(ActionEvent e) {
     185      MirroredDownloadPlugin.setAddMeta(cbAddMeta.isSelected());
     186      Main.pref.put("plugin.mirrored_download.preferred-meta-flag",
     187          cbAddMeta.isSelected() ? "meta" : "void");
     188    }
     189
     190  }
     191
    166192  public void setVisible(boolean visible) {
    167193    jDialog.setVisible(visible);
Note: See TracChangeset for help on using the changeset viewer.