private void OnCameraPositionChanged(object sender, GMSCameraEventArgs args)
 {
     if (_previousZoomValue != _mapView.Camera.Zoom)
     {
         _previousZoomValue = _mapView.Camera.Zoom;
         this.RaiseZoomChangedEvent();
     }
 }
        private void Map_CameraPositionIdle(object sender, GMSCameraEventArgs e)
        {
            var mapTile = Element;

            if (!string.IsNullOrEmpty(mapTile.SelectedPinId))
            {
                mapTile.ShowPinDetailInfo(mapTile.SelectedPinId);
                mapTile.SelectedPinId = null;
            }
        }
Example #3
0
        void OnCameraPositionChanged(object sender, GMSCameraEventArgs e)
        {
            float maxZoom = Google.Maps.Constants.MaxZoomLevel;

            if (osmLayer.Map != null || ocmLayer.Map != null)
            {
                maxZoom = 17.3f;
            }

            if (e.Position.Zoom > maxZoom)
            {
                mapView.MoveCamera(CameraUpdate.ZoomToZoom(maxZoom));
            }
        }
Example #4
0
        void CameraPositionChanged(object sender, GMSCameraEventArgs mkMapViewChangeEventArgs)
        {
            if (Element == null)
            {
                return;
            }

            var mapModel  = (Map)Element;
            var mkMapView = (MapView)Control;

            var region = mkMapView.Projection.VisibleRegion;
            var minLat = Math.Min(Math.Min(Math.Min(region.NearLeft.Latitude, region.NearRight.Latitude), region.FarLeft.Latitude), region.FarRight.Latitude);
            var minLon = Math.Min(Math.Min(Math.Min(region.NearLeft.Longitude, region.NearRight.Longitude), region.FarLeft.Longitude), region.FarRight.Longitude);
            var maxLat = Math.Max(Math.Max(Math.Max(region.NearLeft.Latitude, region.NearRight.Latitude), region.FarLeft.Latitude), region.FarRight.Latitude);
            var maxLon = Math.Max(Math.Max(Math.Max(region.NearLeft.Longitude, region.NearRight.Longitude), region.FarLeft.Longitude), region.FarRight.Longitude);

            mapModel.VisibleRegion = new MapSpan(new Position((minLat + maxLat) / 2d, (minLon + maxLon) / 2d), maxLat - minLat, maxLon - minLon);
        }
Example #5
0
        void HandleCameraPositionChanged(object sender, GMSCameraEventArgs e)
        {
            if (e.Position.Zoom >= PINABLE_ZOOM_POSITION)
            {
                _isZoomedPositionOkToDropPin = true;

                var mapView = sender as MapView;

                var xamMarker = new Marker()
                {
                    Title    = "Xamarin HQ " + _counter++,
                    Snippet  = "Where the magic happens.",
                    Position = e.Position.Target,
                    Map      = mapView
                };

                mapView.SelectedMarker = xamMarker;
            }
        }
Example #6
0
        /// <summary>
        /// Handles the event where the map page is idle
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e2">E2.</param>
        async void MapPage_CameraPositionIdle(object sender, GMSCameraEventArgs e)
        {
            var mapView = View as MapView;

            var fr = mapView.Projection.VisibleRegion.FarRight;
            var nl = mapView.Projection.VisibleRegion.NearLeft;

            /*
             * Position information can be sent back tot he server:
             * e.Position.Bearing,
             * e.Position.Zoom,
             * e.Position.Target.Latitude,
             * e.Position.Target.Longitude,
             * fr.Longitude,
             * fr.Latitude,
             * nl.Longitude,
             * nl.Latitude,
             * e.Position.ViewingAngle
             */
        }
Example #7
0
        private void MapView_CameraPositionIdle(object sender, GMSCameraEventArgs e)
        {
            var visibleRegion = mapView.Projection.VisibleRegion;
            var bounds        = new CoordinateBounds(visibleRegion);

            lastCameraPosition = mapView.Camera.Target;
            lastCameraZoom     = mapView.Camera.Zoom;
            //ViewModel.CurrentBounds.Value = new GeoLocationBounds
            //{
            //    NorthEast = new MvxCoordinates
            //    {
            //        Longitude = bounds.NorthEast.Longitude,
            //        Latitude = bounds.NorthEast.Latitude
            //    },
            //    SouthWest = new MvxCoordinates
            //    {
            //        Longitude = bounds.SouthWest.Longitude,
            //        Latitude = bounds.SouthWest.Latitude
            //    }
            //};
        }
Example #8
0
 void CameraPositionChanged(object sender, GMSCameraEventArgs args)
 {
     OnCameraPositionChanged(args.Position);
 }
Example #9
0
 void NativeMap_CameraPositionIdle(object sender, GMSCameraEventArgs e)
 {
     _map.SendCameraIdled(e.Position.ToXamarinForms());
 }
Example #10
0
 void NativeMap_CameraPositionChanged(object sender, GMSCameraEventArgs e)
 {
     _map.SendCameraMoving(e.Position.ToXamarinForms());
 }
Example #11
0
		void OnCameraPositionChanged (object sender, GMSCameraEventArgs e)
		{
			float maxZoom = Google.Maps.Constants.MaxZoomLevel;

			if (osmLayer.Map != null || ocmLayer.Map != null)
				maxZoom = 17.3f;

			if (e.Position.Zoom > maxZoom)
				mapView.MoveCamera(CameraUpdate.ZoomToZoom(maxZoom));
		}
        void CameraPositionChanged(object sender, GMSCameraEventArgs mkMapViewChangeEventArgs)
        {
            if (Element == null)
                return;

            var mapModel = (Map)Element;
            var mkMapView = (MapView)Control;

            var region = mkMapView.Projection.VisibleRegion;
            var minLat = Math.Min(Math.Min(Math.Min(region.NearLeft.Latitude, region.NearRight.Latitude), region.FarLeft.Latitude), region.FarRight.Latitude);
            var minLon = Math.Min(Math.Min(Math.Min(region.NearLeft.Longitude, region.NearRight.Longitude), region.FarLeft.Longitude), region.FarRight.Longitude);
            var maxLat = Math.Max(Math.Max(Math.Max(region.NearLeft.Latitude, region.NearRight.Latitude), region.FarLeft.Latitude), region.FarRight.Latitude);
            var maxLon = Math.Max(Math.Max(Math.Max(region.NearLeft.Longitude, region.NearRight.Longitude), region.FarLeft.Longitude), region.FarRight.Longitude);
            mapModel.VisibleRegion = new MapSpan(new Position((minLat + maxLat) / 2d, (minLon + maxLon) / 2d), maxLat - minLat, maxLon - minLon);
        }