Ejemplo n.º 1
0
        public static CKCluster ClusterWithCoordinate(CLLocationCoordinate2D coordinate)
        {
            var cluster = new CKCluster();

            cluster.SetCoordinate(coordinate);
            return(cluster);
        }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        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));
            }
        }
Ejemplo n.º 6
0
 public static void DeselectCluster(this MKMapView map, CKCluster cluster, bool animated)
 {
     map.DeselectAnnotation(cluster, animated);
 }
Ejemplo n.º 7
0
 public static void RemoveCluster(this MKMapView map, CKCluster cluster)
 {
     map.RemoveAnnotation(cluster);
 }
Ejemplo n.º 8
0
 public static void AddCluster(this MKMapView map, CKCluster cluster)
 {
     map.AddAnnotation(cluster);
 }
Ejemplo n.º 9
0
 public static void ShowCluster(this MKMapView map, CKCluster cluster, bool animated)
 {
     ShowCluster(map, cluster, UIEdgeInsets.Zero, animated);
 }