public void OnCameraChange(CameraPosition cameraPos) { CenterLocation = cameraPos.Target; //Console.WriteLine("{0}, {1}", cameraPos.Target.Latitude, cameraPos.Target.Longitude); _clusterManager.OnCameraChange(cameraPos); DocumentList = DocumentList.OrderBy(doc => doc.GetDistance(CenterLocation.Latitude, CenterLocation.Longitude)).ToList(); customAdapter.UpdateData(DocumentList); customAdapter.NotifyDataSetChanged(); }
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(); }