use of de.westnordost.osmapi.map.data.BoundingBox in project StreetComplete by westnordost.
the class AQuestDaoTest method testGetAllByBoundingBox.
public void testGetAllByBoundingBox() {
BoundingBox bbox = new BoundingBox(50, 1, 51, 2);
// on border
dao.add(createQuest(1, 50, 1, QuestStatus.NEW));
// right lat but wrong lon
dao.add(createQuest(2, 50.5, 50.5, QuestStatus.NEW));
// wrong lat but right lon
dao.add(createQuest(3, 1.5, 1.5, QuestStatus.NEW));
// in
dao.add(createQuest(4, 50.5, 1.5, QuestStatus.NEW));
List<Quest> quests = dao.getAll(bbox, QuestStatus.NEW);
Collections.sort(quests, (lhs, rhs) -> (int) (lhs.getId() - rhs.getId()));
assertEquals(2, quests.size());
assertEquals(1, (long) quests.get(0).getId());
assertEquals(4, (long) quests.get(1).getId());
assertEquals(2, dao.getCount(bbox, QuestStatus.NEW));
}
use of de.westnordost.osmapi.map.data.BoundingBox in project StreetComplete by westnordost.
the class OsmQuestDaoTest method testGetAllByBBox.
public void testGetAllByBBox() {
OsmQuest quest1 = createNewQuest(11, Element.Type.NODE);
OsmQuest quest2 = createNewQuest(12, Element.Type.NODE, new ElementGeometry(new OsmLatLon(11, 11)));
addToDaos(quest1, quest2);
assertEquals(1, dao.getAll(new BoundingBox(0, 0, 10, 10), null, null, null, null).size());
assertEquals(2, dao.getAll(null, null, null, null, null).size());
}
use of de.westnordost.osmapi.map.data.BoundingBox in project StreetComplete by westnordost.
the class CreateNoteDaoTest method testGetAll.
public void testGetAll() {
CreateNote note1 = new CreateNote();
note1.text = "this is in";
note1.position = new OsmLatLon(0.5, 0.5);
dao.add(note1);
CreateNote note2 = new CreateNote();
note2.text = "this is out";
note2.position = new OsmLatLon(-0.5, 0.5);
dao.add(note2);
assertEquals(1, dao.getAll(new BoundingBox(0, 0, 1, 1)).size());
assertEquals(2, dao.getAll(null).size());
}
use of de.westnordost.osmapi.map.data.BoundingBox in project StreetComplete by westnordost.
the class OsmNoteQuestDaoTest method testGetPositions.
public void testGetPositions() {
Note note = NoteDaoTest.createNote();
note.position = new OsmLatLon(34, 35);
noteDao.put(note);
OsmNoteQuest quest = new OsmNoteQuest(note, questType);
dao.add(quest);
List<LatLon> positions = dao.getAllPositions(new BoundingBox(0, 0, 50, 50));
assertEquals(1, positions.size());
assertEquals(new OsmLatLon(34, 35), positions.get(0));
}
use of de.westnordost.osmapi.map.data.BoundingBox in project StreetComplete by westnordost.
the class AddHousenumberIntegrationTest method verifyYieldsNoQuest.
private void verifyYieldsNoQuest(BoundingBox bbox, String date) {
OverpassMapDataDao o = OsmModule.overpassOldMapDataDao(OsmModule::overpassMapDataParser, date);
AddHousenumber quest = new AddHousenumber(o);
MapDataWithGeometryHandler verifier = (element, geometry) -> {
fail("Expected zero elements. Element returned: " + element.getType().name() + "#" + element.getId());
};
quest.download(bbox, verifier);
}
Aggregations