Search in sources :

Example 56 with LatLon

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

the class TangramConstTest method testConvertLists.

public void testConvertLists() {
    List<List<LatLon>> positionLists = new ArrayList<>();
    List<LatLon> positions1 = new ArrayList<>();
    positionLists.add(positions1);
    List<LatLon> positions2 = new ArrayList<>();
    positions2.add(new OsmLatLon(1, 2));
    positions2.add(new OsmLatLon(3, 4));
    positionLists.add(positions2);
    List<LatLon> positions3 = new ArrayList<>();
    positions3.add(new OsmLatLon(5, 6));
    positionLists.add(positions3);
    List<List<LatLon>> positionLists2 = TangramConst.toLatLon(TangramConst.toLngLat(positionLists));
    assertEquals(positionLists, positionLists2);
}
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 57 with LatLon

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

the class SphericalEarthMathTest method testDistanceOfPolylineIsZeroForOnePosition.

public void testDistanceOfPolylineIsZeroForOnePosition() {
    List<LatLon> positions = new ArrayList<>();
    positions.add(new OsmLatLon(0, 0));
    assertEquals(0.0, SphericalEarthMath.distance(positions));
}
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 58 with LatLon

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

the class SphericalEarthMathTest method testDistanceOfPolylineForTwoPositions.

public void testDistanceOfPolylineForTwoPositions() {
    List<LatLon> positions = new ArrayList<>();
    LatLon p0 = new OsmLatLon(0, 0);
    LatLon p1 = new OsmLatLon(1, 1);
    positions.add(p0);
    positions.add(p1);
    assertEquals(SphericalEarthMath.distance(p0, p1), SphericalEarthMath.distance(positions));
}
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 59 with LatLon

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

the class SphericalEarthMathTest method testEnclosingBoundingBoxLine.

public void testEnclosingBoundingBoxLine() {
    List<LatLon> positions = new ArrayList<>();
    positions.add(new OsmLatLon(-4, 0));
    positions.add(new OsmLatLon(12, 3));
    positions.add(new OsmLatLon(1, 16));
    positions.add(new OsmLatLon(0, -6));
    BoundingBox bbox = SphericalEarthMath.enclosingBoundingBox(positions);
    assertEquals(-4.0, bbox.getMinLatitude());
    assertEquals(12.0, bbox.getMaxLatitude());
    assertEquals(16.0, bbox.getMaxLongitude());
    assertEquals(-6.0, bbox.getMinLongitude());
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) BoundingBox(de.westnordost.osmapi.map.data.BoundingBox) ArrayList(java.util.ArrayList) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

Example 60 with LatLon

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

the class SphericalEarthMathTest method testShortDistance.

public void testShortDistance() {
    LatLon one = new OsmLatLon(53.5712482, 9.9782365);
    LatLon two = new OsmLatLon(53.5712528, 9.9782517);
    assertEquals(1, (int) SphericalEarthMath.distance(one, two));
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon)

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