Esempio n. 1
0
        internal void GetMvxBindingMarker(Marker marker, IBindingMapAnnotation annotation)
        {
            MvxBindingMarker result = GetMvxBindingMarker();

            result.Marker      = marker;
            result.DataContext = annotation;
        }
Esempio n. 2
0
            public MarkerOptions GetMarkerOptionsForPin(IBindingMapAnnotation pin)
            {
                MarkerOptions markerOptions = null;

                if (pin is ExampleBindingAnnotation mPin)
                {
                    markerOptions = new MarkerOptions();
                    markerOptions.SetPosition(new LatLng(pin.Location.Latitude, pin.Location.Longitude))
                    .SetTitle(mPin.Id.ToString())
                    .Draggable(true);
                    switch (mPin.Id)
                    {
                    case 1:
                        markerOptions.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue));
                        break;

                    case 2:
                        markerOptions.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed));
                        break;

                    case 3:
                        markerOptions.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen));
                        break;

                    case 4:
                        markerOptions.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow));
                        break;

                    case 5:
                        markerOptions.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueViolet));
                        break;
                    }
                }
                return(markerOptions);
            }
Esempio n. 3
0
            public override MarkerOptions GetMarkerOptionsForPin(IBindingMapAnnotation pin)
            {
                MarkerOptions markerOptions = null;

                if (pin is ExampleBindingAnnotation mPin)
                {
                    markerOptions = new MarkerOptions();
                    markerOptions.SetPosition(new LatLng(pin.Location.Latitude, pin.Location.Longitude))
                    .SetTitle(mPin.Id.ToString())
                    .SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.sphere));
                }
                return(markerOptions);
            }
Esempio n. 4
0
 public override void AddAnnotation(IBindingMapAnnotation annotation)
 {
     if (annotation is IBindingMapAnnotation mMarker)
     {
         using (MarkerOptions markerOptions = GetMarkerOptionsForPin(annotation))
             if (markerOptions != null)
             {
                 MvxBindingMarker result = GetMvxBindingMarker();
                 result.DataContext = annotation;
                 markerOptions.SetIcon(result.GetIcon());
                 Marker marker = MapView.GoogleMap.AddMarker(markerOptions);
                 result.Marker = marker;
                 marker.Tag    = new AnnotationTag
                 {
                     Annotation = annotation
                 };
                 if (_markers == null)
                 {
                     _markers = new List <Marker>();
                 }
                 _markers.Add(marker);
             }
     }
 }
Esempio n. 5
0
 public virtual MKAnnotationView GetViewForBindingAnnotation(MKMapView mapView, IBindingMapAnnotation bindingMapAnnotation)
 => null;
Esempio n. 6
0
            public override MKAnnotationView GetViewForBindingAnnotation(MKMapView mapView, IBindingMapAnnotation bindingMapAnnotation)
            {
                if (bindingMapAnnotation is ExampleBindingAnnotation eAnno)
                {
                    var view       = mapView.DequeueReusableAnnotation(eAnno.Id + "");
                    var annotation = new BindingMKAnnotation(bindingMapAnnotation);
                    annotation.SetTitle(eAnno.Id + "");
                    annotation.SetSubtitle(eAnno.Id + "");
                    if (view == null)
                    {
                        view = new MKAnnotationView(annotation, eAnno.Id + "");
                    }
                    else
                    {
                        view.Annotation = annotation;
                    }
                    view.Image = UIImage.FromBundle("Images/sphere");
                    return(view);
                }

                return(null);
            }
Esempio n. 7
0
 public override MarkerOptions GetMarkerOptionsForPin(IBindingMapAnnotation pin)
 {
     return(new MarkerOptions().SetPosition(pin.Location.ToLatLng()));
 }
Esempio n. 8
0
 public BindingMKAnnotation(IBindingMapAnnotation anno)
 {
     Annotation = anno;
     SetBindingCoordinate(anno.Location.ToCLLocationCoordinate2D());
 }
Esempio n. 9
0
 public abstract MarkerOptions GetMarkerOptionsForPin(IBindingMapAnnotation pin);
Esempio n. 10
0
 public override int?GetViewIdForInfoContent(IBindingMapAnnotation annotation)
 => Resource.Layout.item_info_window;
Esempio n. 11
0
 public virtual int?GetViewIdForInfoContent(IBindingMapAnnotation annotation)
 => null;
Esempio n. 12
0
 public BindingMKAnnotation(IBindingMapAnnotation anno)
 {
     Annotation = anno;
 }
            public override MKAnnotationView GetViewForBindingAnnotation(MKMapView mapView, IBindingMapAnnotation bindingMapAnnotation)
            {
                if (bindingMapAnnotation is ExampleBindingAnnotation eAnno)
                {
                    MKAnnotationView view = mapView.DequeueReusableAnnotation(eAnno.Id + "");
                    var annotation        = new BindingMKAnnotation(bindingMapAnnotation);
                    annotation.SetTitle(eAnno.Id + "");
                    annotation.SetSubtitle(eAnno.Id + "");
                    if (view == null)
                    {
                        view = new MKAnnotationView(annotation, eAnno.Id + "");
                    }
                    else
                    {
                        view.Annotation = annotation;
                    }

                    view.CanShowCallout = false;
                    view.Draggable      = true;
                    switch (eAnno.Id)
                    {
                    case 1:
                        view.Image = UIImage.FromBundle("Images/marker_a");
                        break;

                    case 2:
                        view.Image = UIImage.FromBundle("Images/marker_b");
                        break;

                    case 3:
                        view.Image = UIImage.FromBundle("Images/marker_c");
                        break;

                    case 4:
                        view.Image = UIImage.FromBundle("Images/marker_d");
                        break;

                    case 5:
                        view.Image = UIImage.FromBundle("Images/marker_e");
                        break;
                    }

                    return(view);
                }

                return(null);        //Lets the map default behavior take over if the annotation isnt a BindingMKAnnotation.
            }
Esempio n. 14
0
        public sealed override BindingMKCalloutView GetViewForCallout(MKMapView mapView, IBindingMapAnnotation bindingMapAnnotation)
        {
            var view = GetViewForCallout(mapView);

            if (view != null)
            {
                view.DataContext = bindingMapAnnotation;
            }
            return(view);
        }
Esempio n. 15
0
        public sealed override BindingMKAnnotationView GetViewForBindingAnnotation(MKMapView mapView, IBindingMapAnnotation bindingMapAnnotation)
        {
            var anno = GetViewForBindingAnnotation(mapView);

            anno.DataContext = bindingMapAnnotation;
            return(anno);
        }