コード例 #1
0
ファイル: RootViewController.cs プロジェクト: wsabor/AX
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CLLocationManager locationManager = new CLLocationManager();

            if (locationManager.RespondsToSelector(new ObjCRuntime.Selector("requestWhenInUseAuthorization")))
            {
                locationManager.RequestWhenInUseAuthorization();
            }

            MKPointAnnotation pinView = new MKPointAnnotation();

            pinView.Title = "Teste";
            pinView.SetCoordinate(new CoreLocation.CLLocationCoordinate2D(-23.548428, -46.631834));
            mapa.AddAnnotation(pinView);

            mapa.Camera = new MKMapCamera()
            {
                CenterCoordinate = new CoreLocation.CLLocationCoordinate2D(-23.548428, -46.631834),
                Altitude         = 3000
            };

            // Perform any additional setup after loading the view, typically from a nib.
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _map.MapType           = MKMapType.Standard;
            _map.ShowsUserLocation = true;
            _map.ZoomEnabled       = true;
            _map.ScrollEnabled     = true;

            var mapCenter = new CLLocationCoordinate2D(Tweet.GpsCoordinates.Latitude, Tweet.GpsCoordinates.Longitude);
            var mapRegion = MKCoordinateRegion.FromDistance(mapCenter, 200, 00);

            _map.CenterCoordinate = mapCenter;
            _map.Region           = mapRegion;

            _delegate     = new MapDelegate();
            _map.Delegate = _delegate;

            var mkPointAnnotation = new MKPointAnnotation
            {
                Title    = Tweet.User,
                Subtitle = Tweet.Text
            };

            mkPointAnnotation.SetCoordinate(new CLLocationCoordinate2D(Tweet.GpsCoordinates.Latitude, Tweet.GpsCoordinates.Longitude));
            _map.AddAnnotation(mkPointAnnotation);
        }
コード例 #3
0
        private void UpdatePins()
        {
            var mkMapView = Control as MKMapView;
            var formsMap  = Element as ExtendedMap;

            if (mkMapView.Annotations.Length > 0)
            {
                mkMapView.RemoveAnnotations(mkMapView.Annotations);
            }

            var items = formsMap.Pins;

            foreach (var item in items)
            {
                var coord = new CLLocationCoordinate2D(item.Position.Latitude, item.Position.Longitude);


                var point = new MKPointAnnotation {
                    Title = item.Label
                };

                point.SetCoordinate(coord);

                mkMapView.AddAnnotation(point);
            }
        }
コード例 #4
0
        private void AddAnnotations()
        {
            var dot = new MKPointAnnotation();

            dot.Title = "Test Annotation";
            dot.SetCoordinate(VegasCoords);

            MyMapView.AddAnnotation(dot);
        }
コード例 #5
0
        public void UpdateMap(bool result)
        {
            GroupTableSource.SelectedIndex = -1;

            // remove existing annotations
            MapView.RemoveAnnotations(MapView.Annotations);

            // set the search results banner appropriately
            if (GroupEntries.Count > 0)
            {
                SearchResultsPrefix.Text = ConnectStrings.GroupFinder_Neighborhood;
                //SearchResultsNeighborhood.Text = GroupEntries[ 0 ].NeighborhoodArea;

                // add an annotation for each position found in the group
                List <IMKAnnotation> annotations = new List <IMKAnnotation>();

                // add an annotation for the source
                MKPointAnnotation sourceAnnotation = new MKPointAnnotation();
                sourceAnnotation.SetCoordinate(new CLLocationCoordinate2D(SourceLocation.Latitude, SourceLocation.Longitude));
                sourceAnnotation.Title    = "";
                sourceAnnotation.Subtitle = "";
                annotations.Add(sourceAnnotation);

                foreach (MobileAppApi.GroupSearchResult entry in GroupEntries)
                {
                    MKPointAnnotation annotation = new MKPointAnnotation();
                    annotation.SetCoordinate(new CLLocationCoordinate2D(entry.Latitude, entry.Longitude));
                    annotation.Title    = entry.Name;
                    annotation.Subtitle = string.Format("{0:##.0} {1}", entry.DistanceFromSource, ConnectStrings.GroupFinder_MilesSuffix);
                    annotations.Add(annotation);
                }
                MapView.ShowAnnotations(annotations.ToArray( ), true);
            }
            else
            {
                if (result == true)
                {
                    SearchResultsPrefix.Text       = ConnectStrings.GroupFinder_NoGroupsFound;
                    SearchResultsNeighborhood.Text = string.Empty;

                    // since there were no groups, revert the map to whatever specified area
                    MKCoordinateRegion region = MKCoordinateRegion.FromDistance(new CLLocationCoordinate2D(
                                                                                    ConnectConfig.GroupFinder_DefaultLatitude,
                                                                                    ConnectConfig.GroupFinder_DefaultLongitude),
                                                                                ConnectConfig.GroupFinder_DefaultScale_iOS,
                                                                                ConnectConfig.GroupFinder_DefaultScale_iOS);
                    MapView.SetRegion(region, true);
                }
                else
                {
                    SearchResultsPrefix.Text       = ConnectStrings.GroupFinder_NetworkError;
                    SearchResultsNeighborhood.Text = string.Empty;
                }
            }

            UpdateResultsBanner( );
        }
