Changeset 86 in josm for src/org/openstreetmap/josm/io/OsmReaderOld.java
- Timestamp:
- 2006-04-21T14:31:51+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/io/OsmReaderOld.java
r71 r86 11 11 import org.openstreetmap.josm.data.coor.LatLon; 12 12 import org.openstreetmap.josm.data.osm.DataSet; 13 import org.openstreetmap.josm.data.osm. LineSegment;13 import org.openstreetmap.josm.data.osm.Segment; 14 14 import org.openstreetmap.josm.data.osm.Node; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 80 80 return parseNode(e); 81 81 else if (e.getName().equals("segment")) 82 return parse LineSegment(e, data);82 return parseSegment(e, data); 83 83 else if (e.getName().equals("way")) 84 84 return parseWay(e, data); … … 115 115 116 116 /** 117 * Parse and return an linesegment. The node information of the "from" and117 * Parse and return an segment. The node information of the "from" and 118 118 * "to" attributes must already be in the dataset. 119 * @param e The linesegment element to parse.119 * @param e The segment element to parse. 120 120 * @param data The dataset to obtain the node information from. 121 * @return The parsed linesegment.121 * @return The parsed segment. 122 122 * @throws JDOMException In case of parsing errors. 123 123 */ 124 private LineSegment parseLineSegment(Element e, DataSet data) throws JDOMException {124 private Segment parseSegment(Element e, DataSet data) throws JDOMException { 125 125 long startId = Long.parseLong(e.getAttributeValue("from")); 126 126 long endId = Long.parseLong(e.getAttributeValue("to")); … … 135 135 if (start == null || end == null) 136 136 throw new JDOMException("The 'from' or 'to' object has not been transfered before."); 137 LineSegment ls = new LineSegment(start, end);137 Segment ls = new Segment(start, end); 138 138 parseCommon(ls, e); 139 139 return ls; … … 154 154 Element child = (Element)o; 155 155 long id = Long.parseLong(child.getAttributeValue("uid")); 156 LineSegment ls = findLineSegment(data.lineSegments, id);156 Segment ls = findSegment(data.segments, id); 157 157 way.segments.add(ls); 158 158 } … … 189 189 190 190 String action = e.getAttributeValue("action"); 191 if ("delete".equals(action)) 192 data.setDeleted(true); 193 else if ("modify".equals(action)) 194 data.modified = data.modifiedProperties = true; 195 else if ("modify/property".equals(action)) 196 data.modifiedProperties = true; 197 else if ("modify/object".equals(action)) 191 if (action == null) 192 return; 193 if (action.equals("delete")) 194 data.delete(true); 195 else if (action.startsWith("modify")) 198 196 data.modified = true; 199 197 } … … 218 216 if (osm.id == id) 219 217 return osm; 220 for (OsmPrimitive osm : data. lineSegments)218 for (OsmPrimitive osm : data.segments) 221 219 if (osm.id == id) 222 220 return osm; … … 230 228 * Search for a segment in a collection by comparing the id. 231 229 */ 232 private LineSegment findLineSegment(Collection<LineSegment> segments, long id) throws JDOMException {233 for ( LineSegment ls : segments)230 private Segment findSegment(Collection<Segment> segments, long id) throws JDOMException { 231 for (Segment ls : segments) 234 232 if (ls.id == id) 235 233 return ls; 236 throw new JDOMException("Unknown linesegment reference: "+id);234 throw new JDOMException("Unknown segment reference: "+id); 237 235 } 238 236 }
Note:
See TracChangeset
for help on using the changeset viewer.