Ignore:
Timestamp:
2009-09-13T19:30:36+02:00 (17 years ago)
Author:
Gubaer
Message:

new: reading open changesets from the server
new: reading user info from the server
new: any open changeset can be used when uploading
new: generic dialog for closing changesets
fixed #3427: JOSM can't keep many changesets open at once
fixed #3408: Allow continuing opened changeset even after restarting JOSM
fixed #3476: Default selection in upload dialog should be different for unclosed changesets. (Upload dialog now looks different)

File:
1 edited

Legend:

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

    r2094 r2115  
    3636
    3737/**
    38  * Parser for the Osm Api. Read from an input stream and constructs a dataset out of it.
     38 * Parser for the Osm Api. Read from an input stream and construct a dataset out of it.
    3939 *
    4040 */
     
    8080    }
    8181
     82    private static class OsmPrimitiveData {
     83        public long id = 0;
     84        public boolean modified = false;
     85        public boolean deleted = false;
     86        public Date timestamp = new Date();
     87        public User user = null;
     88        public boolean visible = true;
     89        public int version = 0;
     90        public LatLon latlon = new LatLon(0,0);
     91        private OsmPrimitive primitive;
     92
     93        public void copyTo(OsmPrimitive osm) {
     94            osm.setModified(modified);
     95            osm.setDeleted(deleted);
     96            //  id < 0 possible if read from a file
     97            if (id <= 0) {
     98                osm.clearOsmId();
     99            } else {
     100                osm.setOsmId(id, version);
     101            }
     102            osm.setTimestamp(timestamp);
     103            osm.user = user;
     104            osm.setVisible(visible);
     105            osm.mappaintStyle = null;
     106        }
     107
     108        public Node createNode() {
     109            Node node = new Node();
     110            node.setCoor(latlon);
     111            copyTo(node);
     112            primitive = node;
     113            return node;
     114        }
     115
     116        public Way createWay() {
     117            Way way = new Way();
     118            copyTo(way);
     119            primitive = way;
     120            return way;
     121        }
     122        public Relation createRelation() {
     123            Relation relation= new Relation();
     124            copyTo(relation);
     125            primitive = relation;
     126            return relation;
     127        }
     128
     129        public void rememberTag(String key, String value) {
     130            primitive.put(key, value);
     131        }
     132    }
    82133
    83134    /**
     
    100151     */
    101152    private Map<Long, Collection<RelationMemberData>> relations = new HashMap<Long, Collection<RelationMemberData>>();
    102 
    103153
    104154    private class Parser extends DefaultHandler {
     
    241291                current.rememberTag(key, value);
    242292            } else {
    243                 System.out.println(tr("Warning: Undefined element ''{0}'' found in input stream. Skipping.", qName));
     293                throwException(tr("Undefined element ''{0}'' found in input stream. Aborting.", qName));
    244294            }
    245295        }
     
    503553        }
    504554    }
    505 
    506     /**
    507      * Temporarily holds data for a parsed {@see OsmPrimitive} and provides
    508      * methods for creating an {@see OsmPrimitive} based on this data.
    509      */
    510     private static class OsmPrimitiveData {
    511         public long id = 0;
    512         public boolean modified = false;
    513         public boolean deleted = false;
    514         public Date timestamp = new Date();
    515         public User user = null;
    516         public boolean visible = true;
    517         public int version = 0;
    518         public LatLon latlon = new LatLon(0,0);
    519         private OsmPrimitive primitive;
    520 
    521         public void copyTo(OsmPrimitive osm) {
    522             //  id < 0 possible if read from a file
    523             if (id <= 0) {
    524                 osm.clearOsmId();
    525             } else {
    526                 osm.setOsmId(id, version);
    527             }
    528             osm.setDeleted(deleted);
    529             osm.setModified(modified);
    530             osm.setTimestamp(timestamp);
    531             osm.user = user;
    532             osm.setVisible(visible);
    533             osm.mappaintStyle = null;
    534         }
    535 
    536         public Node createNode() {
    537             Node node = new Node();
    538             node.setCoor(latlon);
    539             copyTo(node);
    540             primitive = node;
    541             return node;
    542         }
    543 
    544         public Way createWay() {
    545             Way way = new Way();
    546             copyTo(way);
    547             primitive = way;
    548             return way;
    549         }
    550         public Relation createRelation() {
    551             Relation relation= new Relation();
    552             copyTo(relation);
    553             primitive = relation;
    554             return relation;
    555         }
    556 
    557         public void rememberTag(String key, String value) {
    558             primitive.put(key, value);
    559         }
    560     }
    561555}
Note: See TracChangeset for help on using the changeset viewer.