use of com.google.android.gms.maps.model.CircleOptions in project xDrip by NightscoutFoundation.
the class MapsActivity method redrawmap.
private static void redrawmap() {
Log.d(TAG, "Attempting to redraw map: " + lastGeoLocation);
if (mMap == null)
return;
mMap.clear();
String[] splits = lastGeoLocation.split(",");
// sanity check goes here
LatLng mylocation;
try {
mylocation = new LatLng(Double.parseDouble(splits[0]), Double.parseDouble(splits[1]));
} catch (NumberFormatException e) {
Log.e(TAG, "Mylocation number exception: '" + lastGeoLocation + "'");
return;
} catch (ArrayIndexOutOfBoundsException e) {
Log.e(TAG, "Mylocation array index exception: '" + lastGeoLocation + "'");
return;
}
CircleOptions circleOptions = new CircleOptions().center(mylocation).strokeWidth(2).strokeColor(Color.GRAY).radius(1500);
String title = "";
if (lastGeoLocation.equals(defaultLocation)) {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mylocation, 16));
title = "No location data yet";
} else {
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mylocation, 13));
}
if (lats.size() > 0) {
PolylineOptions mylines = new PolylineOptions();
for (int c = 0; c < lats.size(); c++) {
mylines.add(new LatLng(lats.get(c), longs.get(c)));
}
mylines.width(1);
mylines.color(Color.parseColor("#2ba367"));
mMap.addPolyline(mylines);
}
mMap.addCircle(circleOptions);
mMap.addMarker(new MarkerOptions().position(mylocation).title(title).alpha(0.9f).icon(BitmapDescriptorFactory.fromResource(R.drawable.jamorham_parakeet_marker)));
mMap.getUiSettings().setMapToolbarEnabled(false);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
}
Aggregations