コード例 #6
0
        private void UpdateUiCoords()
        {
            CurrentLatitude.Text  = _iPhoneLocationManager.Location.Coordinate.Latitude.ToString(CultureInfo.InvariantCulture);
            CurrentLongitude.Text = _iPhoneLocationManager.Location.Coordinate.Longitude.ToString(CultureInfo.InvariantCulture);
            var mkPointAnnotation = new MKPointAnnotation
            {
                Title = "You Are Here",
            };

            mkPointAnnotation.SetCoordinate(new CLLocationCoordinate2D(_iPhoneLocationManager.Location.Coordinate.Latitude, _iPhoneLocationManager.Location.Coordinate.Longitude));
            mapView.AddAnnotation(mkPointAnnotation);
        }
コード例 #7
0
        void AddPins(IList pins)
        {
            foreach (Pin pin in pins)
            {
                var annotation = new MKPointAnnotation {
                    Title = pin.Label, Subtitle = pin.Address ?? ""
                };

                pin.Id = annotation;
                annotation.SetCoordinate(new CLLocationCoordinate2D(pin.Position.Latitude, pin.Position.Longitude));
                ((MKMapView)Control).AddAnnotation(annotation);
            }
        }
コード例 #8
0
		void OnLocationsUpdated (object sender, CLLocationsUpdatedEventArgs e)
		{
			currentLocation = e.Locations.LastOrDefault ();

			if (pin != null)
				return;

			pin = new MKPointAnnotation ();
			pin.SetCoordinate (currentLocation.Coordinate);

			map.AddAnnotation (pin);
			map.ShowAnnotations (new [] { pin }, false);

			locationManager.StopUpdatingLocation ();
		}
コード例 #9
0
        /// <summary>
        /// Adds a pin to the current map.
        /// </summary>
        /// <param name="pin">A pin to add.</param>
        private void AddPin(MapExPin pin)
        {
            // Prepare a new annotation for the map
            // ReSharper disable once UseObjectOrCollectionInitializer
            var annotation = new MKPointAnnotation();

            annotation.Title    = string.IsNullOrEmpty(pin.Label) ? "NO DATA" : pin.Label;
            annotation.Subtitle = string.IsNullOrEmpty(pin.Address) ? string.Empty : pin.Address;
            annotation.SetCoordinate(new CLLocationCoordinate2D(pin.Position.Latitude, pin.Position.Longitude));
            pin.InternalId = annotation;

            // Add the annotation to the map
            ((MKMapView)this.Control).AddAnnotation(annotation);

            // Add event handlers
            pin.PropertyChanged += this.OnPinPropertyChanged;
        }
コード例 #10
0
        void OnLocationsUpdated(object sender, CLLocationsUpdatedEventArgs e)
        {
            currentLocation = e.Locations.LastOrDefault();

            if (pin != null)
            {
                return;
            }

            pin = new MKPointAnnotation();
            pin.SetCoordinate(currentLocation.Coordinate);

            map.AddAnnotation(pin);
            map.ShowAnnotations(new [] { pin }, false);

            locationManager.StopUpdatingLocation();
        }
コード例 #11
0
        private void UpdatePins()
        {
            var mkMapView = Control;
            var formsMap  = Element;
            var items     = formsMap.Pins;

            foreach (var item in items)
            {
                var coord = new CLLocationCoordinate2D(item.Position.Latitude, item.Position.Longitude);

                var point = new MKPointAnnotation()
                {
                    Title = item.Label
                };

                point.SetCoordinate(coord);

                mkMapView.AddAnnotation(point);
            }
        }
