private void AddManagers() { var annotationManager = new AnnotationManager(_iosMapView, _customMap); var routeManager = new RouteManager(_iosMapView, _customMap, annotationManager); _mapManager = new MapManager(_customMap, annotationManager, routeManager); _iosMapView.GetViewForAnnotation = annotationManager.GetViewForAnnotation; _drawingManager = new MapDrawingManager(_customMap, Color.Black); _iosMapView.OverlayRenderer = _drawingManager.GetOverlayRenderer; }
protected override void DrawCalculatedRouteInMap(RouteModel route) { var drawingManager = new MapDrawingManager(FormsMap, route.Color); _nativeMap.OverlayRenderer = drawingManager.GetOverlayRenderer; var nativeCoordinates = route.RoutePoints.Select(p => CoordinateConverter.ConvertToNative(p)); _currentUserRoute = MKPolyline.FromCoordinates(nativeCoordinates.ToArray()); _nativeMap.AddOverlay(_currentUserRoute); }
protected override void OnElementChanged(ElementChangedEventArgs <View> e) { base.OnElementChanged(e); if (e.OldElement != null) { _iosMapView = null; _drawingManager = null; _mapManager = null; } if (e.NewElement != null) { _iosMapView = (MKMapView)Control; _customMap = (CustomMap)Element; _iosMapView.ZoomEnabled = true; AddManagers(); } }