Exemplo n.º 1
0
        // Implement OnMapReady
        public void OnMapReady(GoogleMap mMap)
        {
            googleMap = mMap;

            //Custom style voor de Google Map instellen
            try
            {
                bool success = googleMap.SetMapStyle(
                    MapStyleOptions.LoadRawResourceStyle(
                        Activity, Resource.Raw.style_json));

                if (!success)
                {
                    Log.Info("Error", "Style parsing failed.");
                }
            }
            catch (Resources.NotFoundException e)
            {
                Log.Info("Error", "Can't find style. Error: ");
            }

            //UIcontrols Google Map instellen
            googleMap.MyLocationEnabled         = true;
            googleMap.UiSettings.CompassEnabled = true;
            googleMap.SetPadding(0, 500, 0, 0);
        }
Exemplo n.º 2
0
        public void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;

            bool success = map.SetMapStyle(
                MapStyleOptions.LoadRawResourceStyle(
                    this, Resource.Raw.style_json));


            LatLng latLng = new LatLng(location.Latitude, location.Longitude);

            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(latLng);
            builder.Zoom(18);
            builder.Bearing(0);
            builder.Tilt(0);
            CameraPosition cameraPosition = builder.Build();
            CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            map.MoveCamera(cameraUpdate);
            map.SetOnMarkerClickListener(this);
            mapClickListener = new MapClickListener(this);
            map.SetOnMapClickListener(mapClickListener);
            map.SetOnMarkerClickListener(this);

            playerRegion = CalculateRegion((decimal)location.Latitude, (decimal)location.Longitude);
            Spawner spawner = new Spawner(map, location.Latitude, location.Longitude, 5, 5, 100);
            //mapObjectManager.CreateTestObject(playerRegion);
            //mapObjectManager.GetMapObjects(map, playerRegion, null);
        }
Exemplo n.º 3
0
        public void OnMapReady(GoogleMap googleMap)
        {
            this.map = googleMap;
            MapsInitializer.Initialize(Activity.ApplicationContext);
            clusterManager          = new ClusterManager(Context, map);
            clusterManager.Renderer = new MoyeuClusterRenderer(Context, map, clusterManager);
            map.SetOnCameraIdleListener(clusterManager);

            // Default map initialization
            if (ContextCompat.CheckSelfPermission(Activity, Android.Manifest.Permission.AccessFineLocation) == Permission.Granted)
            {
                googleMap.MyLocationEnabled = true;
            }
            googleMap.UiSettings.MyLocationButtonEnabled = false;

            googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(Context, Resource.Raw.GMapStyle));

            googleMap.MarkerClick += HandleMarkerClick;
            googleMap.MapClick    += HandleMapClick;
            var oldPosition = PreviousCameraPosition;

            if (oldPosition != null)
            {
                googleMap.MoveCamera(CameraUpdateFactory.NewCameraPosition(oldPosition));
            }
        }
Exemplo n.º 4
0
        public void OnMapReady(GoogleMap googleMap)
        {
            GMap = googleMap;
            GMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.style_json));
            GMap.UiSettings.ZoomControlsEnabled = true;

            List <MarkerOptions> markers    = new List <MarkerOptions>();
            MarkerOptions        userMarker = new MarkerOptions().SetPosition(new LatLng(-36.852392, 174.764473)).SetTitle("Map").SetIcon(BitmapDescriptorFactory.FromResource(Resource.Drawable.mapMan));

            GMap.AddMarker(userMarker);

            CameraUpdate camera = CameraUpdateFactory.NewLatLngZoom(new LatLng(-36.852392, 174.764473), 15);

            GMap.MoveCamera(camera);

            GMap.MyLocationChange += (s, e) =>
            {
                LatLng currentLatLng = userLocation.GetUserPosition();
                Console.WriteLine("New user location = " + currentLatLng);
            };
            markers = GenerateMarkers();
            PlaceMarkers(markers);

            ImageButton backButton = FindViewById <ImageButton>(Resource.Id.mapBackButton);

            backButton.SetImageResource(Resource.Drawable.IconBackArrow);
            backButton.Click += (s, e) =>
            {
                GMap = null;
                Finish();
            };
        }
