Ejemplo n.º 1
0
        protected override void inicializarComponente()
        {
            base.inicializarComponente();

            _map = new RadarMap
            {
                IsShowingUser   = true,
                HeightRequest   = 100,
                WidthRequest    = 960,
                VerticalOptions = LayoutOptions.FillAndExpand
            };
            _map.MapType = (PreferenciaUtils.ImagemSatelite) ? MapType.Hybrid : MapType.Street;
            AbsoluteLayout.SetLayoutBounds(_map, new Rectangle(0, 0, 1, 0.9));
            AbsoluteLayout.SetLayoutFlags(_map, AbsoluteLayoutFlags.All);
            _map.PropertyChanged += (sender, e) =>
            {
                Debug.WriteLine(e.PropertyName + " just changed!");
                if (e.PropertyName == "VisibleRegion" && _map.VisibleRegion != null)
                {
                    _map.atualizarAreaVisivel(_map.VisibleRegion);
                }
            };

            _velocidadeFundo = new BoxView {
                BackgroundColor = Color.White,
            };
            AbsoluteLayout.SetLayoutBounds(_velocidadeFundo, new Rectangle(0, 1, 1, 0.1));
            AbsoluteLayout.SetLayoutFlags(_velocidadeFundo, AbsoluteLayoutFlags.All);
            _velocidadeLabel = new Label
            {
                FontSize                = 30,
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                Text = "Parado"
            };
            AbsoluteLayout.SetLayoutBounds(_velocidadeLabel, new Rectangle(0, 1, 1, 0.1));
            AbsoluteLayout.SetLayoutFlags(_velocidadeLabel, AbsoluteLayoutFlags.All);
        }
Ejemplo n.º 2
0
 public void OnMapReady(GoogleMap googleMap)
 {
     map = googleMap;
     if (PreferenciaUtils.InfoTrafego)
     {
         googleMap.TrafficEnabled = true;
     }
     googleMap.UiSettings.SetAllGesturesEnabled(PreferenciaUtils.RotacionarMapa);
     //googleMap.UiSettings.RotateGesturesEnabled = PreferenciaUtils.RotacionarMapa;
     googleMap.UiSettings.MyLocationButtonEnabled = false;
     googleMap.UiSettings.ZoomControlsEnabled     = false;
     googleMap.UiSettings.MapToolbarEnabled       = false;
     map.CameraChange += (sender, e) => {
         animando = false;
         LatLng  c              = map.Projection.VisibleRegion.LatLngBounds.Center;
         LatLng  nordeste       = map.Projection.VisibleRegion.LatLngBounds.Northeast;
         LatLng  sudoeste       = map.Projection.VisibleRegion.LatLngBounds.Southwest;
         double  latitudeDelta  = Math.Abs(nordeste.Latitude - sudoeste.Latitude);
         double  longitudeDelta = Math.Abs(sudoeste.Longitude - nordeste.Longitude);
         MapSpan span           = new MapSpan(new Position(c.Latitude, c.Longitude), latitudeDelta, longitudeDelta);
         _radarMap.atualizarAreaVisivel(span);
     };
 }