Fixed version not being added to way/node

This commit is contained in:
PaulStets 2017-06-24 14:32:54 +03:00
parent 23c747458f
commit e2cc3ddebb

9
OsmAnd-java/src/net/osmand/osm/io/OsmBaseStorage.java Normal file → Executable file
View file

@ -205,8 +205,10 @@ public class OsmBaseStorage {
if (ELEM_NODE.equals(name)) { if (ELEM_NODE.equals(name)) {
currentParsedEntity = new Node(parseDouble(parser, ATTR_LAT, 0), parseDouble(parser, ATTR_LON, 0), currentParsedEntity = new Node(parseDouble(parser, ATTR_LAT, 0), parseDouble(parser, ATTR_LON, 0),
parseId(parser, ATTR_ID, -1)); parseId(parser, ATTR_ID, -1));
currentParsedEntity.setVersion(parseVersion(parser));
} else if (ELEM_WAY.equals(name)) { } else if (ELEM_WAY.equals(name)) {
currentParsedEntity = new Way(parseId(parser, ATTR_ID, -1)); currentParsedEntity = new Way(parseId(parser, ATTR_ID, -1));
currentParsedEntity.setVersion(parseVersion(parser));
} else if (ELEM_RELATION.equals(name)) { } else if (ELEM_RELATION.equals(name)) {
currentParsedEntity = new Relation(parseId(parser, ATTR_ID, -1)); currentParsedEntity = new Relation(parseId(parser, ATTR_ID, -1));
} else { } else {
@ -256,6 +258,13 @@ public class OsmBaseStorage {
} }
} }
private int parseVersion(XmlPullParser parser) {
if (parser.getAttributeName(parser.getAttributeCount() - 1).equals(ATTR_VERSION)) {
return Integer.valueOf(parser.getAttributeValue(parser.getAttributeCount() - 1));
}
return -1;
}
public void endElement(XmlPullParser parser, String name) { public void endElement(XmlPullParser parser, String name) {
EntityType type = null; EntityType type = null;
if (ELEM_NODE.equals(name)){ if (ELEM_NODE.equals(name)){