private void DropGeofenceCircle(PointF point) { CLLocationCoordinate2D convertedPoint = this.mapView.ConvertPoint(point, this.mapView); String pinTitle = String.Format("Centre of geofence."); String subCoordinates = String.Format("{0},{1}", convertedPoint.Latitude.ToString(), convertedPoint.Longitude.ToString()); if (this.droppedPin != null) { this.mapView.RemoveAnnotation(this.droppedPin); } this.droppedPin = new SimpleAnnotation(convertedPoint, pinTitle, subCoordinates); this.mapView.AddAnnotation(droppedPin); if (this.GeofenceMapDelegate.Circle != null) { this.mapView.RemoveOverlay(this.GeofenceMapDelegate.Circle); } this.GeofenceMapDelegate.Circle = MKCircle.Circle(convertedPoint, this.GeofenceService.RadiusOfGeofenceInMeters); this.mapView.AddOverlay(this.GeofenceMapDelegate.Circle); if (!this.mapView.VisibleMapRect.Contains(this.GeofenceMapDelegate.Circle.BoundingMap)) { this.mapView.SetRegion(MKCoordinateRegion.FromMapRect(this.GeofenceMapDelegate.Circle.BoundingMap), true); } }
private void DropGeofenceCircle(PointF point) { CLLocationCoordinate2D convertedPoint = this.mapView.ConvertPoint(point, this.mapView); String pinTitle = String.Format("Centre of geofence."); String subCoordinates = String.Format("{0},{1}", convertedPoint.Latitude.ToString(), convertedPoint.Longitude.ToString()); if (this.droppedPin != null) { this.mapView.RemoveAnnotation(this.droppedPin); } this.droppedPin = new SimpleAnnotation(convertedPoint, pinTitle, subCoordinates); this.mapView.AddAnnotation(droppedPin); if (this.GeofenceMapDelegate.Circle != null) this.mapView.RemoveOverlay(this.GeofenceMapDelegate.Circle); this.GeofenceMapDelegate.Circle = MKCircle.Circle(convertedPoint, this.GeofenceService.RadiusOfGeofenceInMeters); this.mapView.AddOverlay(this.GeofenceMapDelegate.Circle); if (!this.mapView.VisibleMapRect.Contains(this.GeofenceMapDelegate.Circle.BoundingMap)) { this.mapView.SetRegion(MKCoordinateRegion.FromMapRect(this.GeofenceMapDelegate.Circle.BoundingMap), true); } }