コード例 #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            //Map_Map.MapType = MapKit.MKMapType.Standard;

            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                m_LocationManager.RequestWhenInUseAuthorization();
            }
            Map_Map.ShowsUserLocation = true;
            MKPointAnnotation oPointAnnotation = new MKPointAnnotation
            {
                Title = "¸Î¶©¹q¯à",
            };

            oPointAnnotation.SetCoordinate(new CLLocationCoordinate2D(24.977109, 121.545983));
            Map_Map.AddAnnotation(oPointAnnotation);
            Map_Map.GetViewForAnnotation = delegate(MKMapView mapView, IMKAnnotation annotation)
            {
                if (annotation is MKPointAnnotation)
                {
                    MKPinAnnotationView pinAnnotationView = (MKPinAnnotationView)Map_Map.DequeueReusableAnnotation(m_PointAnnotationId);
                    if (pinAnnotationView == null)
                    {
                        pinAnnotationView                           = new MKPinAnnotationView(annotation, m_PointAnnotationId);
                        pinAnnotationView.PinColor                  = MKPinAnnotationColor.Purple;
                        pinAnnotationView.CanShowCallout            = true;
                        pinAnnotationView.RightCalloutAccessoryView = UIButton.FromType(UIButtonType.DetailDisclosure);
                    }
                    return(pinAnnotationView);
                }
                return(null);
            };


            //Map_Map.SetUserTrackingMode(MKUserTrackingMode.None, true);
            Map_Map.ShowAnnotations(new IMKAnnotation[] { oPointAnnotation }, true);
        }
コード例 #13
0
ファイル: MapRenderer.cs プロジェクト: ytn3rd/Xamarin.Forms
		void AddPins(IList pins)
		{
			foreach (Pin pin in pins)
			{
				var annotation = new MKPointAnnotation { Title = pin.Label, Subtitle = pin.Address ?? "" };

				pin.Id = annotation;
#if __UNIFIED__
				annotation.SetCoordinate(new CLLocationCoordinate2D(pin.Position.Latitude, pin.Position.Longitude));
#else
				annotation.Coordinate = new CLLocationCoordinate2D (pin.Position.Latitude, pin.Position.Longitude);
#endif
				((MKMapView)Control).AddAnnotation(annotation);
			}
		}
コード例 #14
0
        /// <summary>
        /// Purpose: Draw the first placemark in the mapview with the person name and street -> zoom the camera at the location
        /// </summary>
        /// <param name="placemarks">Placemarks.</param>
        /// <param name="error">Error.</param>
        void HandleCLGeocodeCompletionHandler (CLPlacemark[] placemarks, NSError error)
        {

            CLLocationCoordinate2D loc;

            // if GeoCode hasn't found a placemark, leave the function
            if (placemarks == null)
                return;

            // Delete the previous annotation
            if (_MainAnnotation != null)
                MapView.RemoveAnnotation(_MainAnnotation);

            // Assign the class annotation with the received values
            loc = placemarks[0].Location.Coordinate;

            _MainAnnotation =  new MKPointAnnotation(){ Title = _person.Name ,Subtitle = _person.Strasse  
            };
            _MainAnnotation.SetCoordinate(new CLLocationCoordinate2D (loc.Latitude,loc.Longitude ));
               
            // Add the annotation to the mapview
            MapView.AddAnnotation(_MainAnnotation);

            var region = new MKCoordinateRegion (_MainAnnotation.Coordinate,new MKCoordinateSpan (1f / 0.5f, 1f /  0.5f));
            //          
            MapView.SetRegion (region, true);


           
        }
