private void AddClusterItems(Location currentLocation) { var items = new List <ClusterItem>(); // Add current location to the cluster list var currentMarker = new MarkerOptions(); var me = new LatLng(currentLocation.Latitude, currentLocation.Longitude); currentMarker.SetPosition(me); var meMarker = new CircleOptions(); meMarker.InvokeCenter(me); meMarker.InvokeRadius(32); meMarker.InvokeStrokeWidth(0); meMarker.InvokeFillColor(ContextCompat.GetColor(BaseContext, Android.Resource.Color.HoloBlueLight)); _googleMap.AddCircle(meMarker); items.Add(new ClusterItem(currentLocation.Latitude, currentLocation.Longitude)); // Create a log. spiral of markers to test clustering for (int i = 0; i < 20; ++i) { var t = i * Math.PI * 0.33f; var r = 0.005 * Math.Exp(0.1 * t); var x = r * Math.Cos(t); var y = r * Math.Sin(t); items.Add(new ClusterItem(currentLocation.Latitude + x, currentLocation.Longitude + y)); } _clusterManager.AddItems(items); }
public void OnLocationChanged(Location location) { Location currentLocation = location; myLocation = location; if (currentLocation == null) { Console.WriteLine("Unable to determine your location. Try again in a short while."); } else { Console.WriteLine(string.Format("{0:f6},{1:f6}", currentLocation.Latitude, currentLocation.Longitude)); myLocation = location; if (positionMarker != null) { positionMarker.Remove(); } var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(location.Latitude, location.Longitude)); circleOptions.InvokeRadius(20); circleOptions.InvokeFillColor(0X66FF0000); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(0); //positionMarker = mMap.AddCircle(circleOptions); } }
public void updateCircle() { CustomMap customMap = (CustomMap)this.Element; if (customMap != null) { if (customMap.UserPin != null) { if (circle != null) { circle.Remove(); circle.Dispose(); } //moy CircleOptions circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(customMap.UserPin.Position.Latitude, customMap.UserPin.Position.Longitude)); circleOptions.InvokeRadius(customMap.getDistanceUserTarget()); circleOptions.InvokeFillColor(Android.Graphics.Color.Argb(0, 0, 0, 0)); circleOptions.InvokeStrokeColor(Android.Graphics.Color.Argb(240, 250, 250, 250)); circleOptions.InvokeStrokeWidth(5f); circle = map.AddCircle(circleOptions); } } }
protected override MarkerOptions CreateMarker(Pin pin) { if (pin is CirclePin) { //create an overlay circle, and add to map var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(pin.Position.Latitude, pin.Position.Longitude)); circleOptions.InvokeRadius(PublishedData.PinOverlayRadius); circleOptions.InvokeFillColor(0X66FF0000); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(0); Circle circle = NativeMap.AddCircle(circleOptions); (pin as CirclePin).Overlay = circle; } // marker,or pin. var marker = new MarkerOptions(); marker.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude)); marker.Anchor(0.5f, 0.5f);// set anchor to to middle of icon marker.SetTitle(pin.Label); marker.SetSnippet(pin.Address); Bitmap imageBitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.pin); Bitmap resizedIcon = Bitmap.CreateScaledBitmap(imageBitmap, 50, 50, false); marker.SetIcon(BitmapDescriptorFactory.FromBitmap(resizedIcon)); return(marker); }
// TODO: Step 4c - handle info popup tap private void HandleInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e) { // Draw a circle on the map var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(Location_NewYork); circleOptions.InvokeRadius(100000.0); circleOptions.InvokeFillColor(Android.Graphics.Color.Argb(150, 59, 153, 212)); circleOptions.InvokeStrokeColor(Android.Graphics.Color.Rgb(159, 153, 212)); circleOptions.InvokeStrokeWidth(2); _map.AddCircle(circleOptions); // Draw a polygon (Wyoming) on the map var polygonOptions = new PolygonOptions(); polygonOptions.Add(new LatLng[] { new LatLng(45.00, -111.00), new LatLng(45, -104), new LatLng(41, -104), new LatLng(41, -111) }); polygonOptions.InvokeFillColor(Android.Graphics.Color.Argb(150, 21, 48, 78)); polygonOptions.InvokeStrokeColor(Android.Graphics.Color.Rgb(21, 48, 78)); polygonOptions.InvokeStrokeWidth(2); _map.AddPolygon(polygonOptions); }
private void CircleDemo(HuaweiMap hMap) { hMap.Clear(); Circle circle1; LatLng circle1LatLng = new LatLng(41.01019, 28.974475); CircleOptions circle1Options = new CircleOptions(); circle1Options.InvokeCenter(circle1LatLng); circle1Options.InvokeRadius(1600); circle1Options.InvokeStrokeWidth(5); circle1Options.InvokeStrokeColor(Color.Blue); circle1Options.InvokeFillColor(Color.Argb(60, 0, 0, 255)); circle1Options.Clickable(true); circle1Options.InvokeZIndex(2); circle1 = hMap.AddCircle(circle1Options); Circle circle2; LatLng circle2LatLng = new LatLng(41.01563, 29.052667); CircleOptions circle2Options = new CircleOptions(); circle2Options.InvokeCenter(circle2LatLng); circle2Options.InvokeRadius(5000); circle2Options.InvokeStrokeWidth(10); circle2Options.InvokeStrokeColor(Color.OrangeRed); circle2Options.InvokeFillColor(Color.Argb(60, 255, 200, 0)); circle2Options.Clickable(true); circle2Options.InvokeZIndex(1); circle2 = hMap.AddCircle(circle2Options); }
void AddCircles(IList circles) { var map = NativeMap; if (map == null) { return; } if (_circles == null) { _circles = new List <ACircle>(); } _circles.AddRange(circles.Cast <Circle>().Select(circle => { var opts = new CircleOptions(); opts.InvokeCenter(new LatLng(circle.Center.Latitude, circle.Center.Longitude)); opts.InvokeRadius(circle.Radius.Meters); opts.InvokeStrokeWidth(circle.StrokeWidth * _scaledDensity); // TODO: convert from px to pt. Is this collect? (looks like same iOS Maps) opts.InvokeStrokeColor(circle.StrokeColor.ToAndroid()); opts.InvokeFillColor(circle.FillColor.ToAndroid()); //opts.Clickable(circle.IsClickable); var nativeCircle = map.AddCircle(opts); // associate pin with marker for later lookup in event handlers circle.Id = nativeCircle; return(nativeCircle); })); }
public void UpdateRegionMap() { try { if (selectedTrap != null) { if (circle != null) { circle.Remove(); } LatLng position = new LatLng(lastLocation.Latitude, lastLocation.Longitude); int fillColor = int.Parse("80f15f4b", System.Globalization.NumberStyles.HexNumber); CircleOptions circleOptions = new CircleOptions(); circleOptions.InvokeCenter(position); //circleOptions.InvokeRadius(selectedTrap.Trap.Meters); circleOptions.InvokeFillColor(fillColor); circleOptions.InvokeStrokeWidth(3); circle = googleMap.AddCircle(circleOptions); } } catch (Exception exception) { InsightsUtils.LogException(exception); } }
protected override void OnMapReady(GoogleMap map) { base.OnMapReady(map); var polylineOptions = new PolylineOptions(); polylineOptions.InvokeColor(0x702418ff); foreach (var position in routeCoordinates) { polylineOptions.Add(new LatLng(position.Latitude, position.Longitude)); } NativeMap.AddPolyline(polylineOptions); foreach (Bus bus in BusList.busList) { if (bus.route == "blue") { CircleOptions circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(bus.lat, bus.lng)); circleOptions.InvokeRadius(30); circleOptions.InvokeFillColor(0X700000ff); circleOptions.InvokeStrokeColor(0X70FFFFFF); circleOptions.InvokeStrokeWidth(5); NativeMap.AddCircle(circleOptions); } } }
public void OnMapReady(GoogleMap googleMap) { map = googleMap; if (!isCircle) { var polylineOptions = new PolylineOptions(); polylineOptions.InvokeColor(0x66FF0000); foreach (var position in routeCoordinates) { polylineOptions.Add(new LatLng(position.Latitude, position.Longitude)); } map.AddPolyline(polylineOptions); } if (isCircle) { var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude)); circleOptions.InvokeRadius(circle.Radius); circleOptions.InvokeFillColor(0X00FFFFFF); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(3); map.AddCircle(circleOptions); } }
private void drawCircle() { Circle circle; LatLng circleLatLng = new LatLng(40.985996056, 29.035333192); CircleOptions circleOptions = new CircleOptions(); circle = hMap.AddCircle(circleOptions); circleOptions.InvokeCenter(circleLatLng); circleOptions.InvokeRadius(1800); circleOptions.InvokeStrokeWidth(5); circleOptions.InvokeStrokeColor(Color.Blue); circleOptions.InvokeStrokeWidth(30); circleOptions.Clickable(true); circleOptions.InvokeZIndex(2); circle = hMap.AddCircle(circleOptions); circleOptions.Clickable(true); hMap.CircleClick += OnCircleClick; }
private void DrawCircle() { CircleOptions circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(30.679879, 104.064855)); circleOptions.InvokeRadius(9000); circleOptions.InvokeStrokeColor(Color.Black); circleOptions.InvokeFillColor(Color.Transparent); circleOptions.InvokeStrokeWidth(3); aMap.AddCircle(circleOptions); }
void Android.Gms.Location.ILocationListener.OnLocationChanged(Location location) { double lat, lng; lat = location.Latitude; lng = location.Longitude; TextView search_txt = FindViewById <TextView>(Resource.Id.search_txt); mCurrentLocation = location; UpdateUI(); mMap.Clear(); LatLng mGoogleApiClient = new LatLng(lat, lng); CameraPosition.Builder builder = CameraPosition.InvokeBuilder(); builder.Target(mGoogleApiClient); builder.Zoom(14); CameraPosition cameraPosition = builder.Build(); CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition); if (mMap != null) { mMap.AnimateCamera(CameraUpdateFactory.NewCameraPosition(cameraPosition)); } Log.Debug(GetType().FullName, "OnLocationChanged = - Adresse" + " " + search_txt.Text + " " + lat + " " + lng); CircleOptions circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(lat, lng)); circleOptions.InvokeRadius(200); // RAYON DU CERCLE circleOptions.InvokeStrokeWidth(4); // EPAISSEUR DU TRIT DU CERCLE circleOptions.InvokeStrokeColor(Android.Graphics.Color.ParseColor("#75C043")); // Cercle Couleur Circle newCircle = mMap.AddCircle(circleOptions); newCircle.Visible = true; string URL_GetTaxis = "GetTaxis"; Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("lat", lat.ToString().Replace(',', '.')); parameters.Add("longi", lng.ToString().Replace(',', '.')); var JsonRetour = taxisController.POST(URL_GetTaxis, parameters); var retour = JsonConvert.DeserializeObject <ReturnData>(JsonRetour); for (int i = 0; i < retour.Data.taxiData.Length; i++) { var marker = new MarkerOptions() .SetPosition(new LatLng((double)retour.Data.taxiData[i].Position.Lat, (double)retour.Data.taxiData[i].Position.Lon)) .Anchor(0.5f, 0.5f) .SetIcon(BitmapDescriptorFactory.FromResource(Resource.Mipmap.marker_taxi)) .SetTitle(search_txt.Text); mMap.AddMarker(marker); } }
public void OnMapLoaded(GoogleMap googleMap) { var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(this.circle.Position.Latitude, this.circle.Position.Longitude)); circleOptions.InvokeRadius(this.circle.Radius); //circleOptions.InvokeFillColor(0X66FF0000); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(3); map.AddCircle(circleOptions); }
public void OnMapReady(GoogleMap googleMap) { map = googleMap; var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude)); circleOptions.InvokeRadius(circle.Radius); circleOptions.InvokeFillColor(0X66FF0000); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(0); map.AddCircle(circleOptions); }
private void DrawBlueDot() { CircleOptions circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(currentLocation.Latitude, currentLocation.Longitude)); circleOptions.InvokeRadius(5); circleOptions.InvokeFillColor(Color.CadetBlue); circleOptions.InvokeStrokeColor(Color.White); circleOptions.InvokeStrokeWidth(2); circleOptions.InvokeZIndex(1); blueDot = _map.AddCircle(circleOptions); }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SearchJourney); #region setup map markers currentLocation = new MarkerOptions(); currentLocation.SetTitle("Current Position"); currentLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue)); currentLocation.SetPosition(getCurrentPosition()); currentLocation.Visible(false); fromLocation = new MarkerOptions(); fromLocation.SetTitle("From Here"); fromLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed)); fromLocation.SetPosition(getCurrentPosition()); fromLocation.Visible(false); toLocation = new MarkerOptions(); toLocation.SetTitle("To Here"); toLocation.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen)); toLocation.SetPosition(getCurrentPosition()); toLocation.Visible(false); fromCircleOp = new CircleOptions(); fromCircleOp.InvokeCenter(getCurrentPosition()); fromCircleOp.InvokeRadius(1000); fromCircleOp.InvokeFillColor(0X66FF0000); fromCircleOp.InvokeStrokeColor(0X66FF0000); fromCircleOp.InvokeStrokeWidth(0); fromCircleOp.Visible(false); toCircleOp = new CircleOptions(); toCircleOp.InvokeCenter(getCurrentPosition()); toCircleOp.InvokeRadius(1000); toCircleOp.InvokeFillColor(Color.Green); toCircleOp.InvokeStrokeColor(Color.Green); toCircleOp.InvokeStrokeWidth(0); toCircleOp.Visible(false); #endregion // Create your application here InitMapFragment(); SetupCurrentLocationButton(); SetupSearchButton(); SetupSetFromButton(); SetupSetToButton(); SetupForm(); }
protected override void OnMapReady(Android.Gms.Maps.GoogleMap map) { base.OnMapReady(map); var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude)); circleOptions.InvokeRadius(circle.Radius); circleOptions.InvokeFillColor(0X66FF0000); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(0); NativeMap.AddCircle(circleOptions); }
private void AddClusterItems(GoogleMap map, HelperHomeModel h) { var items = new List <MyItem>(); // Add current location to the cluster list var currentMarker = new MarkerOptions(); var me = new LatLng(h.Latitude, h.Longitude); currentMarker.SetPosition(me); var meMarker = new CircleOptions(); meMarker.InvokeCenter(me); meMarker.InvokeRadius(32); meMarker.InvokeStrokeWidth(10); meMarker.InvokeFillColor(ContextCompat.GetColor(Context, Android.Resource.Color.HoloRedLight)); map.AddCircle(meMarker); items.Add(new MyItem(h.Latitude, h.Longitude)); // Create a log. spiral of markers to test clustering for (int i = 1; i < customMap.helperList.Count; i++) { var hi = customMap.helperList.ElementAt(i); var t = i * Math.Pi * 0.33f; var r = 0.005 * Math.Exp(0.1 * t); var x = r * Math.Cos(t); var y = r * Math.Sin(t); items.Add(new MyItem(hi.Latitude + x, hi.Longitude + y)); } mClusterManager.AddItems(items); /*****************************************************************/ // Set some lat/lng coordinates to start with. /*double lat = 51.5145160; * double lng = -0.1270060; * * // Add ten cluster items in close proximity, for purposes of this example. * for (int i = 1; i < customMap.helperList.Count; i++) * { * * var h = customMap.helperList.ElementAt(i); * double offset = i / 60d; * lat = h.Latitude + offset; * lng = h.Longitude + offset; * MyItem offsetItem = new MyItem(lat, lng); * mClusterManager.AddItem(offsetItem); * * }*/ }
/// <summary> /// Adds a bubble that reflects the expiry range of a helicopter carrying organ /// </summary> /// <param name="heliPin"></param> private void addOrganRange(CustomPin heliPin) { var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(heliPin.Position.Latitude, heliPin.Position.Longitude)); // TODO adjust to organ countdown circleOptions.InvokeRadius(40000); circleOptions.InvokeFillColor(0X660000FF); circleOptions.InvokeStrokeColor(0X660000FF); circleOptions.InvokeStrokeWidth(0); highlightedOrganRange = new Tuple <CustomPin, Circle>(heliPin, NativeMap.AddCircle(circleOptions)); }
public void CreateCircle(Circle circle) { if (circle == null) { return; } var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude)); circleOptions.InvokeRadius(circle.Radius); circleOptions.InvokeFillColor(0X00FFFFFF); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(3); map.AddCircle(circleOptions); }
public void DrawCircle(GoogleMap gMap) { Circle circle; var CircleMaker = new CircleOptions(); var latlong = new LatLng(13.0291, 80.2083); //Location CircleMaker.InvokeCenter(latlong); // CircleMaker.InvokeRadius(1000); //Radius in Circle CircleMaker.InvokeStrokeWidth(4); CircleMaker.InvokeStrokeColor(Android.Graphics.Color.ParseColor("#e6d9534f")); //Circle Color CircleMaker.InvokeFillColor(Color.Argb(034, 209, 72, 54)); CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(latlong, 15); //Map Zoom Level circle = GMap.AddCircle(CircleMaker); //Gmap Add Circle }
/// <summary> /// Minulí pozice zůstávají na mapě /// </summary> private void DrawDebugPosition() { if (debugPositionCircle != null) { debugPositionCircle.Dispose(); } debugPositionCircle = new CircleOptions(); debugPositionCircle.InvokeCenter(new LatLng(customMap.DebugPosition.Latitude, customMap.DebugPosition.Longitude)); debugPositionCircle.InvokeRadius(50); debugPositionCircle.InvokeFillColor(0X66FF0000); debugPositionCircle.InvokeStrokeColor(0X66FF0000); debugPositionCircle.InvokeStrokeWidth(0); NativeMap.AddCircle(debugPositionCircle); }
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName.Equals("VisibleRegion") && !isDrawn) { var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(circle.Position.Latitude, circle.Position.Longitude)); circleOptions.InvokeRadius(circle.Radius); circleOptions.InvokeFillColor(0X66FF0000); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(0); NativeMap.AddCircle(circleOptions); isDrawn = true; } }
protected override NativeCircle CreateNativeItem(Circle outerItem) { var opts = new CircleOptions(); opts.InvokeCenter(new LatLng(outerItem.Center.Latitude, outerItem.Center.Longitude)); opts.InvokeRadius(outerItem.Radius.Meters); opts.InvokeStrokeWidth(outerItem.StrokeWidth * this.ScaledDensity); // TODO: convert from px to pt. Is this collect? (looks like same iOS Maps) opts.InvokeStrokeColor(outerItem.StrokeColor.ToAndroid()); opts.InvokeFillColor(outerItem.FillColor.ToAndroid()); opts.Clickable(outerItem.IsClickable); var nativeCircle = NativeMap.AddCircle(opts); // associate pin with marker for later lookup in event handlers outerItem.NativeObject = nativeCircle; return(nativeCircle); }
private void UpdateCircles() { circles?.ForEach(x => x.Remove()); circles = new List <Circle>(); customPins?.ForEach(x => { var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(x.Position.Latitude, x.Position.Longitude)); circleOptions.InvokeRadius(x.Radius); circleOptions.InvokeFillColor(0X66FF0000); circleOptions.InvokeStrokeColor(0X66FF0000); circleOptions.InvokeStrokeWidth(0); circles.Add(NativeMap.AddCircle(circleOptions)); }); }
/// <summary> /// When the user stops. /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">User's position</param> private void Model_UserStopped(object sender, PositionArgs e) { var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(e.LocationData.Latitude, e.LocationData.Longitude)); circleOptions.InvokeRadius(14); circleOptions.InvokeFillColor(Color.Rgb(213, 52, 58)); circleOptions.InvokeStrokeColor(Color.Black); circleOptions.InvokeStrokeWidth(1); circleOptions.InvokeZIndex(10); RunOnUiThread(() => { _map.AddCircle(circleOptions); _speedTextView.Text = "0"; }); }
protected override MarkerOptions CreateMarker(Pin pin) { CustomPin customPin = (CustomPin)pin; var marker = new MarkerOptions(); marker.SetPosition(new LatLng(pin.Position.Latitude, pin.Position.Longitude)); marker.SetAlpha(0); var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(new LatLng(customPin.Position.Latitude, customPin.Position.Longitude)); circleOptions.InvokeRadius(1000); circleOptions.InvokeStrokeWidth(0); switch (customPin.Status) { case StatusEnum.Diagnosed: circleOptions.InvokeFillColor(0X66FF0000); circleOptions.InvokeStrokeColor(0X66FF0000); NativeMap.AddCircle(circleOptions); break; case StatusEnum.Healthy: break; case StatusEnum.Recovered: break; case StatusEnum.Symptomatic: circleOptions.InvokeFillColor(0X33FF4D26); circleOptions.InvokeStrokeColor(0X33FF4D26); NativeMap.AddCircle(circleOptions); break; default: break; } /* circleOptions.InvokeFillColor(0X66FF0000); * circleOptions.InvokeStrokeColor(0X66FF0000);*/ return(marker); }
private void LoadMapExplosion() { var idIcon = 0; if (trapNameKey == ETrap.BEAR.ToString()) { idIcon = MyTrap.Droid.Resource.Drawable.trap_bear_trap_selected_icon; } else if (trapNameKey == ETrap.MINE.ToString()) { idIcon = MyTrap.Droid.Resource.Drawable.trap_mine_trap_selected_icon; } else if (trapNameKey == ETrap.PIT.ToString()) { idIcon = MyTrap.Droid.Resource.Drawable.trap_pit_trap_selected_icon; } else if (trapNameKey == ETrap.DOGS.ToString()) { idIcon = MyTrap.Droid.Resource.Drawable.trap_dogs_trap_selected_icon; } else { return; } var position = new LatLng(latitude, longitude); googleMap.AddMarker(new MarkerOptions() .SetPosition(position) .SetTitle(date.ToString(Resources.GetString(MyTrap.Droid.Resource.String.format_date_hour_minute))) .SetIcon(BitmapDescriptorFactory.FromResource(idIcon)) ); int fillColor = int.Parse("80f15f4b", System.Globalization.NumberStyles.HexNumber); CircleOptions circleOptions = new CircleOptions(); circleOptions.InvokeCenter(position); circleOptions.InvokeFillColor(fillColor); circleOptions.InvokeStrokeWidth(3); googleMap.AddCircle(circleOptions); googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(latitude, longitude), 16)); }
/// <summary> /// Delete the previous user circle and draw the new one /// </summary> /// <param name="position">User's new position</param> private void DrawUser(LatLng position) { var circleOptions = new CircleOptions(); circleOptions.InvokeCenter(position); circleOptions.InvokeRadius(9); circleOptions.InvokeFillColor(Color.Rgb(69, 140, 228)); circleOptions.InvokeStrokeColor(Color.White); circleOptions.InvokeStrokeWidth(2); circleOptions.InvokeZIndex(11); RunOnUiThread(() => { var newUserPosition = _map.AddCircle(circleOptions); _userPosition?.Remove(); _userPosition = newUserPosition; }); }