public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay)
        {
            if (context is LocationActivity)
            {
                var lineOverlay = overlay as MKPolyline;

                try
                { //null exception error on lineOverlay, when stepping back from location history
                    var lineView = new MKPolylineView(lineOverlay);

                    string title = lineOverlay.GetTitle();

                    if (!(title is null))
                    {
                        string[] colors = title.Split("|");
                        int      red    = int.Parse(colors[0]);
                        int      green  = int.Parse(colors[1]);
                        int      blue   = int.Parse(colors[2]);


                        lineView.StrokeColor = UIColor.FromRGB(red, green, blue);
                        lineView.LineWidth   = 2f;
                    }
                    else
                    {
                        lineView.StrokeColor = UIColor.FromName("PrimaryDark");
                        lineView.LineWidth   = 3f;
                    }
                    return(lineView);
                }
            public override MKOverlayView GetViewForOverlay(MKMapView mapView, NSObject overlay)
            {
                MKOverlayView overlayView = null;

                if (overlay is MKPolygon)
                {
                    MKPolygon polygon     = overlay as MKPolygon;
                    var       polygonView = new MKPolygonView(polygon);
                    polygonView.FillColor = UIColor.Purple;
                    polygonView.Alpha     = 0.7f;
                    overlayView           = polygonView;
                }
                else if (overlay is MKCircle)
                {
                    MKCircle circle     = overlay as MKCircle;
                    var      circleView = new MKCircleView(circle);
                    circleView.FillColor = UIColor.Green;
                    overlayView          = circleView;
                }
                else if (overlay is MKPolyline)
                {
                    MKPolyline polyline     = overlay as MKPolyline;
                    var        polylineView = new MKPolylineView(polyline);
                    polylineView.StrokeColor = UIColor.Black;
                    overlayView = polylineView;
                }
                else if (overlay is CustomOverlay)
                {
                    CustomOverlay co = overlay as CustomOverlay;
                    var           v  = new CustomOverlayView(co);
                    overlayView = v;
                }

                return(overlayView);
            }
Beispiel #3
0
        public void InitWithFrame()
        {
            RectangleF frame = new RectangleF(10, 10, 100, 100);

            using (MKPolylineView pl = new MKPolylineView(frame)) {
                Assert.That(pl.Frame, Is.EqualTo(frame), "Frame");
            }
        }
        public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay)
        {
            MKPolyline polyline = overlay as MKPolyline;

            try
            {
                MKPolylineView polylineView = new MKPolylineView(polyline);

                polylineView.StrokeColor = UIColor.Black;
                polylineView.LineWidth   = 8;
                return(polylineView);
            }
            catch { return(null); }
        }
Beispiel #5
0
        internal MKPolylineView OnCreateView(MKPolyline polyline)
        {
            foreach (var p in _polylines)
            {
                if (p == polyline)
                {
                    var polylineView = new MKPolylineView(polyline);
                    polylineView.StrokeColor = _color;
                    return(polylineView);
                }
            }

            return(null);
        }
        public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay)
        {
            if (overlay.GetType() != typeof(MKPolyline))
            {
                return(null);
            }

            var pLineView = new MKPolylineView(overlay as MKPolyline)
            {
                LineWidth   = _lineWidth,
                StrokeColor = _colorStroke
            };

            return(pLineView);
        }
Beispiel #7
0
        public override MKOverlayView GetViewForOverlay(MKMapView mapView, NSObject overlay)
        {
            UIColor colorIdtoOrange = new UIColor((float)(250.0 / 255.0), (float)(175.0 / 255.0), (float)(64.0 / 255.0), 1.0f);
            UIColor colorIdtoRed    = new UIColor((float)(255.0 / 255.0), (float)(68.0 / 255.0), (float)(68.0 / 255.0), 1.0f);



            var ov     = overlay as MKPolyline;
            var ovView = new MKPolylineView(ov);

            ovView.FillColor   = colorIdtoRed;
            ovView.StrokeColor = colorIdtoRed;
            ovView.LineWidth   = 5;
            return(ovView);
        }
        public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay)
        {
            var polygonOverlay = overlay as MKPolyline;
            var polygonView    = new MKPolylineView(polygonOverlay);

            //polygonView.FillColor = UIColor.Blue;
            if (counter == 1)
            {
                polygonView.StrokeColor = UIColor.Blue;
            }
            else
            {
                polygonView.StrokeColor = UIColor.Red;
            }
            polygonView.LineWidth = 10;
            polygonView.Alpha     = 0.4f;
            return(polygonView);
        }
 public override MKOverlayView GetViewForOverlay (MKMapView mapView, NSObject overlay)
 {
     MKOverlayView overlayView = null;
     
     if(overlay is MKPolygon){
         MKPolygon polygon = overlay as MKPolygon;
         var polygonView = new MKPolygonView(polygon);
         polygonView.FillColor = UIColor.Purple;
         polygonView.Alpha = 0.7f;
         overlayView = polygonView;
     }
     else if(overlay is MKCircle){
         MKCircle circle = overlay as MKCircle;
         var circleView = new MKCircleView (circle);
         circleView.FillColor = UIColor.Green;
         overlayView = circleView;
     }
     else if(overlay is MKPolyline){
         MKPolyline polyline = overlay as MKPolyline;
         var polylineView = new MKPolylineView (polyline);
         polylineView.StrokeColor = UIColor.Black;
         overlayView = polylineView;
     }   
     else if(overlay is CustomOverlay)
     {
         CustomOverlay co = overlay as CustomOverlay;
         var v = new CustomOverlayView(co);
         overlayView = v;
     }
     
     return overlayView;
 }
Beispiel #10
0
        internal MKPolylineView OnCreateView(MKPolyline polyline)
        {
            foreach (var p in _polylines)
            {
                if (p == polyline)
                {
                    var polylineView = new MKPolylineView(polyline);
                    polylineView.StrokeColor = _color;
                    return polylineView;
                }
            }

            return null;
        }