Changeset 28 in josm
- Timestamp:
- 2005-11-30T21:40:09+01:00 (19 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 4 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 } -
src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r24 r28 108 108 } 109 109 }); 110 String oldComboEntry = combo.getEditor().getItem().toString(); 110 111 dlg.setVisible(true); 111 112 112 113 Object answer = optionPane.getValue(); 113 114 if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE || 114 (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) 115 (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) { 116 combo.getEditor().setItem(oldComboEntry); 115 117 return; 118 } 116 119 117 120 String value = combo.getEditor().getItem().toString(); -
src/org/openstreetmap/josm/io/OsmReader.java
r27 r28 96 96 String token = t.nextToken(); 97 97 if (!" ".equals(token)) 98 data.keys.put(Key.get(t .nextToken()), "yes");98 data.keys.put(Key.get(token), "yes"); 99 99 } 100 100 } … … 114 114 if (child.getName().equals("node")) 115 115 addNode(data, parseNode(child)); 116 else if (child.getName().equals("segment")) 117 data.pendingLineSegments.add(parseLineSegment(child, data)); 118 else if (child.getName().equals("track")) 119 data.tracks.add(parseTrack(child, data)); 116 else if (child.getName().equals("segment")) { 117 LineSegment ls = parseLineSegment(child, data); 118 if (data.pendingLineSegments.contains(ls)) 119 throw new JDOMException("Double segment definition "+ls.id); 120 for (Track t : data.tracks) 121 if (t.segments.contains(ls)) 122 throw new JDOMException("Double segment definition "+ls.id); 123 data.pendingLineSegments.add(ls); 124 } else if (child.getName().equals("track")) { 125 Track track = parseTrack(child, data); 126 if (data.tracks.contains(track)) 127 throw new JDOMException("Double track definition "+track.id); 128 data.tracks.add(track); 129 } 120 130 } 121 131
Note:
See TracChangeset
for help on using the changeset viewer.