Exemplo n.º 5
0
        protected override void OnMapReady(GoogleMap map)
        {
            base.OnMapReady(map);

            NativeMap.UiSettings.ZoomControlsEnabled = !customMap.IsReadOnly;
            NativeMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(Context, Resource.Raw.map));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Ons the map ready.
        /// </summary>
        /// <param name="googleMap">Google map.</param>
        public void OnMapReady(GoogleMap googleMap)
        {
            map = googleMap;
            ApliClientBuild();
            if (map != null)
            {
                LatLng location;
                map.MyLocationEnabled = true;
                var horaActual = DateTime.Now.Hour;
                if (horaActual <= 6)
                {
                    //GoogleMap noche
                    map.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this.Activity, Resource.Raw.googlemap_style_json_noche));
                }
                else if (horaActual >= 20)
                {
                    //GoogleMap noche
                    map.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this.Activity, Resource.Raw.googlemap_style_json_noche));
                }
                else
                {
                    //GoogleMap dia
                    map.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this.Activity, Resource.Raw.googlemap_style_json));
                }

                if (DataManager.actualLatitud != null)
                {
                    var lat      = DataManager.actualLatitud.Replace("\r", "").Replace(',', '.');
                    var lon      = DataManager.actualLongitud.Replace("\r", "").Replace(',', '.');
                    var latitude = double.Parse(lat, System.Globalization.CultureInfo.InvariantCulture);
                    var longitud = double.Parse(lon, System.Globalization.CultureInfo.InvariantCulture);
                    location = new LatLng(latitude, longitud);

                    map.MyLocationButtonClick += delegate
                    {
                        map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(location, 14.0f));
                    };
                }
                else
                {
                    //si no puede obtener mis corrdenadas gps
                    location = new LatLng(-33.53058, -70.674187);
                    map.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(location, 14.0f));
                }
                map.MoveCamera(CameraUpdateFactory.NewLatLng(location));
                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(location);
                builder.Zoom(15);
                builder.Bearing(0);
                CameraPosition cameraPosition = builder.Build();
                CameraUpdate   cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                map.MoveCamera(cameraUpdate);
                map.SetOnMarkerClickListener(this);
            }
            else
            {
                Toast.MakeText(Activity, "No se ha podido cargar el mapa", ToastLength.Short).Show();
            }
        }
Exemplo n.º 7
0
 public void OnMapReady(GoogleMap googleMap)
 {
     // Example code for map style: https://developers.google.com/maps/documentation/android-api/styling
     googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.style_json));
     mMap = googleMap;
     mMap.UiSettings.ZoomControlsEnabled = true;
     mMap.SetOnCameraIdleListener(this);
 }
Exemplo n.º 8
0
        public void OnMapReady(GoogleMap googleMap)
        {
            bool success = googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(Activity, Resource.Raw.retromapstyle));

            mainMap             = googleMap;
            mainMap.CameraIdle += MainMap_CameraIdle;
            string mapkey = Resources.GetString(Resource.String.map_key);

            mapHelper = new MapFunctionHelper(mapkey, mainMap);
        }