コード例 #15
0
        public void UpdateMap( bool result )
        {
            GroupTableSource.SelectedIndex = -1;

            // remove existing annotations
            MapView.RemoveAnnotations( MapView.Annotations );

            // set the search results banner appropriately
            if ( GroupEntries.Count > 0 )
            {
                SearchResultsPrefix.Text = ConnectStrings.GroupFinder_Neighborhood;
                SearchResultsNeighborhood.Text = GroupEntries[ 0 ].NeighborhoodArea;

                // add an annotation for each position found in the group
                List<IMKAnnotation> annotations = new List<IMKAnnotation>();

                // add an annotation for the source
                MKPointAnnotation sourceAnnotation = new MKPointAnnotation();
                sourceAnnotation.SetCoordinate( new CLLocationCoordinate2D( SourceLocation.Latitude, SourceLocation.Longitude ) );
                sourceAnnotation.Title = "";
                sourceAnnotation.Subtitle = "";
                annotations.Add( sourceAnnotation );

                foreach ( GroupFinder.GroupEntry entry in GroupEntries )
                {
                    MKPointAnnotation annotation = new MKPointAnnotation();
                    annotation.SetCoordinate( new CLLocationCoordinate2D( entry.Latitude, entry.Longitude ) );
                    annotation.Title = entry.Title;
                    annotation.Subtitle = string.Format( "{0:##.0} {1}", entry.Distance, ConnectStrings.GroupFinder_MilesSuffix );
                    annotations.Add( annotation );
                }
                MapView.ShowAnnotations( annotations.ToArray( ), true );
            }
            else
            {
                if ( result == true )
                {
                    SearchResultsPrefix.Text = ConnectStrings.GroupFinder_NoGroupsFound;
                    SearchResultsNeighborhood.Text = string.Empty;

                    // since there were no groups, revert the map to whatever specified area
                    MKCoordinateRegion region = MKCoordinateRegion.FromDistance( new CLLocationCoordinate2D( 
                                                        ConnectConfig.GroupFinder_DefaultLatitude, 
                                                        ConnectConfig.GroupFinder_DefaultLongitude ), 
                                                    ConnectConfig.GroupFinder_DefaultScale_iOS, 
                                                    ConnectConfig.GroupFinder_DefaultScale_iOS );
                    MapView.SetRegion( region, true );
                }
                else
                {
                    SearchResultsPrefix.Text = ConnectStrings.GroupFinder_NetworkError;
                    SearchResultsNeighborhood.Text = string.Empty;
                }
            }

            UpdateResultsBanner( );
        }
コード例 #16
0
 private void UpdateUiCoords()
 {
     CurrentLatitude.Text = _iPhoneLocationManager.Location.Coordinate.Latitude.ToString(CultureInfo.InvariantCulture);
     CurrentLongitude.Text = _iPhoneLocationManager.Location.Coordinate.Longitude.ToString(CultureInfo.InvariantCulture);
     var mkPointAnnotation = new MKPointAnnotation
     {
         Title = "You Are Here",
     };
     mkPointAnnotation.SetCoordinate(new CLLocationCoordinate2D(_iPhoneLocationManager.Location.Coordinate.Latitude, _iPhoneLocationManager.Location.Coordinate.Longitude));
     mapView.AddAnnotation(mkPointAnnotation);
 }
コード例 #17
0
        private void LoadData()
        {
            var jsonPath = NSBundle.MainBundle.PathForResource("Berlin-Data", "json");
            var inputStream = NSInputStream.FromFile(jsonPath);
            inputStream.Open();
            NSError err = null;
            var json = NSJsonSerialization.Deserialize(inputStream, 0, out err) as NSArray;

            MKPointAnnotation annotation = null;
            List<MKPointAnnotation> annotations = new List<MKPointAnnotation>();
            NSNumber lat = null;
            NSNumber lng = null;
            NSDictionary annotationAsJSON = null;

            for (nuint i = 0; i < json.Count; i++)
            {
                annotationAsJSON = json.GetItem<NSDictionary>(i);
                annotation = new MKPointAnnotation();
                lat = annotationAsJSON.ValueForKeyPath(new NSString("location.coordinates.latitude")) as NSNumber;
                lng = annotationAsJSON.ValueForKeyPath(new NSString("location.coordinates.longitude")) as NSNumber;
                annotation.SetCoordinate(new CLLocationCoordinate2D(lat.DoubleValue, lng.DoubleValue));
                annotation.Title = annotationAsJSON.ValueForKeyPath(new NSString("person.lastName")).ToString();
                annotations.Add(annotation);
            }

            _mapClusterController.AddAnnotations(annotations.ToArray(), null);
        }
