Example #1
0
        private void OnDidUpdateUserLocation(object sender, MKUserLocationEventArgs e)
        {
            var showUserLocation     = map.UserLocation != null && MapHelper.IsInWroclaw(map.UserLocation.Coordinate);
            var coordinatesToDisplay = showUserLocation ? map.UserLocation.Coordinate : MapHelper.WroclawCoordinates;

            map.SetRegion(MapHelper.CreateRegion(coordinatesToDisplay), true);
        }
Example #2
0
        private void NativeMapOnDidUpdateUserLocation(object sender, MKUserLocationEventArgs mkUserLocationEventArgs)
        {
            var location = mkUserLocationEventArgs.UserLocation.Location.Coordinate;

            var center = new CLLocationCoordinate2D(location.Latitude, location.Longitude);
            var region = new MKCoordinateRegion(center, new MKCoordinateSpan(0.01, 0.01));

            NativeControl.SetRegion(region, true);
        }
Example #3
0
 private void MapView_DidUpdateUserLocation(object sender, MKUserLocationEventArgs e)
 {
     if (!m_UserLocationInit)
     {
         m_UserLocationInit = true;
         var coordinateSpan   = new MKCoordinateSpan(0.01, 0.01);
         var coordinateRegion = new MKCoordinateRegion(mapView.UserLocation.Coordinate, coordinateSpan);
         mapView.SetRegion(coordinateRegion, false);
     }
 }
        void OnUserLocationUpdated(object sender, MKUserLocationEventArgs e)
        {
            if (centerOnUserRequested)
            {
                CenterOnUsersLocation(null, null);
                centerOnUserRequested = false;
            }

            CustomMapView.OnUserLocationUpdatedFromNative(new Xamarin.Forms.Maps.Position(e.UserLocation.Location.Coordinate.Longitude,
                                                                                          e.UserLocation.Location.Coordinate.Latitude));
        }
Example #5
0
        private void UserLocation(object sender, MKUserLocationEventArgs e)
        {
            MKMapView nativeMap = Control as MKMapView;
            // Create the camera
            MKMapCamera camera = new MKMapCamera
            {
                Pitch            = 80,
                CenterCoordinate = new CLLocationCoordinate2D(e.UserLocation.Location.Coordinate.Latitude, e.UserLocation.Location.Coordinate.Longitude),
                Altitude         = 100,
                Heading          = e.UserLocation.Heading.HeadingAccuracy,
            };

            nativeMap.SetCamera(camera, true);
        }
        /// <summary>
        /// Handles the DidUpdateUserLocation event of MKMapView.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="MKUserLocationEventArgs"/> with arguments of the event.</param>
        private void OnUpdateUserLocation(object sender, MKUserLocationEventArgs e)
        {
            // Report the new map coordinates
            if (e.UserLocation.Location != null)
            {
                // If accuracy is too high
                if (e.UserLocation.Location.HorizontalAccuracy >= 100)
                {
                    return;
                }

                // Update the user location
                var location = e.UserLocation.Location.Coordinate;
                ((MapEx)this.Element).UserPosition = new Position(location.Latitude, location.Longitude);
            }
        }
Example #7
0
		private void DidUpdateUserLocation (object sender, MKUserLocationEventArgs e)
		{
			if(e.UserLocation == null)
				return;

			behavior.UserLocation = new Position(
				e.UserLocation.Coordinate.Latitude,
				e.UserLocation.Coordinate.Longitude);

			// 暫定的にユーザー位置が初めて更新された時をロード完了として扱う
			if(isFirstTime)
			{
				isFirstTime = false;
				MapLoaded?.Invoke(behavior, new EventArgs());
			}
		}
        //add pin
        void OriginMapViewIcon_DidUpdateUserLocation1(object sender, MKUserLocationEventArgs e)
        {
            if (originMapViewIcon.UserLocation != null)
            {
                var coordinates = originMapViewIcon.UserLocation.Coordinate;
                var span        = new MKCoordinateSpan(0.15, 0.15);
                originMapViewIcon.Region = new MKCoordinateRegion(coordinates, span);

                //add title to the location
                originMapViewIcon.RemoveAnnotations();
                originMapViewIcon.AddAnnotation(new MKPointAnnotation()
                {
                    Coordinate = coordinates,
                    Title      = "Your location"
                });
            }
        }
        private void MapViewOnDidUpdateUserLocation(object sender, MKUserLocationEventArgs e)
        {
            if (e.UserLocation == null || _myMap == null || _mapView == null)
            {
                return;
            }

            var trackingMode = _myMap.CameraFollowsUser
                ? MKUserTrackingMode.FollowWithHeading
                : MKUserTrackingMode.None;

            if (_mapView.UserTrackingMode != trackingMode)
            {
                _mapView.SetUserTrackingMode(trackingMode, true);
            }

            Console.WriteLine($"ResearchMapRendererIos:DidUpdateUserLocation: {e.UserLocation.Coordinate}");
        }
Example #10
0
 /// <summary>
 /// Sets the user postion once.
 /// </summary>
 /// <param name="sender">Sender who fired the event.</param>
 /// <param name="e">Event Arguments.</param>
 protected void SetUserPostionOnce(object sender, MKUserLocationEventArgs e)
 {
     this.mapView.DidUpdateUserLocation -= this.SetUserPostionOnce;
     this.mapView.SetCenterCoordinate(e.UserLocation.Location.Coordinate, true);
 }
 void HandleDidUpdateUserLocation(object sender, MKUserLocationEventArgs e) => MapHelpers.MoveMapToLocation(sender as MKMapView, true);
Example #12
0
 /// <summary>
 /// Sets the user postion once.
 /// </summary>
 /// <param name="sender">Sender who fired the event.</param>
 /// <param name="e">Event Arguments.</param>
 protected void SetUserPostionOnce(object sender, MKUserLocationEventArgs e)
 {
     this.mapView.DidUpdateUserLocation -= this.SetUserPostionOnce;
     this.mapView.SetCenterCoordinate(e.UserLocation.Location.Coordinate, true);
 }