Ignore:
Timestamp:
15.06.2009 20:22:46 (3 years ago)
Author:
Gubaer
Message:

fixed: bug in OsmApi.getOsmApi()
cleanup: exception handling in interfacing with OSM API
new: new action for updating individual elements with the their current state on the server (including new menu item in the file menu)
new: improved user feedback in case of conflicts
new: handles 410 Gone conflicts when uploading a changeset
new: undoable command for "purging" a primitive from the current dataset (necessary if the primitive is already deleted on the server and the user wants to remove it from its local dataset)
new: undoable command for "undeleting" an already deleted primitive on the server (kind of "cloning")
new: after a full upload, checks whether there are primitives in the local dataset which might be deleted on the server.
new: data structures for history data
new: history download support in io package

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java

    r1523 r1670  
    77import java.io.InputStream; 
    88 
     9import javax.swing.JOptionPane; 
     10 
    911import org.openstreetmap.josm.Main; 
    1012import org.openstreetmap.josm.data.osm.DataSet; 
     13import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 
    1114import org.xml.sax.SAXException; 
    12  
    13 import javax.swing.JOptionPane; 
    1415 
    1516public class OsmServerObjectReader extends OsmServerReader { 
    1617 
    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  
    2118    long id; 
    22     String type; 
     19    OsmPrimitiveType type; 
    2320    boolean full; 
    2421 
    25     public OsmServerObjectReader(long id, String type, boolean full) { 
     22    public OsmServerObjectReader(long id, OsmPrimitiveType type, boolean full) { 
    2623        this.id = id; 
    2724        this.type = type; 
     
    3431     * @throws IOException 
    3532     */ 
    36     public DataSet parseOsm() throws SAXException, IOException { 
     33    @Override 
     34    public DataSet parseOsm() throws OsmTransferException { 
    3735        try { 
    3836            Main.pleaseWaitDlg.progress.setValue(0); 
    3937            Main.pleaseWaitDlg.currentAction.setText(tr("Contacting OSM Server...")); 
    4038            StringBuffer sb = new StringBuffer(); 
    41             sb.append(type); 
     39            sb.append(type.getAPIName()); 
    4240            sb.append("/"); 
    4341            sb.append(id); 
    44             if (full) 
     42            if (full && ! type.equals(OsmPrimitiveType.NODE)) { 
    4543                sb.append("/full"); 
     44            } 
    4645 
    4746            final InputStream in = getInputStream(sb.toString(), Main.pleaseWaitDlg); 
     
    5251            final DataSet data = osm.getDs(); 
    5352 
    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); 
    5753            if (osm.getParseNotes().length() != 0) { 
    5854                JOptionPane.showMessageDialog(Main.parent, osm.getParseNotes()); 
     
    6460            if (cancel) 
    6561                return null; 
    66             throw e; 
     62            throw new OsmTransferException(e); 
    6763        } catch (SAXException e) { 
     64            throw new OsmTransferException(e); 
     65        } catch(OsmTransferException e) { 
    6866            throw e; 
    6967        } catch (Exception e) { 
    7068            if (cancel) 
    7169                return null; 
    72             if (e instanceof RuntimeException) 
    73                 throw (RuntimeException)e; 
    74             throw new RuntimeException(e); 
     70            throw new OsmTransferException(e); 
    7571        } 
    7672    } 
Note: See TracChangeset for help on using the changeset viewer.