This commit is contained in:
Adam Domagalski 2018-11-21 00:14:25 +01:00
parent 86cafe1d5a
commit 66de4ffa1d
2 changed files with 11 additions and 24 deletions

View File

@ -1,23 +0,0 @@
package com.uam.wmi.findmytutor.utils;
import android.support.annotation.NonNull;
import com.mapbox.mapboxsdk.annotations.InfoWindow;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import com.mapbox.mapboxsdk.maps.MapView;
public class MapboxMarker extends Marker {
public MapboxMarker( MarkerOptions markerOptions ){
super(markerOptions);
}
/*
@NonNull
private InfoWindow showInfoWindow(InfoWindow iw, MapView mapView) {
iw.open(mapView, this, this.getPosition(), 0, 0);
this.infoWindowShown = true;
return iw;
}*/
}

View File

@ -16,6 +16,8 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.FillLayer;
import com.mapbox.mapboxsdk.style.layers.Layer;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -33,9 +35,11 @@ public class mapUtils {
.add(WMI_BOUNDS.getNorthEast()) .add(WMI_BOUNDS.getNorthEast())
.add(WMI_BOUNDS.getSouthEast()) .add(WMI_BOUNDS.getSouthEast())
.add(WMI_BOUNDS.getSouthWest()) .add(WMI_BOUNDS.getSouthWest())
.alpha(0.0f); .alpha(0.1f)
.fillColor(Color.YELLOW);
// For adding and removing // For adding and removing
private static Polygon polygon; private static Polygon polygon;
private static View crosshair;
// Map Bounds Area // Map Bounds Area
public static void setMapBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) { public static void setMapBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
@ -49,10 +53,16 @@ public class mapUtils {
// Visualise bounds area // Visualise bounds area
// showBoundsArea // showBoundsArea
polygon = mapboxMap.addPolygon(boundsArea); polygon = mapboxMap.addPolygon(boundsArea);
// showCrosshair
crosshair = new View(context);
crosshair.setLayoutParams(new FrameLayout.LayoutParams(15, 15, Gravity.CENTER));
crosshair.setBackgroundColor(Color.GREEN);
mapView.addView(crosshair);
} else { } else {
mapboxMap.setLatLngBoundsForCameraTarget(null); mapboxMap.setLatLngBoundsForCameraTarget(null);
mapboxMap.setMinZoomPreference(2); mapboxMap.setMinZoomPreference(2);
mapboxMap.removePolygon(polygon); mapboxMap.removePolygon(polygon);
mapView.removeView(crosshair);
} }