Exemplo n.º 9
0
        public void OnMapReady(GoogleMap googleMap)
        {
            bool success = googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.mapStyle));

            mainMap             = googleMap;
            mainMap.CameraIdle += MainMap_CameraIdle;
            string mapKey = Resources.GetString(Resource.String.mapApiKey);

            mapFunctionHelper = new MapFunctionHelper(mapKey);
        }
        public async void OnMapReady(GoogleMap googleMap)
        {
            try
            {
                var latLng = await GetLocationFromAddress(EventData.Location);

                if (latLng != null)
                {
                    CurrentLatitude  = latLng.Latitude;
                    CurrentLongitude = latLng.Longitude;
                }

                Map = googleMap;

                //Optional
                googleMap.UiSettings.ZoomControlsEnabled = false;
                googleMap.UiSettings.CompassEnabled      = false;

                googleMap.MoveCamera(CameraUpdateFactory.ZoomIn());

                var makerOptions = new MarkerOptions();
                makerOptions.SetPosition(new LatLng(CurrentLatitude, CurrentLongitude));
                makerOptions.SetTitle(GetText(Resource.String.Lbl_EventPlace));

                Map.AddMarker(makerOptions);
                Map.MapType = GoogleMap.MapTypeNormal;

                switch (AppSettings.SetTabDarkTheme)
                {
                case true:
                {
                    MapStyleOptions style = MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.map_dark);
                    Map.SetMapStyle(style);
                    break;
                }
                }

                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(new LatLng(CurrentLatitude, CurrentLongitude));
                builder.Zoom(10);
                builder.Bearing(155);
                builder.Tilt(65);

                CameraPosition cameraPosition = builder.Build();

                CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                googleMap.MoveCamera(cameraUpdate);

                Map.MapClick += MapOnMapClick;
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemplo n.º 11
0
 protected override void OnMapReady(GoogleMap map)
 {
     base.OnMapReady(map);
     NativeMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(context, Resource.Raw.map_style));
     NativeMap.InfoWindowClick += OnInfoWindowClick;
     // NativeMap.MyLocationEnabled = true;
     NativeMap.UiSettings.CompassEnabled      = true;
     NativeMap.UiSettings.ZoomControlsEnabled = false;
     NativeMap.SetInfoWindowAdapter(this);
     NativeMap.UiSettings.MyLocationButtonEnabled = true;
 }
Exemplo n.º 12
0
        public void OnMapReady(HuaweiMap map)
        {
            hMap = map;
            hMap.UiSettings.CompassEnabled          = true;
            hMap.UiSettings.MyLocationButtonEnabled = true;
            hMap.MapType = HuaweiMap.MapTypeNormal;
            hMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(48.893478, 2.334595), 10));

            StreamReader strm     = new StreamReader(Assets.Open("mapstyle_greeen.json"));
            string       response = strm.ReadToEnd();
            var          isLoad   = hMap.SetMapStyle(MapStyleOptions.LoadAssetResouceStyle(response));
        }
Exemplo n.º 13
0
        public void OnMapReady(GoogleMap googleMap)
        {
            var mapStyle = MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.mapstyle);

            googleMap.SetMapStyle(mapStyle);
            map = googleMap;
            map.UiSettings.ZoomControlsEnabled = true;
            if (CheckPermissions())
            {
                DisplayLocation();
            }
        }
Exemplo n.º 14
0
        public void OnMapReady(GoogleMap map)
        {
            googleMap = map;
            googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.mapStyle));

            AddMarkersToMap();

            googleMap.SetInfoWindowAdapter(new CustomInfoWindowAdapter(this));

            if (this.PerformRuntimePermissionCheckForLocation(REQUEST_PERMISSIONS_LOCATION))
            {
                InitializeUiSettingsOnMap();
            }
        }
        public void OnMapReady(GoogleMap googleMap)
        {
            try
            {
                bool success = googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.MymapStyle));
            }
            catch (System.Exception)
            {
            }
            mainMap = googleMap;

            mainMap.CameraIdle += MainMap_CameraIdle;
            //string mapkey = Resources.GetString(Resource.String.MapKey);
            //mapHelper = new MapFunctionHelper(mapkey, mainMap);
        }
Exemplo n.º 16
0
        public void OnMapReady(GoogleMap map)
        {
            _googleMap = map;

            _googleMap.UiSettings.ZoomControlsEnabled = true;
            _googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.mymapstyle));

            if (_selectedPlaceCategory != null)
            {
                AddMarkers(_selectedPlaceCategory);
            }
            AddUserMarker(_userLatLng);
            UpdateCamera(_selectedPlaceLatLng);

            _googleMap.InfoWindowClick += GoogleMap_InfoWindowClick;
        }
Exemplo n.º 17
0
 /// <summary>
 /// Метод,предназначенный для смены стиля карты.
 /// </summary>
 /// <param name="IDstyle">Идентификатор стиля</param>
 private void SetNewMapStyle(int IDstyle)
 {
     try
     {
         // Изменение стиля карты.
         bool success = map.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, IDstyle));
         if (!success)
         {
             Log.Error("Error", "Style parsing failed.");
         }
     }
     catch (System.IO.FileNotFoundException e)
     {
         Log.Error("Error", e.Message);
     }
 }
