Ignore:
Timestamp:
2008-12-19T14:43:36+01:00 (17 years ago)
Author:
framm
Message:
  • Added new "open location" option in the file menu which can be used to download OSM data from a given URL. Experimental feature, use with care.
Location:
trunk/src/org/openstreetmap/josm/io
Files:
1 added
2 edited

Legend:

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

    r1071 r1146  
    1717    public final static  String TYPE_NODE = "node";
    1818
     19    long id;
     20    String type;
     21    boolean full;
     22   
     23    public OsmServerObjectReader(long id, String type, boolean full) {
     24        this.id = id;
     25        this.type = type;
     26        this.full = full;
     27    }
    1928    /**
    2029     * Method to download single objects from OSM server. ways, relations, nodes
     
    2635     * @throws IOException
    2736     */
    28     public DataSet parseOsm(long id, String type, boolean full) throws SAXException, IOException {
     37    public DataSet parseOsm() throws SAXException, IOException {
    2938        try {
    30 
    3139            Main.pleaseWaitDlg.progress.setValue(0);
    3240            Main.pleaseWaitDlg.currentAction.setText(tr("Contacting OSM Server..."));
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r1071 r1146  
    1313
    1414import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.data.osm.DataSet;
    1516import org.openstreetmap.josm.gui.PleaseWaitDialog;
     17import org.xml.sax.SAXException;
    1618
    1719/**
     
    2426 * @author imi
    2527 */
    26 abstract class OsmServerReader extends OsmConnection {
     28public abstract class OsmServerReader extends OsmConnection {
    2729        /**
    2830         * Open a connection to the given url and return a reader on the input stream
     
    3537                String version = Main.pref.get("osm-server.version", "0.5");
    3638                urlStr = Main.pref.get("osm-server.url")+"/"+version+"/" + urlStr;
     39        return getInputStreamRaw(urlStr, pleaseWaitDlg);
     40    }
     41   
     42    protected InputStream getInputStreamRaw(String urlStr, PleaseWaitDialog pleaseWaitDlg) throws IOException {
     43       
    3744                System.out.println("download: "+urlStr);
    3845                initAuthentication();
     
    5057                if (isAuthCancelled() && activeConnection.getResponseCode() == 401)
    5158                        return null;
    52                 if( activeConnection.getResponseCode() == 500 )
     59                if (activeConnection.getResponseCode() == 500)
    5360                {
    5461                        throw new IOException(tr("Server returned internal error. Try a reduced area or retry after waiting some time."));
     
    6673                return inputStream;
    6774        }
     75   
     76    public abstract DataSet parseOsm() throws SAXException, IOException;
     77   
    6878}
Note: See TracChangeset for help on using the changeset viewer.