Beispiel #1
0
        void SetupZoomOutButton()
        {
            Button zoomOutButton = FindViewById <Button>(Resource.Id.zoomOutButton);

            zoomOutButton.Click += (sender, e) =>
            {
                _map.AnimateCamera(CameraUpdateFactory.ZoomOut());
            };
        }
Beispiel #2
0
        public void OnZoomOut(View view)
        {
            if (!CheckReady())
            {
                return;
            }

            ChangeCamera(CameraUpdateFactory.ZoomOut());
        }
Beispiel #3
0
    protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);
        var element = Element as MapWithMyZoomControl;

        if (e.PropertyName == "MyZoom" && map != null)
        {
            if (element.MyZoom == MapWithMyZoomControl.ZoomState.zoomin)
            {
                map.AnimateCamera(CameraUpdateFactory.ZoomIn());
            }
            else if (element.MyZoom == MapWithMyZoomControl.ZoomState.zoomout)
            {
                map.AnimateCamera(CameraUpdateFactory.ZoomOut());
            }
            element.MyZoom = MapWithMyZoomControl.ZoomState.normal;
        }
    }
Beispiel #4
0
        public void OnMapReady(GoogleMap googleMap)
        {
            this.googleMap                   = googleMap;
            this.googleMap.MapType           = GoogleMap.MapTypeNormal;
            this.googleMap.MyLocationEnabled = true;

            this.googleMap.UiSettings.CompassEnabled          = true;
            this.googleMap.UiSettings.MyLocationButtonEnabled = true;
            this.googleMap.UiSettings.ZoomControlsEnabled     = true;
            //this.googleMap.UiSettings.SetAllGesturesEnabled(true);

            this.googleMap.AddMarker(new MarkerOptions().SetPosition(LOCATION_NEWYORK));
            this.googleMap.AddMarker(new MarkerOptions().SetPosition(LOCATION_XAMARIN)
                                     .SetTitle("Xamarin HQ")
                                     .SetSnippet("Where the magic happen")
                                     .SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.Icon)));
            markerChicago = this.googleMap.AddMarker(new MarkerOptions().SetPosition(LOCATION_CHICAGO)
                                                     .SetTitle("Chicago")
                                                     .Draggable(true)
                                                     .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow)));
            markerDallas = this.googleMap.AddMarker(new MarkerOptions().SetPosition(LOCATION_DALLAS)
                                                    .SetTitle("Dallas")
                                                    .SetSnippet("This is the marker for Dallas")
                                                    .InfoWindowAnchor(1, 1)
                                                    .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue)));
            markerSeatle = this.googleMap.AddMarker(new MarkerOptions().SetPosition(LOCATION_SEATLE)
                                                    .SetTitle("Seatle")
                                                    .SetSnippet("Yeah, Seatle!!!")
                                                    .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueAzure)));

            this.googleMap.MarkerClick     += MarkerClick;
            this.googleMap.InfoWindowClick += InfoWindowClick;
            this.googleMap.MapClick        += MapClick;
            this.googleMap.MapLongClick    += (sender, e) =>
            {
                this.googleMap.AnimateCamera(CameraUpdateFactory.ZoomOut(), 1000, null);
            };


            CameraUpdate cameraUpdate = CameraUpdateFactory.NewLatLngZoom
                                            (LOCATION_SEATLE, this.googleMap.MaxZoomLevel);

            this.googleMap.MoveCamera(cameraUpdate);
        }
