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