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