Changeset 1670 in josm for trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
- Timestamp:
- 15.06.2009 20:22:46 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
r1523 r1670 7 7 import java.io.InputStream; 8 8 9 import javax.swing.JOptionPane; 10 9 11 import org.openstreetmap.josm.Main; 10 12 import org.openstreetmap.josm.data.osm.DataSet; 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 11 14 import org.xml.sax.SAXException; 12 13 import javax.swing.JOptionPane;14 15 15 16 public class OsmServerObjectReader extends OsmServerReader { 16 17 17 public final static String TYPE_WAY = "way";18 public final static String TYPE_REL = "relation";19 public final static String TYPE_NODE = "node";20 21 18 long id; 22 Stringtype;19 OsmPrimitiveType type; 23 20 boolean full; 24 21 25 public OsmServerObjectReader(long id, Stringtype, boolean full) {22 public OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full) { 26 23 this.id = id; 27 24 this.type = type; … … 34 31 * @throws IOException 35 32 */ 36 public DataSet parseOsm() throws SAXException, IOException { 33 @Override 34 public DataSet parseOsm() throws OsmTransferException { 37 35 try { 38 36 Main.pleaseWaitDlg.progress.setValue(0); 39 37 Main.pleaseWaitDlg.currentAction.setText(tr("Contacting OSM Server...")); 40 38 StringBuffer sb = new StringBuffer(); 41 sb.append(type );39 sb.append(type.getAPIName()); 42 40 sb.append("/"); 43 41 sb.append(id); 44 if (full )42 if (full && ! type.equals(OsmPrimitiveType.NODE)) { 45 43 sb.append("/full"); 44 } 46 45 47 46 final InputStream in = getInputStream(sb.toString(), Main.pleaseWaitDlg); … … 52 51 final DataSet data = osm.getDs(); 53 52 54 // Bounds bounds = new Bounds(new LatLon(lat1, lon1), new LatLon(lat2, lon2));55 // DataSource src = new DataSource(bounds, origin);56 // data.dataSources.add(src);57 53 if (osm.getParseNotes().length() != 0) { 58 54 JOptionPane.showMessageDialog(Main.parent, osm.getParseNotes()); … … 64 60 if (cancel) 65 61 return null; 66 throw e;62 throw new OsmTransferException(e); 67 63 } catch (SAXException e) { 64 throw new OsmTransferException(e); 65 } catch(OsmTransferException e) { 68 66 throw e; 69 67 } catch (Exception e) { 70 68 if (cancel) 71 69 return null; 72 if (e instanceof RuntimeException) 73 throw (RuntimeException)e; 74 throw new RuntimeException(e); 70 throw new OsmTransferException(e); 75 71 } 76 72 }
Note: See TracChangeset
for help on using the changeset viewer.
