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


Ignore:
Timestamp:
2005-11-30T21:40:09+01:00 (18 years ago)
Author:
imi
Message:
  • fixed bug: second layer does not get the pending line segments of the first
  • fixed bug: property page edit action "cancel" effect the display of the table
  • data entries with same id now same data
Location:
src/org/openstreetmap/josm/data/osm
Files:
2 edited

Legend:

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

    r23 r28  
    218218        public void clearSelection() {
    219219                clearSelection(nodes);
     220                clearSelection(pendingLineSegments);
    220221                clearSelection(tracks);
    221222                for (Track t : tracks)
     
    242243         * to both datasets. So use mergeFrom only if you are about to abandon the
    243244         * other dataset.
    244          * 
     245         *
    245246         * Elements are tried to merged.
    246247         * Nodes are merged first, if their lat/lon are equal.
    247248         * Line segments are merged, if they have the same nodes.
    248          * Tracs are merged, if they consist of the same line segments.
    249          * 
     249         * Tracks are merged, if they consist of the same line segments.
     250         *
    250251         * Additional to that, every two objects with the same id are merged.
    251          * 
     252         *
    252253         * @param ds    The DataSet to merge into this one.
    253254         * @return A list of all primitives that were used in the conjunction. That
     
    304305                                        lsMap.put(otherLS, myLS);
    305306                // add pendings (ls from track are added later
     307                data.addAll(new HashSet<LineSegment>(lsMap.values()));
    306308                for (LineSegment ls : ds.pendingLineSegments) {
    307309                        if (!lsMap.containsKey(ls)) {
     
    318320                        }
    319321                }
    320                
    321                
     322
     323
    322324                // merge tracks
    323325                LinkedList<Track> trackToAdd = new LinkedList<Track>();
  • src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r23 r28  
    8484                return selected;
    8585        }
     86
     87
     88        /**
     89         * Equal, if the id is equal. If both ids are 0, use the super classes equal
     90         * instead.
     91         */
     92        @Override
     93        public boolean equals(Object obj) {
     94                if (!(obj instanceof OsmPrimitive))
     95                        return false;
     96                OsmPrimitive osm = (OsmPrimitive)obj;
     97                if (id == 0 && osm.id == 0)
     98                        return super.equals(obj);
     99                return id == osm.id;
     100        }
     101
     102        /**
     103         * Return the id as hashcode or supers hashcode if 0.
     104         */
     105        @Override
     106        public int hashCode() {
     107                return id == 0 ? super.hashCode() : (int)id;
     108        }
    86109}
Note: See TracChangeset for help on using the changeset viewer.