Search in sources :

Example 26 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon 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());
}
Also used : BoundingBox(de.westnordost.osmapi.map.data.BoundingBox) ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 27 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.

the class OsmQuestDaoTest method testGetAllByMultipleQuestTypes.

public void testGetAllByMultipleQuestTypes() {
    ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
    OsmQuest quest1 = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
    OsmQuest quest2 = createNewQuest(new TestQuestType2(), 2, Element.Type.NODE, geom);
    addToDaos(quest1, quest2);
    List<OsmQuest> only1 = dao.getAll(null, null, Collections.singletonList(TestQuestType.class.getSimpleName()));
    assertEquals(1, only1.size());
    List<OsmQuest> both = dao.getAll(null, null, Arrays.asList(TestQuestType.class.getSimpleName(), TestQuestType2.class.getSimpleName()));
    assertEquals(2, both.size());
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) TestQuestType2(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)

Example 28 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.

the class OsmQuestDaoTest method testGetNextNewAt.

public void testGetNextNewAt() {
    ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
    OsmQuest quest = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
    quest.setStatus(QuestStatus.ANSWERED);
    addToDaos(quest, createNewQuest(new TestQuestType2(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType3(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType4(), 1, Element.Type.NODE, geom), createNewQuest(new TestQuestType5(), 1, Element.Type.NODE, geom));
    OsmQuest nextQuest = dao.getNextNewAt(1, Arrays.asList("TestQuestType4", "TestQuestType3", "TestQuestType5"));
    assertEquals(nextQuest.getType().getClass().getSimpleName(), "TestQuestType4");
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) TestQuestType5(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType5) TestQuestType4(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType4) TestQuestType3(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType3) TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) TestQuestType2(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)

Example 29 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.

the class OsmQuestDaoTest method testGetNoFittingNextNewAt.

public void testGetNoFittingNextNewAt() {
    ElementGeometry geom = new ElementGeometry(new OsmLatLon(5, 5));
    OsmQuest quest = createNewQuest(new TestQuestType(), 1, Element.Type.NODE, geom);
    quest.setStatus(QuestStatus.ANSWERED);
    addToDaos(quest, createNewQuest(new TestQuestType2(), 2, Element.Type.NODE, geom));
    assertNull(dao.getNextNewAt(1, Arrays.asList("TestQuestType")));
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmQuest(de.westnordost.streetcomplete.data.osm.OsmQuest) TestQuestType(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType) TestQuestType2(de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)

Example 30 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon in project StreetComplete by westnordost.

the class CreateNoteDaoTest method testCountOne.

public void testCountOne() {
    CreateNote note1 = new CreateNote();
    note1.position = new OsmLatLon(0.5, 0.5);
    note1.text = "joho";
    dao.add(note1);
    assertEquals(1, dao.getCount());
}
Also used : OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Aggregations

OsmLatLon (de.westnordost.osmapi.map.data.OsmLatLon)61 LatLon (de.westnordost.osmapi.map.data.LatLon)33 ArrayList (java.util.ArrayList)24 BoundingBox (de.westnordost.osmapi.map.data.BoundingBox)9 ElementGeometry (de.westnordost.streetcomplete.data.osm.ElementGeometry)9 Date (java.util.Date)8 List (java.util.List)8 OsmQuest (de.westnordost.streetcomplete.data.osm.OsmQuest)7 Note (de.westnordost.osmapi.notes.Note)6 OsmNode (de.westnordost.osmapi.map.data.OsmNode)5 TestQuestType (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType)5 Element (de.westnordost.osmapi.map.data.Element)4 TestQuestType2 (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)4 Node (de.westnordost.osmapi.map.data.Node)3 NoteComment (de.westnordost.osmapi.notes.NoteComment)3 HashMap (java.util.HashMap)3 Point (android.graphics.Point)2 Rect (android.graphics.Rect)2 LongSparseArray (android.util.LongSparseArray)2 QuestGroup (de.westnordost.streetcomplete.data.QuestGroup)2