Ejemplo n.º 1
0
 public void UpdateZoom(float newZoom)
 {
     if (Camera.Zoom != newZoom)
     {
         MoveCamera(CameraUpdate.ZoomToZoom(newZoom));
     }
 }
Ejemplo n.º 2
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));
            }
        }
Ejemplo n.º 3
0
        protected override void OnElementChanged(ElementChangedEventArgs <TripMapView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement == null || e.OldElement != null)
            {
                return;
            }

            if (_control == null)
            {
                _control = new MapView
                {
                    MapStyle = MapStyle.FromJson(Constants.MapStyleJson, null),
                };

                _control.MoveCamera(CameraUpdate.ZoomToZoom(13));
            }

            SetNativeControl(_control);
        }
Ejemplo n.º 4
0
        public void cameraAutoZoomAndReposition(Event[] eventMarkers)
        {
            double minimumLongitudeInGoogle = 180.0f;
            double maximumLongitudeInGoogle = -180.0f;
            double minimumLatitudeInGoogle  = 90.0f;
            double maximumLatitudeInGoogle  = -90.0f;

            foreach (Event currentMarker in eventMarkers)
            {
                maximumLongitudeInGoogle = Math.Max(maximumLongitudeInGoogle, currentMarker.Location.Longitude);
                minimumLongitudeInGoogle = Math.Min(minimumLongitudeInGoogle, currentMarker.Location.Longitude);
                maximumLatitudeInGoogle  = Math.Max(maximumLatitudeInGoogle, currentMarker.Location.Latitude);
                minimumLatitudeInGoogle  = Math.Min(minimumLatitudeInGoogle, currentMarker.Location.Latitude);
            }
            CLLocationCoordinate2D northWestBound = new CLLocationCoordinate2D(maximumLatitudeInGoogle, minimumLongitudeInGoogle);
            CLLocationCoordinate2D southEastBound = new CLLocationCoordinate2D(minimumLatitudeInGoogle, maximumLongitudeInGoogle);

            mapView.MoveCamera(CameraUpdate.FitBounds(new CoordinateBounds(northWestBound, southEastBound)));
            float desiredZoomlevel = (float)(getZoomLevel(minimumLatitudeInGoogle, maximumLatitudeInGoogle, minimumLongitudeInGoogle, maximumLongitudeInGoogle, mapViewOutlet.Frame.Size.Width, mapViewOutlet.Frame.Size.Height));

            mapView.MoveCamera(CameraUpdate.ZoomToZoom(desiredZoomlevel));
        }
Ejemplo n.º 5
0
        protected override void OnElementChanged(ElementChangedEventArgs <TripsClusterMapView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement == null)
            {
                return;
            }

            if (e.OldElement != null)
            {
                var mapView = e.OldElement;
                mapView.Trips.CollectionChanged -= Trips_CollectionChanged;
            }

            var newMapView = e.NewElement;

            newMapView.Trips.CollectionChanged += Trips_CollectionChanged;
            if (_control == null)
            {
                _control = new MapView
                {
                    MapStyle = MapStyle.FromJson(Constants.MapStyleJson, null),
                };

                _control.MoveCamera(CameraUpdate.ZoomToZoom(0));
            }

            if (_clusterManager == null)
            {
                _clusterManager = new GMUClusterManager(_control,
                                                        new GMUNonHierarchicalDistanceBasedAlgorithm(),
                                                        new GMUDefaultClusterRenderer(_control, new GMUDefaultClusterIconGenerator()));
            }

            SetNativeControl(_control);
            GenerateClusters(newMapView);
        }