use of de.westnordost.osmapi.map.data.Element in project StreetComplete by westnordost.
the class OverpassMapDataParserTest method testWay.
public void testWay() {
OsmLatLon[] p = new OsmLatLon[2];
p[0] = new OsmLatLon(1, 2);
p[1] = new OsmLatLon(3, 4);
String xml = "<way id='8' version='1' >\n" + " <nd ref='2' lat='" + p[0].getLatitude() + "' lon='" + p[0].getLongitude() + "' />\n" + " <nd ref='3' lat='" + p[1].getLatitude() + "' lon='" + p[1].getLongitude() + "' />\n" + "</way>";
LongSparseArray<List<LatLon>> expectedGeometry = new LongSparseArray<>();
expectedGeometry.put(8, new ArrayList<>(Arrays.asList(p)));
Element e = parseOne(xml, expectedGeometry);
assertTrue(e instanceof Way);
Way way = (Way) e;
assertEquals(8, way.getId());
assertEquals(1, way.getVersion());
assertEquals(2, way.getNodeIds().size());
assertEquals(2, (long) way.getNodeIds().get(0));
assertEquals(3, (long) way.getNodeIds().get(1));
}
use of de.westnordost.osmapi.map.data.Element in project StreetComplete by westnordost.
the class OverpassMapDataParserTest method testTags.
public void testTags() {
String xml = "<relation id='1' version='1' >\n" + " <tag k='a' v='b'/>" + " <tag k='c' v='d'/>" + "</relation>";
Element element = parseOne(xml, null);
assertNotNull(element.getTags());
assertEquals(2, element.getTags().size());
assertEquals("b", element.getTags().get("a"));
assertEquals("d", element.getTags().get("c"));
}
Aggregations