Ignore:
Timestamp:
2006-03-14T01:47:55+01:00 (18 years ago)
Author:
imi
Message:
  • implemented 0.3 API
  • enabled upload of ways
  • switched to MinML (GPX still uses JDOM)
  • changed assumed server precision to 10-12 (was 10-13)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/actions/UploadAction.java

    r52 r58  
    1717import org.jdom.JDOMException;
    1818import org.openstreetmap.josm.Main;
     19import org.openstreetmap.josm.data.Preferences.PreferencesException;
    1920import org.openstreetmap.josm.data.osm.OsmPrimitive;
    20 import org.openstreetmap.josm.data.osm.Track;
    2121import org.openstreetmap.josm.gui.GBC;
    2222import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
     
    3939
    4040        public void actionPerformed(ActionEvent e) {
     41               
     42                //TODO: Remove this in later versions (temporary only)
     43                if (Main.pref.osmDataServer.endsWith("/0.2") || Main.pref.osmDataServer.endsWith("/0.2/")) {
     44                        int answer = JOptionPane.showConfirmDialog(Main.main,
     45                                        "You seem to have an outdated server entry in your preferences.\n" +
     46                                        "\n" +
     47                                        "As of JOSM Release 1.2, you must no longer specify the API version in\n" +
     48                                        "the osm url. For the OSM standard server, use http://www.openstreetmap.org/api" +
     49                                        "\n" +
     50                                        "Fix settings and continue?", "Outdated server url detected.", JOptionPane.YES_NO_OPTION);
     51                        if (answer != JOptionPane.YES_OPTION)
     52                                return;
     53                        int cutPos = Main.pref.osmDataServer.endsWith("/0.2") ? 4 : 5;
     54                        Main.pref.osmDataServer = Main.pref.osmDataServer.substring(0, Main.pref.osmDataServer.length()-cutPos);
     55                        try {
     56                                Main.pref.save();
     57                        } catch (PreferencesException x) {
     58                                x.printStackTrace();
     59                                JOptionPane.showMessageDialog(Main.main, "Could not save the preferences chane:\n" +
     60                                                x.getMessage());
     61                        }
     62                }
     63
    4164                final Collection<OsmPrimitive> add = new LinkedList<OsmPrimitive>();
    4265                final Collection<OsmPrimitive> update = new LinkedList<OsmPrimitive>();
    4366                final Collection<OsmPrimitive> delete = new LinkedList<OsmPrimitive>();
    44                 boolean acceptedTracks = false;
    4567                for (OsmPrimitive osm : Main.main.ds.allPrimitives()) {
    46                         boolean doSomething = true;
    4768                        if (osm.id == 0 && !osm.isDeleted())
    4869                                add.add(osm);
     
    5172                        else if (osm.isDeleted() && osm.id != 0)
    5273                                delete.add(osm);
    53                         else
    54                                 doSomething = false;
    55 
    56                         if (osm instanceof Track && doSomething && !acceptedTracks) {
    57                                 int answer = JOptionPane.showConfirmDialog(Main.main,
    58                                                 "The server currently does not understand the concept of Tracks.\n" +
    59                                                 "All tracks will be ignored on upload. Continue anyway?",
    60                                                 "No Track support", JOptionPane.YES_NO_OPTION);
    61                                 if (answer != JOptionPane.YES_OPTION)
    62                                         return;
    63                                 acceptedTracks = true;
    64                         }
    6574                }
    6675
     
    8897                }).start();
    8998        }
    90        
     99
    91100        /**
    92101         * Displays a screen where the actions that would be taken are displayed and
Note: See TracChangeset for help on using the changeset viewer.