コード例 #1
0
 public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay)
 {
     // return a view for the polygon
     MKPolygon polygon = overlay as MKPolygon;
     MKPolygonView polygonView = new MKPolygonView (polygon);
     polygonView.FillColor = UIColor.Blue;
     polygonView.StrokeColor = UIColor.Red;
     return polygonView;
 }
コード例 #2
0
ファイル: CustomMapRenderer.cs プロジェクト: yofanana/recipes
 MKOverlayRenderer GetOverlayRenderer(MKMapView mapView, IMKOverlay overlay)
 {
     if (circleRenderer == null) {
         circleRenderer = new MKCircleRenderer (overlay as MKCircle);
         circleRenderer.FillColor = UIColor.Red;
         circleRenderer.Alpha = 0.4f;
     }
     return circleRenderer;
 }
コード例 #3
0
ファイル: MapDelegate.cs プロジェクト: kosomgua/MapCross
 //Override OverLayRenderer to draw Polyline returned from directions
 public override MKOverlayRenderer OverlayRenderer(MKMapView mapView, IMKOverlay overlay)
 {
     if (overlay is MKPolyline)
     {
         var route = (MKPolyline)overlay;
         var renderer = new MKPolylineRenderer(route) { StrokeColor = UIColor.Blue };
         return renderer;
     }
     return null;
 }
コード例 #4
0
 public override MKOverlayRenderer OverlayRenderer(MKMapView mapView, IMKOverlay overlay)
 {
     return new MKPolylineRenderer(overlay as MKPolyline)
     {
         Alpha = (nfloat) alpha,
         LineWidth = (nfloat) 4.0,
         FillColor = color,
         StrokeColor = color
     };
 }
コード例 #5
0
ファイル: CustomMapRenderer.cs プロジェクト: yofanana/recipes
 MKOverlayRenderer GetOverlayRenderer(MKMapView mapView, IMKOverlay overlay)
 {
     if (polygonRenderer == null) {
         polygonRenderer = new MKPolygonRenderer (overlay as MKPolygon);
         polygonRenderer.FillColor = UIColor.Red;
         polygonRenderer.StrokeColor = UIColor.Blue;
         polygonRenderer.Alpha = 0.4f;
         polygonRenderer.LineWidth = 9;
     }
     return polygonRenderer;
 }
コード例 #6
0
		public override MKOverlayView GetViewForOverlay (MKMapView mapView, IMKOverlay overlay)
		{
			if (RegionDefinerViewController.PolygonView != null && RegionDefinerViewController.PolygonView.Polygon == RegionDefinerViewController.Polygon)
				return RegionDefinerViewController.PolygonView;

			RegionDefinerViewController.Polygon = overlay as MKPolygon;
			RegionDefinerViewController.PolygonView = new MKPolygonView (RegionDefinerViewController.Polygon) {
				FillColor = new UIColor (0, 1, 0, .3f),
				StrokeColor = new UIColor (0, 1, 0, 0.9f),
				LineWidth = 1.0f
			};

			return RegionDefinerViewController.PolygonView;
		}
コード例 #7
0
        /// <summary>
        /// Get the overlay renderer
        /// </summary>
        /// <param name="mapView">The <see cref="MKMapView"/></param>
        /// <param name="overlay">The overlay to render</param>
        /// <returns>The overlay renderer</returns>
        private MKOverlayRenderer GetOverlayRenderer(MKMapView mapView, IMKOverlay overlay)
        {

            var polyline = overlay as MKPolyline;
            if (polyline != null)
            {
                // check if this polyline is a route
                var route = this._routes[polyline];
                if (route == null)
                {
                    // not a route, check if it is a line
                    var line = this._lines[polyline];

                    if (line == null) return null;

                    if (line.Renderer == null)
                    {
                        line.Renderer = new MKPolylineRenderer(polyline);
                    }
                    line.Renderer.FillColor = line.Overlay.Color.ToUIColor();
                    line.Renderer.LineWidth = line.Overlay.LineWidth;
                    line.Renderer.StrokeColor = line.Overlay.Color.ToUIColor();

                    // return renderer for the line
                    return line.Renderer;
                }

                if (route.Renderer == null)
                {
                    route.Renderer = new MKPolylineRenderer(polyline);
                }
                route.Renderer.FillColor = route.Overlay.Color.ToUIColor();
                route.Renderer.LineWidth = route.Overlay.LineWidth;
                route.Renderer.StrokeColor = route.Overlay.Color.ToUIColor();
                return route.Renderer;
            }

            var mkCircle = overlay as MKCircle;
            if (mkCircle != null)
            {
                var circle = this._circles[mkCircle];
                if (circle == null) return null;

                if (circle.Renderer == null)
                {
                    circle.Renderer = new MKCircleRenderer(mkCircle);
                }
                circle.Renderer.FillColor = circle.Overlay.Color.ToUIColor();
                circle.Renderer.StrokeColor = circle.Overlay.StrokeColor.ToUIColor();
                circle.Renderer.LineWidth = circle.Overlay.StrokeWidth;
                return circle.Renderer;
            }

            var mkPolygon = overlay as MKPolygon;
            if (mkPolygon != null)
            {
                var polygon = this._polygons[mkPolygon];
                if (polygon == null) return null;

                if (polygon.Renderer == null)
                {
                    polygon.Renderer = new MKPolygonRenderer(mkPolygon);
                }
                
                polygon.Renderer.FillColor = polygon.Overlay.Color.ToUIColor();
                polygon.Renderer.StrokeColor = polygon.Overlay.StrokeColor.ToUIColor();
                polygon.Renderer.LineWidth = polygon.Overlay.StrokeWidth;
                return polygon.Renderer;
            }
            return null;
        }
