Search in sources :

Example 31 with LatLon

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

the class OverpassMapDataParserTest method testNode.

public void testNode() {
    LatLon pos = new OsmLatLon(51.7463194, 0.2428181);
    String xml = " <node id='5' version='1' lat='" + pos.getLatitude() + "' lon='" + pos.getLongitude() + "'/>";
    Element e = parseOne(xml, null);
    assertTrue(e instanceof Node);
    Node node = (Node) e;
    assertEquals(pos, node.getPosition());
    assertEquals(5, node.getId());
    assertEquals(1, node.getVersion());
    assertNull(node.getTags());
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) Element(de.westnordost.osmapi.map.data.Element) Node(de.westnordost.osmapi.map.data.Node) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 32 with LatLon

use of de.westnordost.osmapi.map.data.LatLon 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));
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) Note(de.westnordost.osmapi.notes.Note) BoundingBox(de.westnordost.osmapi.map.data.BoundingBox) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 33 with LatLon

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

the class RoadNameSuggestionsDaoTest method createRoadPositions.

private static ArrayList<LatLon> createRoadPositions() {
    ArrayList<LatLon> roadPositions = new ArrayList<>();
    roadPositions.add(new OsmLatLon(0, 0));
    roadPositions.add(new OsmLatLon(0, 0.0001));
    return roadPositions;
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) ArrayList(java.util.ArrayList) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 34 with LatLon

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

the class MainActivity method downloadAreaConfirmed.

private void downloadAreaConfirmed(BoundingBox bbox) {
    double areaInSqKm = SphericalEarthMath.enclosedArea(bbox) / 1000000;
    // below a certain threshold, it does not make sense to download, so let's enlarge it
    if (areaInSqKm < ApplicationConstants.MIN_DOWNLOADABLE_AREA_IN_SQKM) {
        LatLon pos = mapFragment.getPosition();
        if (pos != null) {
            bbox = SphericalEarthMath.enclosingBoundingBox(pos, ApplicationConstants.MIN_DOWNLOADABLE_RADIUS_IN_METERS);
        }
    }
    questController.download(bbox, 5, true);
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon)

Example 35 with LatLon

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

the class QuestDownload method downloadNotes.

private Set<LatLon> downloadNotes(BoundingBox bbox) {
    OsmNotesDownload notesDownload = notesDownloadProvider.get();
    notesDownload.setQuestListener(questListener);
    Long userId = prefs.getLong(Prefs.OSM_USER_ID, -1);
    if (userId == -1)
        userId = null;
    int maxNotes = 10000;
    Set<LatLon> result = notesDownload.download(bbox, userId, maxNotes);
    downloadedTilesDao.put(tiles, OsmNoteQuestType.class.getSimpleName());
    downloadedQuestTypes++;
    dispatchProgress();
    return result;
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmNotesDownload(de.westnordost.streetcomplete.data.osmnotes.OsmNotesDownload) OsmNoteQuestType(de.westnordost.streetcomplete.data.osmnotes.OsmNoteQuestType)

Aggregations

LatLon (de.westnordost.osmapi.map.data.LatLon)63 OsmLatLon (de.westnordost.osmapi.map.data.OsmLatLon)45 ArrayList (java.util.ArrayList)29 BoundingBox (de.westnordost.osmapi.map.data.BoundingBox)13 List (java.util.List)12 ElementGeometry (de.westnordost.streetcomplete.data.osm.ElementGeometry)8 OsmNode (de.westnordost.osmapi.map.data.OsmNode)5 HashMap (java.util.HashMap)5 Point (android.graphics.Point)3 PointF (android.graphics.PointF)3 Node (de.westnordost.osmapi.map.data.Node)3 OsmElementQuestType (de.westnordost.streetcomplete.data.osm.OsmElementQuestType)3 LngLat (com.mapzen.tangram.LngLat)2 Point (com.vividsolutions.jts.geom.Point)2 Element (de.westnordost.osmapi.map.data.Element)2 QuestGroup (de.westnordost.streetcomplete.data.QuestGroup)2 VisibleQuestListener (de.westnordost.streetcomplete.data.VisibleQuestListener)2 OsmNoteQuestType (de.westnordost.streetcomplete.data.osmnotes.OsmNoteQuestType)2 Collection (java.util.Collection)2 Map (java.util.Map)2