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