small modifs
This commit is contained in:
parent
66de4ffa1d
commit
549c2f6484
@ -30,6 +30,23 @@ public class mapUtils {
|
|||||||
.include(new LatLng(52.46548540224137, 16.925255680881094))
|
.include(new LatLng(52.46548540224137, 16.925255680881094))
|
||||||
.build();
|
.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()
|
private static final PolygonOptions boundsArea = new PolygonOptions()
|
||||||
.add(WMI_BOUNDS.getNorthWest())
|
.add(WMI_BOUNDS.getNorthWest())
|
||||||
.add(WMI_BOUNDS.getNorthEast())
|
.add(WMI_BOUNDS.getNorthEast())
|
||||||
@ -41,15 +58,8 @@ public class mapUtils {
|
|||||||
private static Polygon polygon;
|
private static Polygon polygon;
|
||||||
private static View crosshair;
|
private static View crosshair;
|
||||||
|
|
||||||
// Map Bounds Area
|
private static void drawBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
|
||||||
public static void setMapBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
|
|
||||||
|
|
||||||
if (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
|
// Visualise bounds area
|
||||||
// showBoundsArea
|
// showBoundsArea
|
||||||
polygon = mapboxMap.addPolygon(boundsArea);
|
polygon = mapboxMap.addPolygon(boundsArea);
|
||||||
@ -59,13 +69,10 @@ public class mapUtils {
|
|||||||
crosshair.setBackgroundColor(Color.GREEN);
|
crosshair.setBackgroundColor(Color.GREEN);
|
||||||
mapView.addView(crosshair);
|
mapView.addView(crosshair);
|
||||||
} else {
|
} else {
|
||||||
mapboxMap.setLatLngBoundsForCameraTarget(null);
|
|
||||||
mapboxMap.setMinZoomPreference(2);
|
|
||||||
mapboxMap.removePolygon(polygon);
|
mapboxMap.removePolygon(polygon);
|
||||||
mapView.removeView(crosshair);
|
mapView.removeView(crosshair);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void makeNewCamera(MapboxMap mapboxMap, double lat, double lon, int zoomParam, int bearingParam, int tiltParam, int duration) {
|
public static void makeNewCamera(MapboxMap mapboxMap, double lat, double lon, int zoomParam, int bearingParam, int tiltParam, int duration) {
|
||||||
|
Loading…
Reference in New Issue
Block a user