public override void ViewDidLoad() { base.ViewDidLoad(); this.Title = "Pyramids of Giza"; // create our location and zoom for the pyramids. CLLocationCoordinate2D coords = new CLLocationCoordinate2D(29.976111, 31.132778); MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(.75), MilesToLongitudeDegrees(.75, coords.Latitude)); // set the coords and zoom on the map this.mapMain.Region = new MKCoordinateRegion(coords, span); // show the sat view. this.mapMain.MapType = MKMapType.Satellite; // add an overlay with the coords this._circleOverlay = MKCircle.Circle(coords, 200); this.mapMain.AddOverlay(this._circleOverlay); // set our delegate. //this.mapMain.Delegate = new MapDelegate(); //-- OR -- //- override the GetVIewForOverlay directly, in which case we don't need a delegate this.mapMain.GetViewForOverlay += (m, o) => { if (this._circleView == null) { this._circleView = new MKCircleView(this._circleOverlay); this._circleView.FillColor = UIColor.Blue; this._circleView.Alpha = 0.5f; } return(this._circleView); }; }
public override void ViewDidLoad () { base.ViewDidLoad (); this.Title = "Pyramids of Giza"; // create our location and zoom for the pyramids. CLLocationCoordinate2D coords = new CLLocationCoordinate2D(29.976111, 31.132778); MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(.75), MilesToLongitudeDegrees(.75, coords.Latitude)); // set the coords and zoom on the map this.mapMain.Region = new MKCoordinateRegion(coords, span); // show the sat view. this.mapMain.MapType = MKMapType.Satellite; // add an overlay with the coords this._circleOverlay = MKCircle.Circle(coords, 200); this.mapMain.AddOverlay(this._circleOverlay); // set our delegate. //this.mapMain.Delegate = new MapDelegate(); //-- OR -- //- override the GetVIewForOverlay directly, in which case we don't need a delegate this.mapMain.GetViewForOverlay += (m, o) => { if(this._circleView == null) { this._circleView = new MKCircleView(this._circleOverlay); this._circleView.FillColor = UIColor.Blue; this._circleView.Alpha = 0.5f; } return this._circleView; }; }
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); }
public void InitWithFrame() { var frame = new CGRect(10, 10, 100, 100); using (MKCircleView cv = new MKCircleView(frame)) { Assert.That(cv.Frame, Is.EqualTo(frame), "Frame"); } }
public override MKOverlayView GetViewForOverlay(MKMapView mapView, NSObject overlay) { var circleOverlay = overlay as MKCircle; var circleView = new MKCircleView (circleOverlay); circleView.FillColor = UIColor.Red; circleView.Alpha = 0.2f; return circleView; }
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); }
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); }
public override MKOverlayView GetViewForOverlay(MKMapView mapView, MonoTouch.Foundation.NSObject overlay) { if (this.CircleView == null) { this.circleView = new MKCircleView(this.circle) { StrokeColor = UIColor.Red, LineWidth = 2.0f }; } return this.CircleView; }
public override MKOverlayView GetViewForOverlay(MKMapView mapView, MonoTouch.Foundation.NSObject overlay) { if (this.CircleView == null) { this.circleView = new MKCircleView(this.circle) { StrokeColor = UIColor.Red, LineWidth = 2.0f }; } return(this.CircleView); }
public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay) { // var polygon = overlay as MKPolygon; // var polygonView = new MKPolygonView (polygon); // polygonView.FillColor = UIColor.Blue; // polygonView.StrokeColor = UIColor.Red; // return polygonView; var circleOverlay = overlay as MKCircle; var circleView = new MKCircleView(circleOverlay); circleView.FillColor = UIColor.Blue; circleView.Alpha = (nfloat)0.1; return(circleView); }
public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay) { if (overlay is MKCircle) { MKCircleView cv = new MKCircleView(overlay as MKCircle); cv.FillColor = UIColor.Purple; cv.Alpha = 0.5f; return(cv); } if (overlay is MKPolygon) { // 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); } return(null); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.Title = "Pyramids of Giza"; //---- create our location and zoom for the pyramids. CLLocationCoordinate2D coords = new CLLocationCoordinate2D(29.976111, 31.132778); MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(.75), MilesToLongitudeDegrees(.75, coords.Latitude)); //---- set the coords and zoom on the map this.mapMain.Region = new MKCoordinateRegion(coords, span); //---- show the sat view. this.mapMain.MapType = MKMapType.Satellite; //---- add an overlay with the coords and a .3 radius this._circleOverlay = MKCircle.Circle(coords, .5); this.mapMain.AddOverlay(this._circleOverlay); //---- //MKOverlayPathView path = new MKOverlayPathView() { Path = new MonoTouch.CoreGraphics.CGPath() }; //MKPolygon poly = new MKPolygon() { Points = new MKMapPoint[] { new MKMapPoint()} }; //poly.InteriorPolygons //MKPolygon poly2 = MKPolygon.FromPoints(new MKMapPoint[] { new MKMapPoint()}); //MKPolyline polyLine = MKPolyline.FromCoordinates(...); //---- set our delegate. //this.mapMain.Delegate = new MapDelegate(); this.mapMain.GetViewForOverlay += (m, o) => { if (this._circleView == null) { this._circleView = new MKCircleView(this._circleOverlay); this._circleView.FillColor = UIColor.LightGray; } return(this._circleView); }; }
public override MKOverlayView GetViewForOverlay(MKMapView mapView, IMKOverlay overlay) { MKPolygon polygon = overlay as MKPolygon; MKCircle circle = overlay as MKCircle; if (polygon != null) { MKPolygonView mkPolygonView = new MKPolygonView(polygon); mkPolygonView.FillColor = UIColor.Red; mkPolygonView.StrokeColor = UIColor.Blue; return(mkPolygonView); } if (circle != null) { MKCircleView mKCircleView = new MKCircleView(circle); mKCircleView.FillColor = UIColor.FromRGBA(255, 0, 0, 60); return(mKCircleView); } return(null); }
public MapDelegate(MKCircle circle, MKCircleView circleView) { this._circle = circle; this._circleView = circleView; }
public override void ViewDidLoad() { Console.WriteLine("Map to load"); base.ViewDidLoad (); Title = "MapView"; //mapView = new MKMapView(View.Bounds); this.DDZMapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions; //this.DDZMapView.MapType = MKMapType.Standard; // this is the default //this.DDZMapView.MapType = MKMapType.Satellite; //this.DDZMapView.MapType = MKMapType.Hybrid; View.AddSubview(this.DDZMapView); // create our location and zoom CLLocationCoordinate2D coords = new CLLocationCoordinate2D(38.9686111, -77.3413889); // Reston MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(2), MilesToLongitudeDegrees(2, coords.Latitude)); // set the coords and zoom on the map this.DDZMapView.Region = new MKCoordinateRegion(coords, span); circleOverlay = MKCircle.Circle (coords, 200); this.DDZMapView.AddOverlay (circleOverlay); this.DDZMapView.GetViewForOverlay = (m, o) => { if(circleView == null) { circleView = new MKCircleView(o as MKCircle); circleView.FillColor = UIColor.Purple; circleView.Alpha = 0.5f; } return circleView; }; }
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; }
public MapDelegate(MKCircle circle, MKCircleView circleView) { this._circle = circle; this._circleView = circleView; }
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; }
public override MKOverlayView GetViewForOverlay (MKMapView mapView, NSObject overlay) { if ((_circle != null) && (_circleView == null)) { _circleView = new MKCircleView (_circle); _circleView.FillColor = UIColor.Cyan; } return _circleView; }