Search in sources :

Example 56 with OsmLatLon

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));
}
Also used : LongSparseArray(android.util.LongSparseArray) Element(de.westnordost.osmapi.map.data.Element) ArrayList(java.util.ArrayList) List(java.util.List) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) Way(de.westnordost.osmapi.map.data.Way)

Example 57 with OsmLatLon

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);
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) HashMap(java.util.HashMap) OsmNode(de.westnordost.osmapi.map.data.OsmNode) OsmNode(de.westnordost.osmapi.map.data.OsmNode) Node(de.westnordost.osmapi.map.data.Node) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 58 with OsmLatLon

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);
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmNode(de.westnordost.osmapi.map.data.OsmNode) OsmNode(de.westnordost.osmapi.map.data.OsmNode) Node(de.westnordost.osmapi.map.data.Node) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 59 with OsmLatLon

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));
}
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)

Example 60 with OsmLatLon

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);
}
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