void _mapView_RegionWillChange(object sender, MKMapViewChangeEventArgs e) { if (_imageView != null) { UIView.Animate(0.2, () => _imageView.Alpha = 0, () => _imageView.Hidden = true); } }
private void CustomDelegate_OnRegionChanged(object sender, MKMapViewChangeEventArgs e) { var lat = map.Region.Center.Latitude; var lon = map.Region.Center.Longitude; CoreGraphics.CGPoint location = new CoreGraphics.CGPoint(lat, lon); //var coord = map.ConvertPoint(location, map); map.AddAnnotation(annotation); map.ReloadInputViews(); }
private void NativeMap_RegionChanged(object sender, MKMapViewChangeEventArgs e) { // This if (_xamarinMap.OnRegionChanged != null) { _xamarinMap.OnRegionChanged(); } // or this MessagingCenter.Send <object>(this, "RegionChanged"); }
void MapView_RegionChanged(object sender, MKMapViewChangeEventArgs e) { var mapView = (MKMapView)sender; _geocoder.ReverseGeocodeLocation(new CLLocation(mapView.CenterCoordinate.Latitude, mapView.CenterCoordinate.Longitude), (placemarks, error) => { if(placemarks.Any()) { var address = ABAddressFormatting.ToString(placemarks[0].AddressDictionary, addCountryName: false); _addressChanged.Invoke(address); } }); }
void MkMapViewOnRegionChanged(object sender, MKMapViewChangeEventArgs e) { if (Element == null) { return; } var mapModel = (Map)Element; var mkMapView = (MKMapView)Control; mapModel.SetVisibleRegion(new MapSpan(new Position(mkMapView.Region.Center.Latitude, mkMapView.Region.Center.Longitude), mkMapView.Region.Span.LatitudeDelta, mkMapView.Region.Span.LongitudeDelta)); }
private void MapViewOnRegionChanged(object sender, MKMapViewChangeEventArgs mkMapViewChangeEventArgs) { Console.WriteLine(GetZoomLevel()); if (GetZoomLevel() > 17.3f) { Control.SetRegion(backupRegion, true); } else { backupRegion = Control.Region; } }
void MapView_RegionChanged(object sender, MKMapViewChangeEventArgs e) { var mapView = (MKMapView)sender; _geocoder.ReverseGeocodeLocation(new CLLocation(mapView.CenterCoordinate.Latitude, mapView.CenterCoordinate.Longitude), (placemarks, error) => { if (placemarks.Any()) { var address = ABAddressFormatting.ToString(placemarks[0].AddressDictionary, addCountryName: false); _addressChanged.Invoke(address); } }); }
void MapRegionChanged(object sender, MKMapViewChangeEventArgs e) { var current = new Dictionary <string, AirportAnnotation> (); var added = new List <AirportAnnotation> (); // Query for the list of airports in the new region foreach (var airport in GetAirports(mapView.Region)) { AirportAnnotation annotation; if (annotations.ContainsKey(airport.FAA)) { // This airport is already in view... annotation = annotations[airport.FAA]; annotation.UserCoordinates = coordinates; annotations.Remove(airport.FAA); } else { // This is a new annotation, keep track of it in 'added' annotation = new AirportAnnotation(airport, coordinates); added.Add(annotation); } current.Add(annotation.Airport.FAA, annotation); } if (annotations.Count > 0) { // Remove annotations that are no longer in view mapView.RemoveAnnotations(annotations.Values.ToArray()); foreach (var annotation in annotations.Values) { annotation.Dispose(); } annotations.Clear(); } if (added.Count > 0) { mapView.AddAnnotations(added.ToArray()); foreach (var annotation in added) { annotation.Dispose(); } } annotations = current; }
private void OnRegionChanged(object sender, MKMapViewChangeEventArgs e) { if (!_changingCenter) { _changingCenter = true; try { _owner.Center = _internalMapView.Region.Center.ToGeopoint(); UpdateZoomLevel(); } finally { _changingCenter = false; } } }
void OnMapRegionChanged(object sender, MKMapViewChangeEventArgs e) { if (!customMap.OnSelect && !customMap.OnSearch) { s = sender as MKMapView; mapDraggedTime = DateTime.Now; CanFetch = false; //var startTime = DateTime.Now.Add(TimeSpan.FromSeconds(2)); //Device.StartTimer(TimeSpan.FromSeconds(5), () => { // return true; //}); } if (!customMap.OnSelect) { customMap.hideInfoView(); } }
private async void MapView_RegionChanged(object sender, MKMapViewChangeEventArgs e) { if (Element == null) { return; } _mapView.ZoomEnabled = true; _mapView.ScrollEnabled = true; _mapView.RegionChanged -= MapView_RegionChanged; var center = _mapView.Region.Center; //This solves the problem of MKMAPVIEW to Reset its view to FirstLocation _customMap.MoveToRegion(new MapSpan(new Position(center.Latitude, center.Longitude), _mapView.Region.Span.LatitudeDelta, _mapView.Region.Span.LongitudeDelta)); _mapView.RegionChanged += MapView_RegionChanged; if (_customMap.OnVisibleRegionChanged != null) { var halfheightDegrees = _mapView.Region.Span.LatitudeDelta / 2; var halfwidthDegrees = _mapView.Region.Span.LongitudeDelta / 2; var left = Math.Round(center.Longitude - halfwidthDegrees, 2); var right = Math.Round(center.Longitude + halfwidthDegrees, 2); var top = Math.Round(center.Latitude + halfheightDegrees, 2); var bottom = Math.Round(center.Latitude - halfheightDegrees, 2); if (left < -180) { left = 180 + (180 + left); } if (right > 180) { right = (right - 180) - 180; } var topLeft = top.ToString() + "," + left.ToString(); var bottomRight = bottom.ToString() + "," + right.ToString(); await _customMap.OnVisibleRegionChanged(bottomRight, topLeft); } }
void MapRegionChanged(object sender, MKMapViewChangeEventArgs e) { Dictionary <string, AirportAnnotation> current = new Dictionary <string, AirportAnnotation> (); List <AirportAnnotation> added = new List <AirportAnnotation> (); // Query for the list of airports in the new region foreach (var airport in Airports.GetAirports(mapView.Region)) { AirportAnnotation aa; if (annotations.ContainsKey(airport.FAA)) { // This airport is already in view... aa = annotations[airport.FAA]; annotations.Remove(airport.FAA); } else { // This is a new annotation, keep track of it in 'added' aa = new AirportAnnotation(airport); added.Add(aa); } current.Add(aa.Airport.FAA, aa); } if (annotations.Count > 0) { // Remove annotations that are no longer in view mapView.RemoveAnnotations(annotations.Values.ToArray()); annotations.Clear(); } if (added.Count > 0) { mapView.AddAnnotation(added.ToArray()); added.Clear(); } annotations = current; }
private void MapViewOnRegionChanged(Object sender, MKMapViewChangeEventArgs e) { CenterLocation = map.Region.Center; //var latitude = CenterLocation.Latitude; //var longitude = CenterLocation.Longitude; //Console.WriteLine(String.Format("{0}, {1}", latitude, longitude)); Double scale = map.Bounds.Size.Width / map.VisibleMapRect.Size.Width; List <IMKAnnotation> annotationsToDisplay = AnnotationsClusteringManager.ClusteredAnnotationsWithinMapRect(map.VisibleMapRect, scale); AnnotationsClusteringManager.DisplayAnnotations(annotationsToDisplay, map); DocumentList = DocumentList.OrderBy(doc => doc.GetDistance(CenterLocation.Latitude, CenterLocation.Longitude)).ToList(); source.UpdateData(DocumentList); CollectionView.ReloadData(); }
async void MyMap_RegionChanged(object sender, MKMapViewChangeEventArgs e) { string tempData = await _weatherApi.GetWeather(MyMap.CenterCoordinate.Latitude, MyMap.CenterCoordinate.Latitude); Description.Text = tempData; }
/// <summary> /// Cambio region mapa. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Mapa_RegionChanged(object sender, MKMapViewChangeEventArgs e) { // Actualizo tarea controller.t.Cliente.Direccion.Coords = new Coordenadas(mapa.CenterCoordinate.Latitude, mapa.CenterCoordinate.Longitude); }
void MkMapViewOnRegionChanged(object sender, MKMapViewChangeEventArgs mkMapViewChangeEventArgs) { if (Element == null) return; var mapModel = (Map)Element; var mkMapView = (MKMapView)Control; mapModel.VisibleRegion = new MapSpan(new Position(mkMapView.Region.Center.Latitude, mkMapView.Region.Center.Longitude), mkMapView.Region.Span.LatitudeDelta, mkMapView.Region.Span.LongitudeDelta); }
void MapRegionChanged(object sender, MKMapViewChangeEventArgs e) { Dictionary<string, AirportAnnotation> current = new Dictionary<string, AirportAnnotation> (); List<AirportAnnotation> added = new List<AirportAnnotation> (); // Query for the list of airports in the new region foreach (var airport in Airports.GetAirports (mapView.Region)) { AirportAnnotation aa; if (annotations.ContainsKey (airport.FAA)) { // This airport is already in view... aa = annotations[airport.FAA]; annotations.Remove (airport.FAA); } else { // This is a new annotation, keep track of it in 'added' aa = new AirportAnnotation (airport); added.Add (aa); } current.Add (aa.Airport.FAA, aa); } if (annotations.Count > 0) { // Remove annotations that are no longer in view mapView.RemoveAnnotations (annotations.Values.ToArray ()); annotations.Clear (); } if (added.Count > 0) { mapView.AddAnnotation (added.ToArray ()); added.Clear (); } annotations = current; }
void MapRegionChanged(object sender, MKMapViewChangeEventArgs e) { var current = new Dictionary<string, AirportAnnotation> (); var added = new List<AirportAnnotation> (); // Query for the list of airports in the new region foreach (var airport in GetAirports (mapView.Region)) { AirportAnnotation annotation; if (annotations.ContainsKey (airport.FAA)) { // This airport is already in view... annotation = annotations[airport.FAA]; annotation.UserCoordinates = coordinates; annotations.Remove (airport.FAA); } else { // This is a new annotation, keep track of it in 'added' annotation = new AirportAnnotation (airport, coordinates); added.Add (annotation); } current.Add (annotation.Airport.FAA, annotation); } if (annotations.Count > 0) { // Remove annotations that are no longer in view mapView.RemoveAnnotations (annotations.Values.ToArray ()); foreach (var annotation in annotations.Values) annotation.Dispose (); annotations.Clear (); } if (added.Count > 0) { mapView.AddAnnotations (added.ToArray ()); foreach (var annotation in added) annotation.Dispose (); } annotations = current; }
private void OnMapRegionChanged(object sender, MKMapViewChangeEventArgs e) { Render(); }
/// <summary> /// When the camera region changed /// </summary> /// <param name="sender">Event sender</param> /// <param name="e">Event Arguments</param> private void OnMapRegionChanged(object sender, MKMapViewChangeEventArgs e) { this.FormsMap.MapCenter = this.Map.CenterCoordinate.ToPosition(); }
void _mapView_RegionChanged(object sender, MKMapViewChangeEventArgs e) { UpdateHeatMap(); }