コード例 #8
0
        public override MKOverlayRenderer OverlayRenderer(MKMapView mapView, IMKOverlay overlay)
        {
            if (overlay is MKCircle)
            {
                if (circleRenderer == null)
                {
                    circleRenderer = new MKCircleRenderer(overlay as MKCircle);
                    circleRenderer.FillColor = UIColor.Purple;
                    circleRenderer.Alpha = 0.5f;
                }
                return circleRenderer;

            } else if (overlay is MKPolygon)
            {
                if (polyRenderer == null)
                {
                    polyRenderer = new MKPolygonRenderer(overlay as MKPolygon);
                    polyRenderer.FillColor = UIColor.Green;
                    polyRenderer.Alpha = 0.5f;
                }
                return polyRenderer;
            } else
            {
                Debug.WriteLine("OverlayRenderer() - Unknown overlay type!");
                return null;
            }

        }            
コード例 #9
0
		public MKOverlayRenderer OverlayRenderer (MKMapView mapView, IMKOverlay overlay)
		{
			return new MKOverlayPathRenderer (overlay) {
				FillColor = UIColor.Blue.ColorWithAlpha (0.2f),
				StrokeColor = UIColor.Black,
				LineWidth = 2
			};
		}
コード例 #10
0
        public override MKOverlayRenderer OverlayRenderer(MKMapView mapView, IMKOverlay overlay)
        {
            var unifiedOverlay = overlay as IUnifiedOverlay;
            if (unifiedOverlay != null)
            {
                return unifiedOverlay.GetRenderer();
            }

            return null;
        }
コード例 #11
0
		public RadarOverlayRenderer (IMKOverlay overlay) : base (overlay) { }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeWatch.iOS.MultiPolygonView"/> class.
 /// </summary>
 /// <param name="overlay">Overlay to be displayed.</param>
 public MultiPolygonView(IMKOverlay overlay)
 {
     this.polygonOverlay = overlay;
 }
コード例 #13
0
			public override MKOverlayView GetViewForOverlay (MKMapView mapView, IMKOverlay overlay)
			{
				var circleOverlay = overlay as MKCircle;
				var circleView = new MKCircleView (circleOverlay);
				circleView.FillColor = UIColor.Red;
				circleView.Alpha = 0.4f;
				return circleView;
			}
コード例 #14
0
			public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay)
			{
				if ((_circle != null) && (_circleView == null))
				{
					_circleView = new MKCircleView(_circle);
					_circleView.FillColor = UIColor.Blue;
					_circleView.Alpha = 0.5f;
				}
				return _circleView;
			} 
コード例 #15
0
        /* TODO Readd LFHeatMap project first
         * Found at https://github.com/TreeWatch/LFHeatMaps
         * Code:
        void ChangeRegion(object sender, MKMapViewChangeEventArgs e){

            foreach (var item in mapView.Subviews)
            {
                var heatMap = item as UIHeatMapView;
                if (heatMap != null)
                    heatMap.RefreshHeatMap(mapView);
            }
        }
        */

        /// <summary>
        /// Gets the overlay render for a overlay.
        /// </summary>
        /// <returns>The overlay render.</returns>
        /// <param name="m">The Mapview.</param>
        /// <param name="o">The Overlay.</param>
        private MKOverlayRenderer GetOverlayRender(MKMapView m, IMKOverlay o)
        {
            var overlay = Runtime.GetNSObject(o.Handle) as MKPolygon;
            if (overlay != null)
            {
                var polygon = overlay;
                var polygonRenderer = new MKPolygonRenderer(polygon);

                if (polygon.Title == "Field")
                {
                    polygonRenderer.FillColor = this.myMap.OverLayColor.ToUIColor();
                    polygonRenderer.StrokeColor = this.myMap.BoundaryColor.ToUIColor();
                    polygonRenderer.LineWidth = 1;
                }

                return polygonRenderer;
            }

            if (o is MultiPolygon)
            {
                return new MultiPolygonView(o);
            }

            return null;
        }