Ejemplo n.º 1
0
            public override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
            {
                MKAnnotationView annotationView = null;

                if (annotation is MKUserLocation)
                {
                    return(null);
                }

                if (annotation is FoodMarkerAnnotation)
                {
                    AnnotationService service = new AnnotationService();
                    annotationView = service.GetAnnotationView(mapView, annotation);
                }
                else if (annotation is MKClusterAnnotation)
                {
                    AnnotationService service = new AnnotationService();
                    annotationView = service.GetClusterAnnotationView(mapView, annotation);
                }
                else if (annotation != null)
                {
                    var unwrappedAnnotation = MKAnnotationWrapperExtensions.UnwrapClusterAnnotation(annotation);

                    return(GetViewForAnnotation(mapView, unwrappedAnnotation));
                }

                return(annotationView);
            }
Ejemplo n.º 2
0
        private MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
        {
            if (annotation is RemarkableTree)
            {
                var marker = annotation as RemarkableTree;

                var view = mapView.DequeueReusableAnnotation(MKMapViewDefault.AnnotationViewReuseIdentifier) as RemarkableTreeView;
                if (view == null)
                {
                    view = new RemarkableTreeView(marker, MKMapViewDefault.AnnotationViewReuseIdentifier);
                }
                return(view);
            }
            else if (annotation is MKClusterAnnotation)
            {
                var cluster = annotation as MKClusterAnnotation;

                var view = mapView.DequeueReusableAnnotation(MKMapViewDefault.ClusterAnnotationViewReuseIdentifier) as ClusterView;
                if (view == null)
                {
                    view = new ClusterView(cluster, MKMapViewDefault.ClusterAnnotationViewReuseIdentifier);
                }
                return(view);
            }
            else if (annotation != null)
            {
                var unwrappedAnnotation = MKAnnotationWrapperExtensions.UnwrapClusterAnnotation(annotation);

                return(GetViewForAnnotation(mapView, unwrappedAnnotation));
            }
            return(null);
        }