コード例 #18
0
        /*private async void FindRouteAndDrawRoute (double sourceLat, double sourceLng, double destinationLat, double destinationLng, DirectionsMode directionsMode = DirectionsMode.Driving)
         *      {
         *  if (CLLocationManager.Status == CLAuthorizationStatus.NotDetermined ||  CLLocationManager.Status == CLAuthorizationStatus.Denied)
         *      return;
         *
         *  //get current location
         *  Geolocator locator = new Geolocator(){ DesiredAccuracy = 100};
         *  var location = await locator.GetPositionAsync(50000);
         *
         *  Console.WriteLine("Position Status: {0}", location.Timestamp);
         *  Console.WriteLine("Position Latitude: {0}", location.Latitude);
         *  Console.WriteLine("Position Longitude: {0}", location.Longitude);
         *
         *  MKPlacemark source = new MKPlacemark (new CLLocationCoordinate2D (sourceLat, sourceLng), new NSDictionary ());
         *              MKMapItem sourceItem = new MKMapItem (source);
         *
         *              desCoordinate = new CLLocationCoordinate2D (destinationLat, destinationLng);
         *              MKPlacemark destination = new MKPlacemark (new CLLocationCoordinate2D (destinationLat, destinationLng), new NSDictionary ());
         *              MKMapItem destinationItem = new MKMapItem (destination);
         *
         *              MKDirectionsRequest request = new MKDirectionsRequest ();
         *              request.Source = sourceItem;
         *              request.Destination = destinationItem;
         *              request.TransportType = directionsMode == DirectionsMode.Driving ? MKDirectionsTransportType.Automobile : MKDirectionsTransportType.Walking;
         *
         *              MKDirections direction = new MKDirections (request);
         *
         *              direction.CalculateDirections (delegate(MKDirectionsResponse response, NSError error) {
         *                      if (error == null) {
         *                              //remove all routes that has been drawn on map
         *                              if (mapView.Overlays != null && mapView.Overlays.Length != 0) {
         *                                      foreach (var overlay in mapView.Overlays) {
         *                                              mapView.RemoveOverlay (overlay);
         *                                      }
         *                              }
         *
         *                              //check if have route
         *                              if (response.Routes.Length == 0) {
         *                                      Mvx.Resolve<IMvxMessenger> ().Publish (new ToastMessage (this.ViewModel, "Cannot find the route"));
         *                              }
         *
         *                              //add new route
         *                              foreach (var route in response.Routes) {
         *                                      MKPolyline polyline = route.Polyline;
         *                                      mapView.AddOverlay (polyline);
         *
         *                                      ViewModel.TotalDistance = route.Distance;
         *                                      ViewModel.ExpectedTime = TimeSpan.FromSeconds(route.ExpectedTravelTime);
         *
         *                                      foreach (var step in route.Steps) {
         *                                              ViewModel.Routes.Add (new FlexyPark.Core.Models.RouteItem () {
         *                                                      Instruction = step.Instructions,
         *                                                      Distance = step.Distance,
         *                                                      Long = step.Polyline.Coordinate.Longitude,
         *                                                      Lat = step.Polyline.Coordinate.Latitude
         *                                              });
         *
         *                                              Console.WriteLine (step.Instructions);
         *                                              Console.WriteLine (step.Distance);
         *                                      }
         *                                      break;
         *                              }
         *
         *                      } else {
         *                              Console.WriteLine (error.LocalizedDescription);
         *                      }
         *              });
         *
         *              MKMapPoint userPoint = MKMapPoint.FromCoordinate (new CLLocationCoordinate2D (sourceLat, sourceLng));
         *              MKMapRect zoomRect = new MKMapRect (userPoint.X, userPoint.Y, 0.1, 0.1);
         *
         *              MKMapPoint annotationPoint = MKMapPoint.FromCoordinate (new CLLocationCoordinate2D (destinationLat, destinationLng));
         *              MKMapRect pointRect = new MKMapRect (annotationPoint.X, annotationPoint.Y, 0.1, 0.1);
         *
         *              zoomRect = MKMapRect.Union (zoomRect, pointRect);
         *
         *  overviewRegion = MKCoordinateRegion.FromMapRect (zoomRect);
         *  overviewRegion.Span.LatitudeDelta += 0.05;
         *  overviewRegion.Span.LongitudeDelta += 0.05;
         *
         *              StepAnnotation annotationSoure = new StepAnnotation ();
         *              annotationSoure.SetCoordinate (new CLLocationCoordinate2D (sourceLat, sourceLng));
         *              mapView.AddAnnotation (annotationSoure);
         *
         *              MKPointAnnotation annotationDest = new MKPointAnnotation ();
         *              annotationDest.SetCoordinate (new CLLocationCoordinate2D (destinationLat, destinationLng));
         *              mapView.AddAnnotation (annotationDest);
         *
         *              destinationAnnotation = annotationDest;
         *
         *  mapView.SetRegion (overviewRegion, true);
         *
         *  isShowRoute = true;
         *      }*/

        private async void FindRouteAndDrawRoute(double destinationLat, double destinationLng, DirectionsMode directionsMode = DirectionsMode.Driving)
        {
            if (CLLocationManager.Status == CLAuthorizationStatus.NotDetermined || CLLocationManager.Status == CLAuthorizationStatus.Denied)
            {
                return;
            }

            //get current location
            Geolocator locator = new Geolocator()
            {
                DesiredAccuracy = 100
            };
            var location = await locator.GetPositionAsync(50000);

            Console.WriteLine("Position Status: {0}", location.Timestamp);
            Console.WriteLine("Position Latitude: {0}", location.Latitude);
            Console.WriteLine("Position Longitude: {0}", location.Longitude);

            var sourceLat = location.Latitude;
            var sourceLng = location.Longitude;

            MKPlacemark source     = new MKPlacemark(new CLLocationCoordinate2D(sourceLat, sourceLng), new NSDictionary());
            MKMapItem   sourceItem = new MKMapItem(source);

            desCoordinate = new CLLocationCoordinate2D(destinationLat, destinationLng);
            MKPlacemark destination     = new MKPlacemark(new CLLocationCoordinate2D(destinationLat, destinationLng), new NSDictionary());
            MKMapItem   destinationItem = new MKMapItem(destination);

            MKDirectionsRequest request = new MKDirectionsRequest();

            request.Source        = sourceItem;
            request.Destination   = destinationItem;
            request.TransportType = directionsMode == DirectionsMode.Driving ? MKDirectionsTransportType.Automobile : MKDirectionsTransportType.Walking;

            MKDirections direction = new MKDirections(request);

            direction.CalculateDirections(delegate(MKDirectionsResponse response, NSError error) {
                if (error == null)
                {
                    //remove all routes that has been drawn on map
                    if (mapView.Overlays != null && mapView.Overlays.Length != 0)
                    {
                        foreach (var overlay in mapView.Overlays)
                        {
                            mapView.RemoveOverlay(overlay);
                        }
                    }

                    //check if have route
                    if (response.Routes.Length == 0)
                    {
                        Mvx.Resolve <IMvxMessenger> ().Publish(new ToastMessage(this.ViewModel, "Cannot find the route"));
                    }

                    //add new route
                    foreach (var route in response.Routes)
                    {
                        MKPolyline polyline = route.Polyline;
                        mapView.AddOverlay(polyline);

                        ViewModel.TotalDistance = route.Distance;
                        ViewModel.ExpectedTime  = TimeSpan.FromSeconds(route.ExpectedTravelTime);

                        foreach (var step in route.Steps)
                        {
                            ViewModel.Routes.Add(new FlexyPark.Core.Models.RouteItem()
                            {
                                Instruction = step.Instructions,
                                Distance    = step.Distance,
                                Long        = step.Polyline.Coordinate.Longitude,
                                Lat         = step.Polyline.Coordinate.Latitude
                            });

                            Console.WriteLine(step.Instructions);
                            Console.WriteLine(step.Distance);
                        }
                        break;
                    }
                }
                else
                {
                    Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this.ViewModel, error.LocalizedDescription));
                }
            });

            MKMapPoint userPoint = MKMapPoint.FromCoordinate(new CLLocationCoordinate2D(sourceLat, sourceLng));
            MKMapRect  zoomRect  = new MKMapRect(userPoint.X, userPoint.Y, 0.1, 0.1);

            MKMapPoint annotationPoint = MKMapPoint.FromCoordinate(new CLLocationCoordinate2D(destinationLat, destinationLng));
            MKMapRect  pointRect       = new MKMapRect(annotationPoint.X, annotationPoint.Y, 0.1, 0.1);

            zoomRect = MKMapRect.Union(zoomRect, pointRect);

            overviewRegion = MKCoordinateRegion.FromMapRect(zoomRect);
            overviewRegion.Span.LatitudeDelta  += 0.05;
            overviewRegion.Span.LongitudeDelta += 0.05;

            StepAnnotation annotationSoure = new StepAnnotation();

            annotationSoure.SetCoordinate(new CLLocationCoordinate2D(sourceLat, sourceLng));
            mapView.AddAnnotation(annotationSoure);

            MKPointAnnotation annotationDest = new MKPointAnnotation();

            annotationDest.SetCoordinate(new CLLocationCoordinate2D(destinationLat, destinationLng));
            mapView.AddAnnotation(annotationDest);

            destinationAnnotation = annotationDest;

            mapView.SetRegion(overviewRegion, true);

            isShowRoute = true;
        }