- Timestamp:
- 2012-03-17T23:51:40+01:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r5044 r5097 48 48 } 49 49 50 @Override 50 51 public Future<?> download(boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor) { 51 52 downloadTask = new DownloadTask(newLayer, 53 new BoundingBoxDownloader(downloadArea), progressMonitor); 54 currentBounds = new Bounds(downloadArea); 52 return download(new BoundingBoxDownloader(downloadArea), newLayer, downloadArea, progressMonitor); 53 } 54 55 public Future<?> download(OsmServerReader reader, boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor) { 56 return download(new DownloadTask(newLayer, reader, progressMonitor), downloadArea); 57 } 58 59 protected Future<?> download(DownloadTask downloadTask, Bounds downloadArea) { 60 this.downloadTask = downloadTask; 61 this.currentBounds = new Bounds(downloadArea); 55 62 // We need submit instead of execute so we can wait for it to finish and get the error 56 63 // message if necessary. If no one calls getErrorMessage() it just behaves like execute. -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r4984 r5097 66 66 } 67 67 68 pr ivatefinal List<DownloadSelection> downloadSelections = new ArrayList<DownloadSelection>();69 pr ivatefinal JTabbedPane tpDownloadAreaSelectors = new JTabbedPane();70 pr ivateJCheckBox cbNewLayer;71 pr ivateJCheckBox cbStartup;72 pr ivatefinal JLabel sizeCheck = new JLabel();73 pr ivateBounds currentBounds = null;74 pr ivateboolean canceled;75 76 pr ivateJCheckBox cbDownloadOsmData;77 pr ivateJCheckBox cbDownloadGpxData;68 protected final List<DownloadSelection> downloadSelections = new ArrayList<DownloadSelection>(); 69 protected final JTabbedPane tpDownloadAreaSelectors = new JTabbedPane(); 70 protected JCheckBox cbNewLayer; 71 protected JCheckBox cbStartup; 72 protected final JLabel sizeCheck = new JLabel(); 73 protected Bounds currentBounds = null; 74 protected boolean canceled; 75 76 protected JCheckBox cbDownloadOsmData; 77 protected JCheckBox cbDownloadGpxData; 78 78 /** the download action and button */ 79 79 private DownloadAction actDownload; 80 pr ivateSideButton btnDownload;80 protected SideButton btnDownload; 81 81 82 82 private void makeCheckBoxRespondToEnter(JCheckBox cb) { … … 85 85 } 86 86 87 public JPanel buildMainPanel() { 88 // generic constraints used by different components 89 GridBagConstraints gridBagConstraints; 90 87 protected JPanel buildMainPanel() { 91 88 JPanel pnl = new JPanel(); 92 89 pnl.setLayout(new GridBagLayout()); … … 100 97 cbDownloadGpxData.setToolTipText(tr("Select to download GPS traces in the selected download area.")); 101 98 pnl.add(cbDownloadGpxData, GBC.eol().insets(5,5,1,5)); 99 100 buildMainPanelAboveDownloadSelections(pnl); 102 101 103 102 // predefined download selections … … 390 389 } 391 390 391 protected void buildMainPanelAboveDownloadSelections(JPanel pnl) { 392 } 393 392 394 class CancelAction extends AbstractAction { 393 395 public CancelAction() { -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r4580 r5097 18 18 * The boundings of the desired map data. 19 19 */ 20 pr ivatefinal double lat1;21 pr ivatefinal double lon1;22 pr ivatefinal double lat2;23 pr ivatefinal double lon2;24 pr ivatefinal boolean crosses180th;20 protected final double lat1; 21 protected final double lon1; 22 protected final double lat2; 23 protected final double lon2; 24 protected final boolean crosses180th; 25 25 26 26 public BoundingBoxDownloader(Bounds downloadArea) { … … 101 101 } 102 102 103 protected String getRequestForBbox(double lon1, double lat1, double lon2, double lat2) { 104 return "map?bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2; 105 } 106 103 107 /** 104 108 * Read the data from the osm server address. … … 114 118 if (crosses180th) { 115 119 // API 0.6 does not support requests crossing the 180th meridian, so make two requests 116 in = getInputStream( "map?bbox="+lon1+","+lat1+",180.0,"+lat2, progressMonitor.createSubTaskMonitor(9, false));120 in = getInputStream(getRequestForBbox(lon1, lat1, 180.0, lat2), progressMonitor.createSubTaskMonitor(9, false)); 117 121 if (in == null) 118 122 return null; 119 123 ds = OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(1, false)); 120 124 121 in = getInputStream( "map?bbox=-180.0,"+lat1+","+lon2+","+lat2, progressMonitor.createSubTaskMonitor(9, false));125 in = getInputStream(getRequestForBbox(-180.0, lat1, lon2, lat2), progressMonitor.createSubTaskMonitor(9, false)); 122 126 if (in == null) 123 127 return null; … … 129 133 } else { 130 134 // Simple request 131 in = getInputStream( "map?bbox="+lon1+","+lat1+","+lon2+","+lat2, progressMonitor.createSubTaskMonitor(9, false));135 in = getInputStream(getRequestForBbox(lon1, lat1, lon2, lat2), progressMonitor.createSubTaskMonitor(9, false)); 132 136 if (in == null) 133 137 return null; -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r4530 r5097 43 43 try { 44 44 api.initialize(progressMonitor); 45 urlStr = api.getBaseUrl() + urlStr;45 urlStr = urlStr.startsWith("http") ? urlStr : (getBaseUrl() + urlStr); 46 46 return getInputStreamRaw(urlStr, progressMonitor); 47 47 } finally { 48 48 progressMonitor.invalidate(); 49 49 } 50 } 51 52 protected String getBaseUrl() { 53 return api.getBaseUrl(); 50 54 } 51 55
Note:
See TracChangeset
for help on using the changeset viewer.