use of de.westnordost.osmapi.map.data.OsmLatLon 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.OsmLatLon in project StreetComplete by westnordost.
the class NodeDaoTest method testPutGetWithTags.
public void testPutGetWithTags() {
Map<String, String> tags = new HashMap<>();
tags.put("a key", "a value");
LatLon pos = new OsmLatLon(2, 2);
Node node = new OsmNode(5, 1, pos, tags);
dao.put(node);
Node dbNode = dao.get(5);
checkEqual(node, dbNode);
}
use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.
the class NodeDaoTest method testPutGetNoTags.
public void testPutGetNoTags() {
LatLon pos = new OsmLatLon(2, 2);
Node node = new OsmNode(5, 1, pos, null);
dao.put(node);
Node dbNode = dao.get(5);
checkEqual(node, dbNode);
}
use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.
the class OsmQuestDaoTest method testGetNoNextNewAt.
public void testGetNoNextNewAt() {
ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
OsmQuest quest = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
quest.setStatus(QuestStatus.ANSWERED);
addToDaos(quest);
assertNull(dao.getNextNewAt(1, null));
}
use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.
the class CreateNoteDaoTest method testNullable.
public void testNullable() {
CreateNote note = new CreateNote();
note.text = "text";
note.position = new OsmLatLon(3, 5);
assertTrue(dao.add(note));
CreateNote dbNote = dao.get(note.id);
assertNull(dbNote.elementType);
assertNull(dbNote.elementId);
assertNull(dbNote.questTitle);
assertNull(dbNote.imagePaths);
}
Aggregations