Changeset 28 in josm for src/org/openstreetmap/josm/data
- Timestamp:
- 2005-11-30T21:40:09+01:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm/data/osm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/osm/DataSet.java
r23 r28 218 218 public void clearSelection() { 219 219 clearSelection(nodes); 220 clearSelection(pendingLineSegments); 220 221 clearSelection(tracks); 221 222 for (Track t : tracks) … … 242 243 * to both datasets. So use mergeFrom only if you are about to abandon the 243 244 * other dataset. 244 * 245 * 245 246 * Elements are tried to merged. 246 247 * Nodes are merged first, if their lat/lon are equal. 247 248 * Line segments are merged, if they have the same nodes. 248 * Trac s are merged, if they consist of the same line segments.249 * 249 * Tracks are merged, if they consist of the same line segments. 250 * 250 251 * Additional to that, every two objects with the same id are merged. 251 * 252 * 252 253 * @param ds The DataSet to merge into this one. 253 254 * @return A list of all primitives that were used in the conjunction. That … … 304 305 lsMap.put(otherLS, myLS); 305 306 // add pendings (ls from track are added later 307 data.addAll(new HashSet<LineSegment>(lsMap.values())); 306 308 for (LineSegment ls : ds.pendingLineSegments) { 307 309 if (!lsMap.containsKey(ls)) { … … 318 320 } 319 321 } 320 321 322 323 322 324 // merge tracks 323 325 LinkedList<Track> trackToAdd = new LinkedList<Track>(); -
src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r23 r28 84 84 return selected; 85 85 } 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 } 86 109 }
Note:
See TracChangeset
for help on using the changeset viewer.