Exemplo n.º 18
0
        protected override async void OnResume()
        {
            base.OnResume();


            if (CheckSelfPermission(Android.Manifest.Permission.AccessFineLocation) == Permission.Granted)
            {
                locMgr = GetSystemService(Context.LocationService) as LocationManager;
                RequestLocationUpdates();
            }
            if (CellHub.Connection.State != ConnectionState.Connected && CellHub.Connection.State != ConnectionState.Connecting)
            {
                await CellHub.Connection.Start();
            }

            if (mMap != null)
            {
                mMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, GameModel.MapStyle));
                mMap.Clear();

                var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
                SetActionBar(toolbar);
                toolbar.SetBackgroundColor(ColorCode.TeamColor(GameModel.Player.Team.ID));
            }

            OverlaysToDraw.Clear();
            GameModel.CellsInView.Clear();
            GameModel.Player.AntiMines.Clear();
            GameModel.Player.Mines.Clear();

            // Get fresh player data
            GameModel.Player.AntiMines = await Database.GetAntiMines(GameModel.Player.ID);

            GameModel.Player.Mines = await Database.GetMines(GameModel.Player.ID);

            if (initialCameraLatLng != null)
            {
                // Refresh stale cell data
                await DrawCellsInView();
            }
        }
Exemplo n.º 19
0
        public void OnMapReady(GoogleMap googleMap)
        {
            _map = googleMap;
            _map.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this.Activity, Resource.Raw.mapstyle1));
            _map.SetOnMarkerClickListener(this);
            try
            {
                _map.MyLocationEnabled = true;
            }
            catch
            {
            }

            SetupMapIfNeeded();
            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(new LatLng(StartLocationCall.UserLastLocation.Latitude, StartLocationCall.UserLastLocation.Longitude));
            builder.Zoom(50);
            builder.Bearing(155);
            builder.Tilt(65);
            CameraPosition cameraPosition = builder.Build();
        }
Exemplo n.º 20
0
        public void OnMapReady(GoogleMap googleMap)
        {
            _map = googleMap;
            _map.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.mapstyle1));

            try
            {
                _map.MyLocationEnabled = true;
            }
            catch
            {
            }

            SetupMapIfNeeded();
            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
            builder.Target(new LatLng(SecilenLokasyonn.lat, SecilenLokasyonn.lon));
            builder.Zoom(50);
            builder.Bearing(155);
            builder.Tilt(65);
            CameraPosition cameraPosition = builder.Build();
        }
Exemplo n.º 21
0
        public void OnMapReady(GoogleMap map)
        {
            // Set local maps
            googleMap = map;
            MapHandler.Init(map, DateTime.Now.ToString("dd/MM/yyyy").GetHashCode());

            map.CameraChange += Map_CameraChange;

            // Hide battle info when clicking on the map
            map.MapClick += (sender, args) =>
                            battleInfo.State = BottomSheetBehavior.StateHidden;

            // Disable scrolling
            if (!MainActivity.DebugMode)
            {
                googleMap.UiSettings.ScrollGesturesEnabled = false;
                googleMap.UiSettings.ZoomGesturesEnabled   = false;
            }

            // Set custom theme to map
            googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, MapTheme));

            // Get last known location or 0,0 if not known
            // TODO: If not known, show loading dialog
            var location = userLocation == null ? new LatLng(0, 0) : userLocation.ToLatLng();

            // Create player marker
            AddPlayer(location, 0);

            // Target player with initial zoom
            var position = CameraPosition.InvokeBuilder()
                           .Target(location)
                           .Zoom(17f)
                           .Build();

            // Move camera to player
            googleMap.MoveCamera(CameraUpdateFactory.NewCameraPosition(position));

            googleMap.SetOnMarkerClickListener(this);
        }
Exemplo n.º 22
0
        protected override void OnResume()
        {
            base.OnResume();

            MusicManager.Volume = preferences.MusicVolume / 100f;
            MusicManager.Resume();

            if (locationHandler != null)
            {
                locationHandler.LocationPriority = LocationRequest.PriorityHighAccuracy;

                // If background updating is disabled, start listening for locations again
                if (!preferences.BackgroundUpdates)
                {
                    locationHandler.Start();
                }
            }

            googleMap?.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, MapTheme));

            // Enable or disable fullscreen
            mainView.SystemUiVisibility = (StatusBarVisibility)(preferences.Fullscreen ? SystemUiFlags.HideNavigation | SystemUiFlags.ImmersiveSticky | SystemUiFlags.Fullscreen : 0);
        }
