- Timestamp:
- 2006-04-23T20:40:19+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/DownloadAction.java
r94 r95 72 72 @Override public void realRun() throws IOException, SAXException { 73 73 dataSet = reader.parseOsm(); 74 if (dataSet == null)75 return;76 if (dataSet.nodes.isEmpty())77 JOptionPane.showMessageDialog(Main.main, "No data imported.");78 74 } 79 75 … … 81 77 if (dataSet == null) 82 78 return; // user cancelled download or error occoured 79 if (dataSet.nodes.isEmpty()) 80 errorMessage = "No data imported."; 83 81 Layer layer = new OsmDataLayer(dataSet, "Data Layer", false); 84 82 if (Main.main.getMapFrame() == null) … … 120 118 121 119 @Override protected void cancel() { 120 reader.cancel(); 122 121 } 123 122 } -
src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
r92 r95 32 32 public abstract class PleaseWaitRunnable implements Runnable { 33 33 public final JDialog pleaseWaitDlg; 34 p rivateString errorMessage;34 public String errorMessage; 35 35 36 36 private final JProgressBar progressBar = new JProgressBar(); -
src/org/openstreetmap/josm/io/OsmServerReader.java
r92 r95 47 47 */ 48 48 public Collection<Collection<GpsPoint>> parseRawGps() throws IOException, JDOMException { 49 String url = Main.pref.get("osm-server.url")+"/0.3/trackpoints?bbox="+lon1+","+lat1+","+lon2+","+lat2+"&page="; 50 Collection<Collection<GpsPoint>> data = new LinkedList<Collection<GpsPoint>>(); 51 Collection<GpsPoint> list = new LinkedList<GpsPoint>(); 52 53 for (int i = 0;;++i) { 54 Reader r = getReader(url+i); 55 if (r == null) 56 break; 57 RawGpsReader gpsReader = new RawGpsReader(r); 58 Collection<Collection<GpsPoint>> allWays = gpsReader.parse(); 59 boolean foundSomething = false; 60 for (Collection<GpsPoint> t : allWays) { 61 if (!t.isEmpty()) { 62 foundSomething = true; 63 list.addAll(t); 49 try { 50 String url = Main.pref.get("osm-server.url")+"/0.3/trackpoints?bbox="+lon1+","+lat1+","+lon2+","+lat2+"&page="; 51 Collection<Collection<GpsPoint>> data = new LinkedList<Collection<GpsPoint>>(); 52 Collection<GpsPoint> list = new LinkedList<GpsPoint>(); 53 54 for (int i = 0;;++i) { 55 Reader r = getReader(url+i); 56 if (r == null) 57 break; 58 RawGpsReader gpsReader = new RawGpsReader(r); 59 Collection<Collection<GpsPoint>> allWays = gpsReader.parse(); 60 boolean foundSomething = false; 61 for (Collection<GpsPoint> t : allWays) { 62 if (!t.isEmpty()) { 63 foundSomething = true; 64 list.addAll(t); 65 } 64 66 } 67 if (!foundSomething) 68 break; 69 r.close(); 70 activeConnection = null; 65 71 } 66 if (!foundSomething) 67 break; 68 r.close(); 69 activeConnection = null; 72 73 data.add(list); 74 return data; 75 } catch (IOException e) { 76 if (cancel) 77 return null; 78 throw e; 79 } catch (JDOMException e) { 80 throw e; 81 } catch (Exception e) { 82 if (cancel) 83 return null; 84 if (e instanceof RuntimeException) 85 throw (RuntimeException)e; 86 throw new RuntimeException(e); 70 87 } 71 72 data.add(list);73 return data;74 88 } 75 89 … … 80 94 */ 81 95 public DataSet parseOsm() throws SAXException, IOException { 82 Reader r = getReader(Main.pref.get("osm-server.url")+"/0.3/map?bbox="+lon1+","+lat1+","+lon2+","+lat2); 83 if (r == null) 84 return null; 85 currentAction.setText("Downloading OSM data..."); 86 DataSet data = OsmReader.parseDataSet(r); 87 r.close(); 88 activeConnection = null; 89 return data; 96 try { 97 final Reader r = getReader(Main.pref.get("osm-server.url")+"/0.3/map?bbox="+lon1+","+lat1+","+lon2+","+lat2); 98 if (r == null) 99 return null; 100 currentAction.setText("Downloading OSM data..."); 101 final DataSet data = OsmReader.parseDataSet(r); 102 r.close(); 103 activeConnection = null; 104 return data; 105 } catch (IOException e) { 106 if (cancel) 107 return null; 108 throw e; 109 } catch (SAXException e) { 110 throw e; 111 } catch (Exception e) { 112 if (cancel) 113 return null; 114 if (e instanceof RuntimeException) 115 throw (RuntimeException)e; 116 throw new RuntimeException(e); 117 } 90 118 } 91 119
Note:
See TracChangeset
for help on using the changeset viewer.