use of com.google.android.gms.maps.model.CircleOptions in project xDrip-plus by jamorham.
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);
}
use of com.google.android.gms.maps.model.CircleOptions in project Pokemap by omkarmoghe.
the class MapWrapperFragment method drawCatchedPokemonCircle.
private void drawCatchedPokemonCircle(double latitude, double longitude) {
if (mGoogleMap != null && mPref.getShowScannedPlaces()) {
double radiusInMeters = MapHelper.SCAN_RADIUS;
// fill
int shadeColor = 0x44DCD90D;
CircleOptions circleOptions = new CircleOptions().center(new LatLng(latitude, longitude)).radius(radiusInMeters).fillColor(shadeColor).strokeColor(Color.TRANSPARENT).zIndex(MapHelper.LAYER_SCANNED_LOCATIONS);
final Circle circle = mGoogleMap.addCircle(circleOptions);
userSelectedPositionCircles.add(circle);
}
}
use of com.google.android.gms.maps.model.CircleOptions in project PhoneProfilesPlus by henrichg.
the class LocationGeofenceEditorActivity method updateEditedMarker.
private void updateEditedMarker(boolean setMapCamera) {
if (mMap != null) {
if (mLastLocation != null) {
LatLng lastLocationGeofence = new LatLng(mLastLocation.getLatitude(), mLastLocation.getLongitude());
if (lastLocationRadius == null) {
lastLocationRadius = mMap.addCircle(new CircleOptions().center(lastLocationGeofence).radius(mLastLocation.getAccuracy()).strokeColor(ContextCompat.getColor(this, R.color.map_last_location_marker_stroke)).fillColor(ContextCompat.getColor(this, R.color.map_last_location_marker_fill)).strokeWidth(5).zIndex(1));
} else {
lastLocationRadius.setRadius(mLastLocation.getAccuracy());
lastLocationRadius.setCenter(lastLocationGeofence);
}
}
if (mLocation != null) {
LatLng editedGeofence = new LatLng(mLocation.getLatitude(), mLocation.getLongitude());
if (editedMarker == null) {
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(editedGeofence);
editedMarker = mMap.addMarker(markerOptions);
} else
editedMarker.setPosition(editedGeofence);
editedMarker.setTitle(geofenceNameEditText.getText().toString());
if (editedRadius == null) {
editedRadius = mMap.addCircle(new CircleOptions().center(editedGeofence).radius(geofence._radius).strokeColor(ContextCompat.getColor(this, R.color.map_edited_location_marker_stroke)).fillColor(ContextCompat.getColor(this, R.color.map_edited_location_marker_fill)).strokeWidth(5).zIndex(2));
} else {
editedRadius.setRadius(geofence._radius);
editedRadius.setCenter(editedGeofence);
}
radiusLabel.setText(String.valueOf(Math.round(geofence._radius)));
if (setMapCamera)
mMap.moveCamera(CameraUpdateFactory.newLatLng(editedGeofence));
}
}
}
use of com.google.android.gms.maps.model.CircleOptions in project android-samples by googlemaps.
the class TagsDemoActivity method addObjectsToMap.
private void addObjectsToMap() {
// A circle centered on Adelaide.
mAdelaideCircle = mMap.addCircle(new CircleOptions().center(ADELAIDE).radius(500000).fillColor(Color.argb(150, 66, 173, 244)).strokeColor(Color.rgb(66, 173, 244)).clickable(true));
mAdelaideCircle.setTag(new CustomTag("Adelaide circle"));
// A ground overlay at Sydney.
mSydneyGroundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions().image(BitmapDescriptorFactory.fromResource(R.drawable.harbour_bridge)).position(SYDNEY, 700000).clickable(true));
mSydneyGroundOverlay.setTag(new CustomTag("Sydney ground overlay"));
// A marker at Hobart.
mHobartMarker = mMap.addMarker(new MarkerOptions().position(HOBART));
mHobartMarker.setTag(new CustomTag("Hobart marker"));
// A polygon centered at Darwin.
mDarwinPolygon = mMap.addPolygon(new PolygonOptions().add(new LatLng(DARWIN.latitude + 3, DARWIN.longitude - 3), new LatLng(DARWIN.latitude + 3, DARWIN.longitude + 3), new LatLng(DARWIN.latitude - 3, DARWIN.longitude + 3), new LatLng(DARWIN.latitude - 3, DARWIN.longitude - 3)).fillColor(Color.argb(150, 34, 173, 24)).strokeColor(Color.rgb(34, 173, 24)).clickable(true));
mDarwinPolygon.setTag(new CustomTag("Darwin polygon"));
// A polyline from Perth to Brisbane.
mPolyline = mMap.addPolyline(new PolylineOptions().add(PERTH, BRISBANE).color(Color.rgb(103, 24, 173)).width(30).clickable(true));
mPolyline.setTag(new CustomTag("Perth to Brisbane polyline"));
}
use of com.google.android.gms.maps.model.CircleOptions in project android-sdk-examples by IndoorAtlas.
the class WayfindingOverlayActivity method showLocationCircle.
private void showLocationCircle(LatLng center, double accuracyRadius) {
if (mCircle == null) {
// location can received before map is initialized, ignoring those updates
if (mMap != null) {
mCircle = mMap.addCircle(new CircleOptions().center(center).radius(accuracyRadius).fillColor(0x801681FB).strokeColor(0x800A78DD).zIndex(1.0f).visible(true).strokeWidth(5.0f));
}
} else {
// move existing markers position to received location
mCircle.setCenter(center);
mCircle.setRadius(accuracyRadius);
}
}
Aggregations