Changeset 8688 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2015-08-24T22:58:21+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OverpassDownloadAction.java
r8685 r8688 10 10 import java.net.URLEncoder; 11 11 import java.util.ArrayList; 12 import java.util.Arrays; 12 13 import java.util.Collections; 13 14 import java.util.concurrent.Future; … … 63 64 DownloadOsmTask task = new DownloadOsmTask(); 64 65 Future<?> future = task.download( 65 new OverpassDownloadReader(area, dialog.getOverpass Query()),66 new OverpassDownloadReader(area, dialog.getOverpassServer(), dialog.getOverpassQuery()), 66 67 dialog.isNewLayerRequired(), area, null); 67 68 Main.worker.submit(new PostDownloadHandler(task, future)); … … 71 72 static final class OverpassDownloadDialog extends DownloadDialog { 72 73 74 protected HistoryComboBox overpassServer; 73 75 protected HistoryComboBox overpassWizard; 74 76 protected JTextArea overpassQuery; 75 77 private static OverpassDownloadDialog instance; 78 static final StringProperty OVERPASS_SERVER = new StringProperty("download.overpass.server", "http://overpass-api.de/api/"); 79 static final CollectionProperty OVERPASS_SERVER_HISTORY = new CollectionProperty("download.overpass.servers", 80 Arrays.asList("http://overpass-api.de/api/", "http://overpass.osm.rambler.ru/cgi/")); 76 81 static final CollectionProperty OVERPASS_WIZARD_HISTORY = new CollectionProperty("download.overpass.wizard", new ArrayList<String>()); 77 82 … … 129 134 gbc.ipady = 200; 130 135 pnl.add(scrollPane, gbc); 136 137 overpassServer = new HistoryComboBox(); 138 pnl.add(new JLabel(tr("Overpass server: ")), GBC.std().insets(5, 5, 5, 5)); 139 pnl.add(overpassServer, GBC.eol().fill(GBC.HORIZONTAL)); 140 141 } 142 143 public String getOverpassServer() { 144 return overpassServer.getText(); 131 145 } 132 146 … … 138 152 public void restoreSettings() { 139 153 super.restoreSettings(); 154 overpassServer.setPossibleItems(OVERPASS_SERVER_HISTORY.get()); 155 overpassServer.setText(OVERPASS_SERVER.get()); 140 156 overpassWizard.setPossibleItems(OVERPASS_WIZARD_HISTORY.get()); 141 157 } … … 145 161 super.rememberSettings(); 146 162 overpassWizard.addCurrentItemToHistory(); 163 OVERPASS_SERVER.put(getOverpassServer()); 164 OVERPASS_SERVER_HISTORY.put(overpassServer.getHistory()); 147 165 OVERPASS_WIZARD_HISTORY.put(overpassWizard.getHistory()); 148 166 } … … 152 170 static class OverpassDownloadReader extends BoundingBoxDownloader { 153 171 172 final String overpassServer; 154 173 final String overpassQuery; 155 static final StringProperty OVERPASS_URL = new StringProperty("download.overpass.url", "https://overpass-api.de/api/"); 156 157 public OverpassDownloadReader(Bounds downloadArea, String overpassQuery) { 174 175 public OverpassDownloadReader(Bounds downloadArea, String overpassServer, String overpassQuery) { 158 176 super(downloadArea); 177 this.overpassServer = overpassServer; 159 178 this.overpassQuery = overpassQuery.trim(); 160 179 } … … 162 181 @Override 163 182 protected String getBaseUrl() { 164 return OVERPASS_URL.get();183 return overpassServer; 165 184 } 166 185
Note:
See TracChangeset
for help on using the changeset viewer.