Search in sources :

Example 51 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon 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 52 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon 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 53 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon 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 54 with OsmLatLon

use of de.westnordost.osmapi.map.data.OsmLatLon 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)

Example 55 with OsmLatLon

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

the class SphericalEarthMathTest method checkTranslate.

private void checkTranslate(int distance, int angle) {
    LatLon one = new OsmLatLon(53.5712482, 9.9782365);
    checkTranslate(one, distance, angle);
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) 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