Exemplo n.º 23
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            try
            {
                StreamReader strm = new StreamReader(Assets.Open("mapstyle_light.json"));
                switch (item.ItemId)
                {
                case Resource.Id.navigation_map_1:
                    strm = new StreamReader(Assets.Open("mapstyle_light.json"));
                    break;

                case Resource.Id.navigation_map_2:
                    strm = new StreamReader(Assets.Open("mapstyle_night.json"));
                    break;

                default:
                    strm = new StreamReader(Assets.Open("mapstyle_light.json"));
                    break;
                }
                string response = strm.ReadToEnd();
                var    isLoad   = hMap.SetMapStyle(MapStyleOptions.LoadAssetResouceStyle(response));
                if (isLoad)
                {
                    return(true);
                }
                else
                {
                    Toast.MakeText(this, "Sorry, selected theme not loading right now", ToastLength.Long);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "Sorry, selected theme not loading right now", ToastLength.Long);
                return(false);
            }
        }
Exemplo n.º 24
0
        protected override void OnMapReady(GoogleMap map)
        {
            var bottom = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 8, Resources.DisplayMetrics);
            var left   = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 8, Resources.DisplayMetrics);
            var right  = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 8, Resources.DisplayMetrics);
            var top    = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 48, Resources.DisplayMetrics);

            map.SetPadding(left, top, right, bottom);
            map.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(Context, Resource.Raw.my_map_customization));
            map.InfoWindowClick += OnInfoWindowClick;
            map.SetInfoWindowAdapter(this);

//            var latLng = new LatLng(Communities.LagosLatitude, Communities.LagosLongitude);
//            CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
//            builder.Target(latLng);
//            builder.Zoom(15);
//            CameraPosition cameraPosition = builder.Build();
//            CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
//            map.MoveCamera(cameraUpdate);

            base.OnMapReady(map);
            MapReady?.Invoke(this);
            LocationAccessChanged(MainActivity.IsLocationAccessGranted);
            LocationSettingsChanged(MainActivity.IsLocationEnabled);
            NativeMap.UiSettings.ZoomControlsEnabled = false;

            var cuPolygonOptions = new PolygonOptions();

            cuPolygonOptions.InvokeStrokeColor(Android.Graphics.Color.Argb(255, 219, 62, 68));
            cuPolygonOptions.InvokeStrokeWidth(15.0f);
            foreach (Community cyclesCommunity in Communities.CyclesCommunities)
            {
                cyclesCommunity.PolygonCoordinates.ForEach(lng => { cuPolygonOptions.Add(lng); });
                NativeMap.AddPolygon(cuPolygonOptions).Tag = cyclesCommunity.ShortName;
            }
        }
Exemplo n.º 25
0
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            // For XAML Previewer or FormsGoogleMaps.Init not called.
            if (!FormsGoogleMaps.IsInitialized)
            {
                return;
            }

            if (e.PropertyName == Map.MapTypeProperty.PropertyName)
            {
                SetMapType();
                return;
            }

            if (e.PropertyName == Map.PaddingProperty.PropertyName)
            {
                SetPadding();
                return;
            }

            if (NativeMap == null)
            {
                return;
            }
            
            if(FormsGoogleMaps.ResourceId != 0)
            {   
                Map.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(Context, FormsGoogleMaps.ResourceId);
            }

            if (e.PropertyName == Map.IsShowingUserProperty.PropertyName)
            {
                UpdateIsShowingUser();
            }
            else if (e.PropertyName == Map.MyLocationEnabledProperty.PropertyName)
            {
                UpdateMyLocationEnabled();
            }
            else if (e.PropertyName == Map.HasScrollEnabledProperty.PropertyName)
            {
                UpdateHasScrollEnabled();
            }
            else if (e.PropertyName == Map.HasZoomEnabledProperty.PropertyName)
            {
                UpdateHasZoomEnabled();
            }
            else if (e.PropertyName == Map.HasRotationEnabledProperty.PropertyName)
            {
                UpdateHasRotationEnabled();
            }
            else if (e.PropertyName == Map.IsTrafficEnabledProperty.PropertyName)
            {
                UpdateIsTrafficEnabled();
            }
            else if (e.PropertyName == Map.IndoorEnabledProperty.PropertyName)
            {
                UpdateIndoorEnabled();
            }
            else if (e.PropertyName == Map.MapStyleProperty.PropertyName)
            {
                UpdateMapStyle();
            }

            foreach (var logic in _logics)
            {
                logic.OnMapPropertyChanged(e);
            }
        }
