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);
            }
Exemplo n.º 2
0
        public void InitWithFrame()
        {
            RectangleF frame = new RectangleF(10, 10, 100, 100);

            using (MKOverlayView ov = new MKOverlayView(frame)) {
                Assert.That(ov.Frame, Is.EqualTo(frame), "Frame");
                Assert.Null(ov.Overlay, "Overlay");
            }
        }
            public override MKOverlayView GetViewForOverlay(MKMapView mapView, NSObject overlay)
            {
                MKOverlayView overlayView = null;

                if (overlay == _viewController.RouteLine)
                {
                    if (null == _viewController.RouteLineView)
                    {
                        _viewController.RouteLineView             = new MKPolylineView(_viewController.RouteLine);
                        _viewController.RouteLineView.FillColor   = UIColor.Red;
                        _viewController.RouteLineView.StrokeColor = UIColor.Red;
                        _viewController.RouteLineView.LineWidth   = 3;
                    }
                    overlayView = _viewController.RouteLineView;
                }
                return(overlayView);
            }
Exemplo n.º 4
0
 public override MKOverlayView GetViewForOverlay(MKMapView mapView, NSObject overlay)
 {
     try {
         MKOverlayView overlayView = null;
         if (overlay == _viewController.RouteLine)
         {
             //if (null == _viewController.RouteLineView) {
             _viewController.RouteLineView             = new MKPolylineView(_viewController.RouteLine);
             _viewController.RouteLineView.FillColor   = UIColor.Red;
             _viewController.RouteLineView.StrokeColor = UIColor.Red;
             _viewController.RouteLineView.LineWidth   = 2;
             //}
             overlayView = _viewController.RouteLineView;
         }
         return(overlayView);
     } catch (Exception e) {
         MessageHelper.showErrorMesage("getViewForOverlay " + e.Message);
         return(null);
     }
 }