Changeset 32 in josm for src/org/openstreetmap/josm/data


Ignore:
Timestamp:
2005-12-19T22:58:10+01:00 (18 years ago)
Author:
imi
Message:
  • Fixed bugs in reading/writing
  • Added correct extension filter to load/save
  • Delete now moves to deleted. modified flag reintroduced
Location:
src/org/openstreetmap/josm/data/osm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/data/osm/DataSet.java

    r30 r32  
    4242         */
    4343        public Collection<Track> tracks = new LinkedList<Track>();
     44
     45        /**
     46         * All deleted objects goes here.
     47         */
     48        public Collection<OsmPrimitive> deleted = new LinkedList<OsmPrimitive>();
    4449
    4550        /**
  • src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r31 r32  
    3232        public long id = 0;
    3333
     34        /**
     35         * <code>true</code>, if the object has been modified since it was loaded from
     36         * the server. In this case, on next upload, this object will be updated. Deleted
     37         * objects are deleted from the server, even if they are modified. If the objects
     38         * are added (id=0), the modified is ignored and the object is added to the server.
     39         */
     40        public boolean modified = false;
     41       
    3442        /**
    3543         * If set to true, this object is currently selected.
  • src/org/openstreetmap/josm/data/osm/visitor/AddVisitor.java

    r31 r32  
    2626        public void visit(Node n) {
    2727                ds.nodes.add(n);
     28                ds.deleted.remove(n); // remove if there.
    2829        }
    2930        public void visit(LineSegment ls) {
    3031                ds.lineSegments.add(ls);
     32                ds.deleted.remove(ls); // remove if there.
    3133        }
    3234        public void visit(Track t) {
    3335                ds.tracks.add(t);
     36                ds.deleted.remove(t); // remove if there.
    3437        }
    3538        public void visit(Key k) {}
  • src/org/openstreetmap/josm/data/osm/visitor/DeleteVisitor.java

    r31 r32  
    2525       
    2626        public void visit(Node n) {
    27                 ds.nodes.remove(n);
     27                if (ds.nodes.remove(n))
     28                        ds.deleted.add(n);
    2829        }
    2930        public void visit(LineSegment ls) {
    30                 ds.lineSegments.remove(ls);
     31                if (ds.lineSegments.remove(ls))
     32                        ds.deleted.add(ls);
    3133        }
    3234        public void visit(Track t) {
    33                 ds.tracks.remove(t);
     35                if (ds.tracks.remove(t))
     36                        ds.deleted.add(t);
    3437        }
    3538        public void visit(Key k) {}
Note: See TracChangeset for help on using the changeset viewer.