Changeset 1811 in josm for trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
- Timestamp:
- 2009-07-19T17:38:55+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r1772 r1811 8 8 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.data.gpx.GpxData; 10 11 import org.openstreetmap.josm.data.osm.DataSet; 11 import org.openstreetmap.josm. data.gpx.GpxData;12 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 12 13 import org.xml.sax.SAXException; 13 14 … … 39 40 * ways. 40 41 */ 41 public GpxData parseRawGps() throws IOException, SAXException { 42 Main.pleaseWaitDlg.progress.setValue(0); 43 Main.pleaseWaitDlg.currentAction.setText(tr("Contacting OSM Server...")); 42 public GpxData parseRawGps(ProgressMonitor progressMonitor) throws IOException, SAXException { 43 progressMonitor.beginTask("", 1); 44 44 try { 45 progressMonitor.indeterminateSubTask(tr("Contacting OSM Server...")); 45 46 String url = "trackpoints?bbox="+lon1+","+lat1+","+lon2+","+lat2+"&page="; 46 47 … … 48 49 GpxData result = null; 49 50 for (int i = 0;!done;++i) { 50 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading points {0} to {1}...", i * 5000, ((i + 1) * 5000)));51 InputStream in = getInputStream(url+i, Main.pleaseWaitDlg);51 progressMonitor.subTask(tr("Downloading points {0} to {1}...", i * 5000, ((i + 1) * 5000))); 52 InputStream in = getInputStream(url+i, progressMonitor.createSubTaskMonitor(1, true)); 52 53 if (in == null) { 53 54 break; 54 55 } 56 progressMonitor.setTicks(0); 55 57 GpxData currentGpx = new GpxReader(in, null).data; 56 58 if (result == null) { … … 83 85 throw (RuntimeException)e; 84 86 throw new RuntimeException(e); 87 } finally { 88 progressMonitor.finishTask(); 85 89 } 86 90 } … … 91 95 */ 92 96 @Override 93 public DataSet parseOsm() throws OsmTransferException { 97 public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException { 98 progressMonitor.beginTask(tr("Contacting OSM Server..."), 10); 94 99 try { 95 Main.pleaseWaitDlg.progress.setValue(0); 96 Main.pleaseWaitDlg.currentAction.setText(tr("Contacting OSM Server...")); 97 Main.pleaseWaitDlg.setIndeterminate(true); 98 final InputStream in = getInputStream("map?bbox="+lon1+","+lat1+","+lon2+","+lat2, Main.pleaseWaitDlg); 99 Main.pleaseWaitDlg.setIndeterminate(false); 100 progressMonitor.indeterminateSubTask(null); 101 final InputStream in = getInputStream("map?bbox="+lon1+","+lat1+","+lon2+","+lat2, progressMonitor.createSubTaskMonitor(9, false)); 100 102 if (in == null) 101 103 return null; 102 Main.pleaseWaitDlg.currentAction.setText(tr("Downloading OSM data...")); 103 final DataSet data = OsmReader.parseDataSet(in,Main.pleaseWaitDlg); 104 final DataSet data = OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(1, false)); 104 105 in.close(); 105 106 activeConnection = null; … … 117 118 return null; 118 119 throw new OsmTransferException(e); 120 } finally { 121 progressMonitor.finishTask(); 119 122 } 120 123 }
Note:
See TracChangeset
for help on using the changeset viewer.