Beispiel #5
0
        public async void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;

            map.MapType = GoogleMap.MapTypeNormal;

            map.AddMarker(new MarkerOptions().SetPosition(Location_NewYork));

            map.AddMarker(new MarkerOptions()
                          .SetPosition(Location_Xamarin)
                          .SetTitle("Xamarin HQ")
                          .SetSnippet("Where the magic happens")
                          .SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.xamarin_icon)));

            Marker chicagoMarker = map.AddMarker(new MarkerOptions()
                                                 .SetPosition(Location_Chicago)
                                                 .SetTitle("Chicago")
                                                 .Draggable(true)
                                                 .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow)));

            Marker dallasMarker = map.AddMarker(new MarkerOptions()
                                                .SetPosition(Location_Dallas)
                                                .SetTitle("Dallas")
                                                .SetSnippet("Go Cowboys!")
                                                .InfoWindowAnchor(1, 0)
                                                .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue)));

            map.MarkerClick += delegate(object sender, GoogleMap.MarkerClickEventArgs e) {
                if (e.Marker.Equals(dallasMarker))
                {
                    dallasMarker.Flat = !dallasMarker.Flat;
                    dallasMarker.ShowInfoWindow();
                }
                else
                {
                    // Execute default behavior for other markers.
                    // Could also just execute the following line for every
                    // marker.
                    e.Handled = false;
                }
            };
            map.InfoWindowClick += (sender, e) =>
            {
                if (e.Marker.Id == chicagoMarker.Id)
                {
                    e.Marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRose));
                }
            };
            map.MapClick += (sender, e) =>
            {
                if (!chicagoMarker.IsInfoWindowShown)
                {
                    chicagoMarker.SetIcon(BitmapDescriptorFactory
                                          .DefaultMarker(BitmapDescriptorFactory.HueYellow));
                }
            };

            CameraUpdate update = CameraUpdateFactory.NewLatLngZoom(Location_Xamarin, map.MaxZoomLevel);

            map.MoveCamera(update);

            map.MapLongClick += (sender, e) => map.AnimateCamera(CameraUpdateFactory.ZoomOut(), 1000, null);

            var hasLocationPermissions = await getLocationPermissionsAsync;

            map.MyLocationEnabled = hasLocationPermissions;
        }
Beispiel #6
0
 private void BtnZoomOut_Click(object sender, EventArgs e)
 {
     this.Map.MoveCamera(CameraUpdateFactory.ZoomOut());
 }
Beispiel #7
0
        public void OnMapReady(GoogleMap map)
        {
            googleMap = map;

            googleMap.MapType                            = GoogleMap.MapTypeNormal;
            googleMap.MyLocationEnabled                  = false;
            googleMap.UiSettings.CompassEnabled          = true;
            googleMap.UiSettings.MyLocationButtonEnabled = true;
            googleMap.UiSettings.ZoomControlsEnabled     = true;
            googleMap.UiSettings.SetAllGesturesEnabled(true);

            googleMap.Clear();
            var tab = db.selectTablePoints();

            if (tab.Count() > 0)
            {
                foreach (var s in tab)
                {
                    LatLng           latlng = new LatLng(s.Lat, s.Long);
                    BitmapDescriptor color;

                    switch (s.Color)
                    {
                    case "Czerwony":
                        color = BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed);
                        break;

                    case "Niebieski":
                        color = BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueBlue);
                        break;

                    case "Zółty":
                        color = BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow);
                        break;

                    case "Zielony":
                        color = BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen);
                        break;

                    case "Pomarańczowy":
                        color = BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueOrange);
                        break;

                    case "Fioletowy":
                        color = BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueViolet);
                        break;

                    default:
                        color = BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow);
                        break;
                    }

                    googleMap.AddMarker(new MarkerOptions()
                                        .SetPosition(latlng)
                                        .SetTitle(s.Name)
                                        .SetSnippet(s.Description)
                                        .SetIcon(color));
                }
            }

            Marker rynek = googleMap.AddMarker(new MarkerOptions()
                                               .SetPosition(Location_Start)
                                               .SetTitle("Nowy Sącz")
                                               .Draggable(true)
                                               .SetSnippet("Rynek")
                                               .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow)));

            googleMap.MapLongClick += (sender, e) =>
                                      googleMap.AnimateCamera(CameraUpdateFactory.ZoomOut(), 1000, null);

            CameraUpdate update = CameraUpdateFactory.NewLatLngZoom(Location_Start, 13);

            googleMap.MoveCamera(update);
        }
Beispiel #8
0
 private void ZoomOutMap(object sender, EventArgs e)
 {
     mainMap.AnimateCamera(CameraUpdateFactory.ZoomOut());
 }