Ignore:
Timestamp:
2008-05-12T10:14:29+02:00 (16 years ago)
Author:
framm
Message:
  • more api0.6 stuff from kleptog
Location:
trunk/src/org/openstreetmap/josm/io
Files:
2 edited

Legend:

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

    r627 r633  
    8585                        osm.user = user;
    8686                        osm.visible = visible;
     87                        osm.version = version;
    8788                        osm.checkTagged();
    8889                        osm.checkDirectionTagged();
     
    249250                if (visible != null) {
    250251                        current.visible = Boolean.parseBoolean(visible);
     252                }
     253
     254                // oldversion attribute added in 0.6 API
     255
     256                // Note there is an asymmetry here: the server will send
     257                // the version as "version" the client sends it as
     258                // "oldversion". So we take both since which we receive will
     259                // depend on reading from a file or reading from the server
     260
     261                String version = atts.getValue("version");
     262                if (version != null) {
     263                        current.version = Integer.parseInt(version);
     264                }
     265                version = atts.getValue("old_version");
     266                if (version != null) {
     267                        current.version = Integer.parseInt(version);
    251268                }
    252269
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r627 r633  
    149149                Main.pleaseWaitDlg.currentAction.setText(tr("Opening changeset..."));
    150150                changeset = new Changeset();
    151                 changeset.put( "created_by", "josm" );
     151                changeset.put( "created_by", "JOSM" );
    152152                changeset.put( "comment", comment );
    153153                try {
     
    303303         */
    304304        public void visit(Node n) {
    305                 if (n.id == 0 && !n.deleted && n.get("created_by") == null) {
    306                         n.put("created_by", "JOSM");
    307                         sendRequest("PUT", "node", n, true);
    308                 } else if (n.deleted) {
     305                if (n.deleted) {
    309306                        sendRequest("DELETE", "node", n, true);
    310307                } else {
     
    318315         */
    319316        public void visit(Way w) {
    320                 if (w.id == 0 && !w.deleted && w.get("created_by") == null) {
    321                         w.put("created_by", "JOSM");
    322                         sendRequest("PUT", "way", w, true);
    323                 } else if (w.deleted) {
     317                if (w.deleted) {
    324318                        sendRequest("DELETE", "way", w, true);
    325319                } else {
     
    333327         */
    334328        public void visit(Relation e) {
    335                 if (e.id == 0 && !e.deleted && e.get("created_by") == null) {
    336                         e.put("created_by", "JOSM");
    337                         sendRequest("PUT", "relation", e, true);
    338                 } else if (e.deleted) {
     329                if (e.deleted) {
    339330                        sendRequest("DELETE", "relation", e, true);
    340331                } else {
     
    398389                        if (retCode == 200)
    399390                                if(osm.id == 0)
     391                                {
    400392                                        osm.id = readId(activeConnection.getInputStream());
     393                                        osm.version = 1;
     394                                }
    401395                                else
    402396                                {
Note: See TracChangeset for help on using the changeset viewer.