- Timestamp:
- 2011-10-20T14:32:44+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmChangeReader.java
r4530 r4532 9 9 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 12 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 12 13 … … 61 62 62 63 private void parseDelete() throws XMLStreamException { 63 // Do nothing. If the object has been deleted, do not load it to avoid consistency errors. 64 parseCommon(true); 65 } 66 67 private void parseModify() throws XMLStreamException { 64 68 parseCommon(false); 65 69 } 66 70 67 private void parse Modify() throws XMLStreamException {68 parseCommon( true);71 private void parseCreate() throws XMLStreamException { 72 parseCommon(false); 69 73 } 70 74 71 private void parseCreate() throws XMLStreamException { 72 parseCommon(true); 73 } 74 75 private void parseCommon(boolean keepPrimitive) throws XMLStreamException { 75 private void parseCommon(boolean deletePrimitive) throws XMLStreamException { 76 76 while (parser.hasNext()) { 77 77 int event = parser.next(); 78 78 if (event == XMLStreamConstants.START_ELEMENT) { 79 OsmPrimitive p = null; 79 80 if (parser.getLocalName().equals("node")) { 80 if (keepPrimitive) parseNode(); else doNothing();81 p = parseNode(); 81 82 } else if (parser.getLocalName().equals("way")) { 82 if (keepPrimitive) parseWay(); else doNothing();83 p = parseWay(); 83 84 } else if (parser.getLocalName().equals("relation")) { 84 if (keepPrimitive) parseRelation(); else doNothing();85 p = parseRelation(); 85 86 } else { 86 87 parseUnknown(); 88 } 89 if (p != null && deletePrimitive) { 90 p.setDeleted(true); 87 91 } 88 92 } else if (event == XMLStreamConstants.END_ELEMENT) { … … 90 94 } 91 95 } 92 }93 94 private void doNothing() throws XMLStreamException {95 while (parser.hasNext() && parser.next() != XMLStreamConstants.END_ELEMENT);96 96 } 97 97 -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r4530 r4532 156 156 } 157 157 158 protected voidparseNode() throws XMLStreamException {158 protected Node parseNode() throws XMLStreamException { 159 159 NodeData nd = new NodeData(); 160 160 nd.setCoor(new LatLon(Double.parseDouble(parser.getAttributeValue(null, "lat")), Double.parseDouble(parser.getAttributeValue(null, "lon")))); … … 173 173 } 174 174 } else if (event == XMLStreamConstants.END_ELEMENT) { 175 return ;176 } 177 } 178 } 179 180 protected voidparseWay() throws XMLStreamException {175 return n; 176 } 177 } 178 } 179 180 protected Way parseWay() throws XMLStreamException { 181 181 WayData wd = new WayData(); 182 182 readCommon(wd); … … 206 206 } 207 207 ways.put(wd.getUniqueId(), nodeIds); 208 return w; 208 209 } 209 210 … … 224 225 } 225 226 226 protected voidparseRelation() throws XMLStreamException {227 protected Relation parseRelation() throws XMLStreamException { 227 228 RelationData rd = new RelationData(); 228 229 readCommon(rd); … … 252 253 } 253 254 relations.put(rd.getUniqueId(), members); 255 return r; 254 256 } 255 257
Note:
See TracChangeset
for help on using the changeset viewer.