small modifs

This commit is contained in:
Adam Domagalski 2018-11-21 00:27:22 +01:00
parent 66de4ffa1d
commit 549c2f6484

View File

@ -30,6 +30,23 @@ public class mapUtils {
.include(new LatLng(52.46548540224137, 16.925255680881094))
.build();
// Map Bounds Area
public static void setMapBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
if (check) {
// Set bounds to WMI
mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS);
makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000);
mapboxMap.setMinZoomPreference(16); // TODO export to map config
// drawBoundsArea(context, mapboxMap, mapView, check);
} else {
mapboxMap.setLatLngBoundsForCameraTarget(null);
mapboxMap.setMinZoomPreference(2);
// drawBoundsArea(context, mapboxMap, mapView, check);
}
}
// TODO: remove b4 release
private static final PolygonOptions boundsArea = new PolygonOptions()
.add(WMI_BOUNDS.getNorthWest())
.add(WMI_BOUNDS.getNorthEast())
@ -41,15 +58,8 @@ public class mapUtils {
private static Polygon polygon;
private static View crosshair;
// Map Bounds Area
public static void setMapBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
private static void drawBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
if (check) {
// Set bounds to WMI
mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS);
makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000);
mapboxMap.setMinZoomPreference(16); // TODO export to map config
// Visualise bounds area
// showBoundsArea
polygon = mapboxMap.addPolygon(boundsArea);
@ -59,13 +69,10 @@ public class mapUtils {
crosshair.setBackgroundColor(Color.GREEN);
mapView.addView(crosshair);
} else {
mapboxMap.setLatLngBoundsForCameraTarget(null);
mapboxMap.setMinZoomPreference(2);
mapboxMap.removePolygon(polygon);
mapView.removeView(crosshair);
}
}
public static void makeNewCamera(MapboxMap mapboxMap, double lat, double lon, int zoomParam, int bearingParam, int tiltParam, int duration) {