public static CKCluster ClusterWithCoordinate(CLLocationCoordinate2D coordinate) { var cluster = new CKCluster(); cluster.SetCoordinate(coordinate); return(cluster); }
public void SetSelectedCluster(CKCluster selectedCluster, bool animated) { if (this.SelectedCluster != null && selectedCluster != this.SelectedCluster) { this.Clusters.Add(this.SelectedCluster); this.map.DeselectCluster(this.SelectedCluster, animated); } if (selectedCluster != null) { this.Clusters.Remove(selectedCluster); this.map.SelectCluster(selectedCluster, animated); } this.SelectedCluster = selectedCluster; }
public static void ShowCluster(this MKMapView map, CKCluster cluster, UIEdgeInsets insets, bool animated) { MKMapRect zoomRect = MKMapRect.Null; foreach (var annotation in cluster.Annotations) { var pointRect = new MKMapRect(); pointRect.Origin = MKMapPoint.FromCoordinate(annotation.Coordinate); pointRect.Size = new MKMapSize(0.1d, 0.1d); zoomRect = MKMapRect.Union(zoomRect, pointRect); } map.SetVisibleMapRect(zoomRect, insets, animated); }
public void SelectAnnotation(CKAnnotation annotation, bool animated, CKCluster cluster = null) { if (annotation != null) { if (annotation.Cluster == null || annotation.Cluster.Annotations.Count > 1) { cluster = this.Algorithm.ClusterWithCoordinate(annotation.Coordinate); cluster.AddAnnotation(annotation); this.map.AddCluster(cluster); } else { cluster = annotation.Cluster; } } this.SetSelectedCluster(cluster, animated); }
public static void MoveCluster(this MKMapView map, CKCluster cluster, CLLocationCoordinate2D from, CLLocationCoordinate2D to, UICompletionHandler completion) { cluster.SetCoordinate(from); if (GetClusterManager(map).Delegate != null) { GetClusterManager(map).Delegate.ClusterManager(GetClusterManager(map), () => { cluster.SetCoordinate(to); }, completion); } else { UIView.Animate(GetClusterManager(map).AnimationDuration, 0, GetClusterManager(map).AnimationOptions, () => { cluster.SetCoordinate(to); }, () => completion?.Invoke(true)); } }
public static void DeselectCluster(this MKMapView map, CKCluster cluster, bool animated) { map.DeselectAnnotation(cluster, animated); }
public static void RemoveCluster(this MKMapView map, CKCluster cluster) { map.RemoveAnnotation(cluster); }
public static void AddCluster(this MKMapView map, CKCluster cluster) { map.AddAnnotation(cluster); }
public static void ShowCluster(this MKMapView map, CKCluster cluster, bool animated) { ShowCluster(map, cluster, UIEdgeInsets.Zero, animated); }