示例#1
0
 public void DrawPolygon(MKPolygon polygon,MKMapRect mapRect, float zoomScale, CGContext context)
 {
     CGPath path = this.polyPath (polygon,mapRect,zoomScale,context);
     if (path != null)
     {
         this.ApplyFillProperties (context, zoomScale);
         context.BeginPath ();
         context.AddPath (path);
         // CGContextAddPath(context, path);
         context.DrawPath (CGPathDrawingMode.EOFill);
         //  CGContextDrawPath(context, kCGPathEOFill);
         this.ApplyStrokeProperties (context, zoomScale);
         context.BeginPath ();
         // CGContextBeginPath(context);
         context.AddPath (path);
         // CGContextAddPath(context, path);
         context.StrokePath ();
         // CGContextStrokePath(context);
     }
 }
示例#2
0
        public CGPath polyPath(MKPolygon polygon,MKMapRect mapRect, float zoomScale, CGContext context)
        {
            MKMapPoint[] points = polygon.Points;
            Int32 pointCount = polygon.PointCount;
            Int32 i;

            if (pointCount < 3)
                return null;

            CGPath path = new CGPath ();

            PointF relativePoint = this.PointForMapPoint (points[0]);
            path.MoveToPoint (relativePoint.X, relativePoint.Y);
            for (i = 1; i < pointCount; i++)
            {
                relativePoint = this.PointForMapPoint (points[i]);
                path.AddLineToPoint(relativePoint);
                //path.CGPathAddLineToPoint (relativePoint.X, relativePoint.Y);
            }

            return path;
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TreeWatch.iOS.ColorPolygon"/> class.
 /// DrawOutlines is set to true;
 /// </summary>
 /// <param name="polygon">Polygon to extend</param>
 public ColorPolygon(MKPolygon polygon)
 {
     this.Polygon = polygon;
     this.DrawOutlines = true;
 }
示例#4
0
        /// <summary>
        /// Gets the poly path for a polygon.
        /// </summary>
        /// <returns>The path.</returns>
        /// <param name="polygon">Polygon to get the path for.</param>
        public CGPath PolyPath(MKPolygon polygon)
        {
            var path = new CGPath();

            foreach (var item in polygon.InteriorPolygons)
            {
                var interiorPath = this.PolyPath(item);
                path.AddPath(interiorPath);
            }

            var relativePoint = PointForMapPoint(polygon.Points[0]);
            path.MoveToPoint(relativePoint);
            foreach (var point in polygon.Points)
            {
                path.AddLineToPoint(this.PointForMapPoint(point));
            }

            return path;
        }
示例#5
0
		protected override void OnDetached()
		{
			mapView.DidUpdateUserLocation -= DidUpdateUserLocation;
			mapView.MapLoaded -= MapView_MapLoaded;

//			mapView.RemoveGestureRecognizer(tapGesture);
//			tapGesture.Dispose();
//			tapGesture = null;

			mapView = null;
			behavior = null;
			polygon?.Dispose();
			polygon = null;
			polygonRenderer?.Dispose();
			polygonRenderer = null;
		}
示例#6
0
		private void UpdatePolygon()
		{
			if(mapView?.UserLocation?.Coordinate == null)
				return;

			if(polygon != null)
			{
				mapView.RemoveOverlay(polygon);
				polygon.Dispose();
			}

			polygon = MKPolygon.FromCoordinates(new[] {
				mapView.UserLocation.Coordinate,
				new CLLocationCoordinate2D(mapView.UserLocation.Coordinate.Latitude + 5, mapView.UserLocation.Coordinate.Longitude + 5),
				new CLLocationCoordinate2D(mapView.UserLocation.Coordinate.Latitude - 5, mapView.UserLocation.Coordinate.Longitude + 3),
			});

			mapView.AddOverlay(polygon);
		}
示例#7
0
 public PolygonOverlay(MKPolygon polygon)
 {
     _polygon = polygon;
 }
示例#8
0
        public void FromPoints_Interior_Empty()
        {
            MKPolygon pg = MKPolygon.FromPoints(new MKMapPoint [] { }, new MKPolygon [] { });

            CheckEmpty(pg);
        }
示例#9
0
 public void FromPoints_Null()
 {
     MKPolygon.FromPoints(null);
 }
示例#10
0
        public void FromCoordinates_Interior_Empty()
        {
            MKPolygon pg = MKPolygon.FromCoordinates(new CLLocationCoordinate2D [] { }, new MKPolygon [] { });

            CheckEmpty(pg);
        }