Exemplo n.º 26
0
        public void OnMapReady(GoogleMap googleMap)
        {
            try
            {
                bool isSuccess = googleMap.SetMapStyle(MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.custommap));
                if (!isSuccess)
                {
                    // Log.e(tag: "Error", Message: "Map Style");
                    Toast.MakeText(this, "Map", ToastLength.Long).Show();
                }
            }
            catch (Resources.NotFoundException ex)
            {
                ex.PrintStackTrace();
            }

            mMap = googleMap;
            LatLng myPosition        = new LatLng(26.8612, 80.9864);
            LatLng redCarPosition    = new LatLng(22.5811275, 88.4301834);
            LatLng SecondcarPosition = new LatLng(26.8622, 80.9874);

            // googleMap.SetMapStyle = maptypenormal;
            //   googleMap.SetMapStyle(GoogleMap.MapTypeNormal);
            //googleMap.setMyLocationEnabled(true);
            googleMap.MyLocationEnabled = true;
            googleMap.TrafficEnabled    = false;
            // googleMap.IsIndoorEnabled = true;

            // googleMap.IndoorEnabled=false;
            //  googleMap.SetIndoorEnabled = false;
            googleMap.BuildingsEnabled = false;
            googleMap.UiSettings.ZoomControlsEnabled = true;
            //MapStyleOptions mapStyleOptions = MapStyleOptions.LoadRawResourceStyle(this, Resource.raw.google_mapstyle);
            //mMap.SetMapStyle(mapStyleOptions);


            googleMap.MoveCamera(CameraUpdateFactory.NewLatLng(myPosition));

            googleMap.MoveCamera(CameraUpdateFactory.NewLatLng(SecondcarPosition));

            googleMap.MoveCamera(CameraUpdateFactory.NewCameraPosition(new CameraPosition.Builder()
                                                                       .Target(googleMap.CameraPosition.Target)
                                                                       .Zoom(15)
                                                                       .Bearing(30)
                                                                       .Tilt(45)
                                                                       .Build()));
            mMarkerIcon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.red2);

            mMarkerIcon1 = BitmapFactory.DecodeResource(Resources, Resource.Drawable.black1);

            //  mRedCarMarkerIcon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.black1);



            mCarMarker = googleMap.AddMarker(new MarkerOptions()
                                             .SetPosition(myPosition)
                                             .SetIcon(BitmapDescriptorFactory.FromBitmap(mMarkerIcon))
                                             .SetTitle("I'm First Car"));


            mSecondcarMarker = googleMap.AddMarker(new MarkerOptions()
                                                   .SetPosition(SecondcarPosition)
                                                   .SetIcon(BitmapDescriptorFactory.FromBitmap(mMarkerIcon1))
                                                   .SetTitle("I'm Second Car"));


            //myRedCarMarkar = googleMap.AddMarker(new MarkerOptions()
            //        .SetPosition(redCarPosition)
            //        .SetIcon(BitmapDescriptorFactory.FromBitmap(mRedCarMarkerIcon))
            //        .SetTitle("I'm Here"));



            googleMap.AnimateCamera(CameraUpdateFactory.NewLatLng(mCarMarker.Position));
            if (ActivityCompat.CheckSelfPermission(this, Android.Manifest.Permission.AccessFineLocation) != Android.Content.PM.Permission.Granted && ActivityCompat.CheckSelfPermission(this, Android.Manifest.Permission.AccessCoarseLocation) != Android.Content.PM.Permission.Granted)
            {
                return;
            }
            googleMap.MyLocationEnabled = true;
            System.Timers.Timer delay = new System.Timers.Timer();
            this.RunOnUiThread(() =>
            {
                animateCarMove(mCarMarker, mPathPolygonPoints[0], mPathPolygonPoints[1], MOVE_ANIMATION_DURATION);
            });


            googleMap.AnimateCamera(CameraUpdateFactory.NewLatLng(mSecondcarMarker.Position));
            if (ActivityCompat.CheckSelfPermission(this, Android.Manifest.Permission.AccessFineLocation) != Android.Content.PM.Permission.Granted && ActivityCompat.CheckSelfPermission(this, Android.Manifest.Permission.AccessCoarseLocation) != Android.Content.PM.Permission.Granted)
            {
                return;
            }


            this.RunOnUiThread(() =>
            {
                animateCarMove1(mSecondcarMarker, mPathPolygonPointsSecond[0], mPathPolygonPointsSecond[1], MOVE_ANIMATION_DURATION1);
            });
        }
        public void SetRetroStyle(View view)
        {
            MapStyleOptions styleOptions = MapStyleOptions.LoadRawResourceStyle(this, Resource.Drawable.mapstyle_retro_hms);

            hMap.SetMapStyle(styleOptions);
        }
        public void OnMapReady(GoogleMap googleMap)
        {
            try
            {
                Map = googleMap;

                var makerOptions = new MarkerOptions();
                makerOptions.SetPosition(new LatLng(Lat, Lng));
                makerOptions.SetTitle(GetText(Resource.String.Lbl_Location));

                Map.AddMarker(makerOptions);
                Map.MapType = GoogleMap.MapTypeNormal;

                if (AppSettings.SetTabDarkTheme)
                {
                    MapStyleOptions style = MapStyleOptions.LoadRawResourceStyle(this, Resource.Raw.map_dark);
                    Map.SetMapStyle(style);
                }

                //Optional
                googleMap.UiSettings.ZoomControlsEnabled = true;
                googleMap.UiSettings.CompassEnabled      = true;

                OnLocationChanged();

                googleMap.MoveCamera(CameraUpdateFactory.ZoomIn());

                LatLng location = new LatLng(Lat, Lng);

                CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                builder.Target(location);
                builder.Zoom(18);
                builder.Bearing(155);
                builder.Tilt(65);

                CameraPosition cameraPosition = builder.Build();

                CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition);
                googleMap.MoveCamera(cameraUpdate);

                googleMap.MapClick += async(sender, e) =>
                {
                    try
                    {
                        LatLng latLng      = e.Point;
                        var    tapTextView = "Tapped: Point=" + e.Point;
                        Console.WriteLine(tapTextView);

                        Lat = latLng.Latitude;
                        Lng = latLng.Longitude;

                        // Creating a marker
                        MarkerOptions markerOptions = new MarkerOptions();

                        // Setting the position for the marker
                        markerOptions.SetPosition(e.Point);

                        var addresses = await ReverseGeocodeCurrentLocation(latLng);

                        if (addresses != null)
                        {
                            DeviceAddress = addresses.GetAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
                            //string city = addresses.Locality;
                            //string state = addresses.AdminArea;
                            //string country = addresses.CountryName;
                            //string postalCode = addresses.PostalCode;
                            //string knownName = addresses.FeatureName; // Only if available else return NULL

                            // Setting the title for the marker.
                            // This will be displayed on taping the marker
                            markerOptions.SetTitle(DeviceAddress);
                        }

                        // Clears the previously touched position
                        googleMap.Clear();

                        // Animating to the touched position
                        googleMap.AnimateCamera(CameraUpdateFactory.NewLatLng(e.Point));

                        // Placing a marker on the touched position
                        googleMap.AddMarker(markerOptions);
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception);
                    }
                };

                googleMap.MapLongClick += (sender, e) =>
                {
                    try
                    {
                        var tapTextView = "Long Pressed: Point=" + e.Point;
                        Console.WriteLine(tapTextView);
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception);
                    }
                };

                googleMap.CameraChange += (sender, e) =>
                {
                    try
                    {
                        var cameraTextView = e.Position.ToString();
                        Console.WriteLine(cameraTextView);
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception);
                    }
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }