Search in sources :

Example 36 with OsmLatLon

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

the class QuestAutoSyncer method onLocationChanged.

@Override
public void onLocationChanged(Location location) {
    this.pos = new OsmLatLon(location.getLatitude(), location.getLongitude());
    triggerAutoDownload();
}
Also used : OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 37 with OsmLatLon

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

the class JTSConst method toLinearRing.

public static LinearRing toLinearRing(BoundingBox bbox) {
    List<LatLon> corners = new ArrayList<>(5);
    corners.add(bbox.getMin());
    corners.add(new OsmLatLon(bbox.getMinLatitude(), bbox.getMaxLongitude()));
    corners.add(bbox.getMax());
    corners.add(new OsmLatLon(bbox.getMaxLatitude(), bbox.getMinLongitude()));
    corners.add(bbox.getMin());
    return factory.createLinearRing(toCoordinates(corners));
}
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 38 with OsmLatLon

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

the class SlippyMapMath method enclosingTiles.

public static Rect enclosingTiles(BoundingBox bbox, int zoom) {
    double notTheNextTile = 0.0000001;
    Point min = enclosingTile(bbox.getMin(), zoom);
    Point max = enclosingTile(new OsmLatLon(bbox.getMaxLatitude() - notTheNextTile, bbox.getMaxLongitude() - notTheNextTile), zoom);
    return new Rect(min.x, max.y, max.x, min.y);
}
Also used : Rect(android.graphics.Rect) Point(android.graphics.Point) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 39 with OsmLatLon

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

the class ElementGeometryTest method testFindCenterOfPolygonWithNoArea.

public void testFindCenterOfPolygonWithNoArea() {
    List<List<LatLon>> polygons = new ArrayList<>();
    List<LatLon> square = new ArrayList<>();
    square.add(new OsmLatLon(10, 10));
    polygons.add(square);
    ElementGeometry geom = new ElementGeometry(null, polygons);
    assertEquals(null, geom.center);
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 40 with OsmLatLon

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

the class ElementGeometryTest method testFindCenterOfPolygons.

public void testFindCenterOfPolygons() {
    List<List<LatLon>> polygons = new ArrayList<>();
    polygons.add(createSquareAroundOrigin(5, 5));
    ElementGeometry geom = new ElementGeometry(null, polygons);
    assertEquals(new OsmLatLon(0, 0), geom.center);
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) 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