async void OnGetDetails(object sender, GoogleMap.MapClickEventArgs e) { /* The Geocoder class is used to issue address queries to Google's servers, * and to receive a specific Address object */ Geocoder geocoder = new Geocoder(this); // Use the GetFromLocationAsync method to return a single result for the passed point in the MapClickedEventArgs. var results = await geocoder.GetFromLocationAsync(e.Point.Latitude, e.Point.Longitude, 1); /* If the method returns a value (check the returning array's count), then * take the resulting Address object and create a new Marker to display it on the map. */ if (results.Count > 0) { var result = results[0]; if (lastGeoMarker == null) { var markerOptions = new MarkerOptions() .SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueOrange)) .SetPosition(new LatLng(result.Latitude, result.Longitude)) .SetTitle(result.FeatureName) .SetSnippet(GetAddress(result)); lastGeoMarker = map.AddMarker(markerOptions); } else { lastGeoMarker.Position = new LatLng(result.Latitude, result.Longitude); lastGeoMarker.Title = result.FeatureName; lastGeoMarker.Snippet = GetAddress(result); } lastGeoMarker.ShowInfoWindow(); } }
/// <summary> /// When the map got tapped /// </summary> /// <param name="sender">Event Sender</param> /// <param name="e">Event Arguments</param> private void OnMapClick(object sender, GoogleMap.MapClickEventArgs e) { if (this.FormsMap == null || this.FormsMap.MapClickedCommand == null) { return; } var position = e.Point.ToPosition(); if (this.FormsMap.Routes != null && this.FormsMap.RouteClickedCommand != null) { foreach (var route in this.FormsMap.Routes.Where(i => i.Selectable)) { var internalRoute = this._routes[route]; if (GmsPolyUtil.IsLocationOnPath( position, internalRoute.Points.Select(i => i.ToPosition()), true, (int)this._googleMap.CameraPosition.Zoom, this.FormsMap.MapCenter.Latitude)) { this.MapFunctions.RaiseRouteClicked(route); return; } } } this.MapFunctions.RaiseMapClicked(position); }
private void MapClickEvent(GoogleMap.MapClickEventArgs e) { if (markerNumber != -1) { if (markers[markerNumber] == null) { markers[markerNumber] = map.AddMarker(mapClass.BuildMarker(new LatLng(e.Point.Latitude, e.Point.Longitude))); } else { markers[markerNumber].Position = new LatLng(e.Point.Latitude, e.Point.Longitude); } if (markerNumber == 0) { setPlayArea.vertices[0].Latitude = e.Point.Latitude; setPlayArea.vertices[0].Longitude = e.Point.Longitude; } else { setPlayArea.vertices[2].Latitude = e.Point.Latitude; setPlayArea.vertices[2].Longitude = e.Point.Longitude; } if (markers[0] != null && markers[1] != null) { setPlayArea.vertices[1].Latitude = setPlayArea.vertices[0].Latitude; setPlayArea.vertices[1].Longitude = setPlayArea.vertices[2].Longitude; setPlayArea.vertices[3].Latitude = setPlayArea.vertices[2].Latitude; setPlayArea.vertices[3].Longitude = setPlayArea.vertices[0].Longitude; mapClass.SetPolygon(setPlayArea.vertices); } } }
async void OnGetDetails(object sender, GoogleMap.MapClickEventArgs e) { var geocoder = new Geocoder(this); var results = await geocoder.GetFromLocationAsync(e.Point.Latitude, e.Point.Longitude, 1); if (results.Count > 0) { var result = results[0]; if (lastGeoMarker == null) { var markerOptions = new MarkerOptions() .SetIcon(BitmapDescriptorFactory.DefaultMarker( BitmapDescriptorFactory.HueOrange)) .SetPosition(new LatLng(result.Latitude, result.Longitude)) .SetTitle(result.FeatureName) .SetSnippet(GetAddress(result)); lastGeoMarker = map.AddMarker(markerOptions); } else { lastGeoMarker.Position = new LatLng(result.Latitude, result.Longitude); lastGeoMarker.Title = result.FeatureName; lastGeoMarker.Snippet = GetAddress(result); } lastGeoMarker.ShowInfoWindow(); } }
private void _map_MapClick(object sender, GoogleMap.MapClickEventArgs e) { foreach (Polyline path in PathList) { path.Color = Color.Black; } }
private void Map_MapClick(object sender, GoogleMap.MapClickEventArgs e) { Xamarin.Forms.MessagingCenter.Send <MapSelectNewPointMessage>(new MapSelectNewPointMessage() { Latitude = e.Point.Latitude, Longitude = e.Point.Longitude }, string.Empty); }
private void GoogleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { if (!taskData.UserLocationOnly) { if (CanPlaceMarkers()) { Map_Location selected = new Map_Location( e.Point.Latitude, e.Point.Longitude, GMap.CameraPosition.Zoom); AddMarker(selected); } else { string maxMessage = string.Format(Resources.GetString(Resource.String.ChosenMaxLocations), taskData.MaxNumMarkers, (taskData.MaxNumMarkers > 1) ? "s" : ""); Toast.MakeText(this, maxMessage, ToastLength.Long).Show(); } } else if (CanPlaceMarkers()) { Toast.MakeText(this, Resources.GetString(Resource.String.UserLocationOnly), ToastLength.Short).Show(); } }
private void OnMapClick(object sender, GoogleMap.MapClickEventArgs e) { if (polyline != null) { polyline.Remove(); } }
private void MapClick(object sender, GoogleMap.MapClickEventArgs e) { if (!markerChicago.IsInfoWindowShown) { markerChicago.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueYellow)); } }
async void googleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { //((MapTapRenderer)Element).OnTap(new Xamarin.Forms.Maps.Position(e.Point.Latitude, e.Point.Longitude)); await((MapTapRenderer)Element).ChangePosition(new Xamarin.Forms.Maps.Position(e.Point.Latitude, e.Point.Longitude)); SetMarker(e.Point.Latitude, e.Point.Longitude); }
private void Maps_MapClick(object sender, GoogleMap.MapClickEventArgs e) { var position = e.Point; LatLng locationMarker = new LatLng(position.Latitude, position.Longitude); Marker marker = maps.AddMarker(new MarkerOptions().SetTitle("Your Pinned Location").SetSnippet($"Latitude{position.Latitude} Longitude").SetPosition(locationMarker).SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueMagenta))); marker.ShowInfoWindow(); }
private async void GoogleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { var intent = new Intent(this, typeof(EnterLocationFullscreenActivity)); intent.AddFlags(ActivityFlags.NoAnimation); intent.PutExtra(Latitude, _location.Latitude); intent.PutExtra(Longitude, _location.Longitude); StartActivityForResult(intent, 1); }
private void googleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { ((ExtMap)Element).OnTap(new Position(e.Point.Latitude, e.Point.Longitude)); var marker = new MarkerOptions(); _map.Clear(); marker.SetPosition(new LatLng(e.Point.Latitude, e.Point.Longitude)); marker.SetTitle("Selected Place"); _map.AddMarker(marker); }
void ClickingMap(object sender, GoogleMap.MapClickEventArgs e) { System.Diagnostics.Debug.WriteLine("Clicked on the map"); var marker = new MarkerOptions(); marker.Draggable(true); marker.SetPosition(new LatLng(e.Point.Latitude, e.Point.Longitude)); NativeMap.AddMarker(marker); }
private void GMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { Selected = new LocationHuntLocation(e.Point.Latitude, e.Point.Longitude, GMap.CameraPosition.Zoom, false); MarkerOptions opts = new MarkerOptions(); opts.SetPosition(new LatLng(Selected.Lat, Selected.Long)); GMap.Clear(); GMap.AddMarker(opts); }
private void Map_MapClick(object sender, GoogleMap.MapClickEventArgs e) { if (formsMap.ShowingPin != null && ((DBRepository.PartnerListModel)formsMap.ShowingPin.Data).Selected) { ((Marker)formsMap.ShowingPin.Marker).HideInfoWindow(); ((DBRepository.PartnerListModel)formsMap.ShowingPin.Data).Selected = false; formsMap.NotifyChangeShowingPin(); formsMap.OnShowingPinChanged(null); } }
private void MapOptionsClick(object sender, GoogleMap.MapClickEventArgs e) { _lalitude = e.Point.Latitude; _longitude = e.Point.Longitude; this.ViewModel.LalitudeMarker = _lalitude; this.ViewModel.LongitudeMarker = _longitude; _googleMap.Clear(); _latLng = new LatLng(_lalitude, _longitude); _marker = _googleMap.AddMarker(new MarkerOptions().SetPosition(_latLng)); _googleMap.AnimateCamera(CameraUpdateFactory.NewLatLngZoom(_latLng, _googleMap.CameraPosition.Zoom)); }
/// <summary> /// This attaches an event handler to the google map allowing the user to place a map on the page. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GoogleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { var formsMap = Element as CustomMap; /*TE: We do not want the user creating pins when they are just viewing events on the map*/ if (formsMap.SelectingLocation) { CreateLocationPin(e.Point.Latitude, e.Point.Longitude); } else { Console.WriteLine("You are not selecting a location!"); } }
private void MMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { int clickedCellID = Cell.FindID(e.Point); if (GameModel.CellsInView.ContainsKey(clickedCellID)) { Cell cell = GameModel.CellsInView[clickedCellID]; if (cell.MapOverlay.CellIsOnMap) { cell.MapOverlay.Click(this); } } }
private void MapOnMapClick(object sender, GoogleMap.MapClickEventArgs e) { try { // Create a Uri from an intent string. Use the result to create an Intent. var uri = Uri.Parse("geo:" + CurrentLatitude + "," + CurrentLongitude); var intent = new Intent(Intent.ActionView, uri); intent.SetPackage("com.google.android.apps.maps"); intent.AddFlags(ActivityFlags.NewTask); StartActivity(intent); } catch (Exception exception) { Console.WriteLine(exception); } }
private void GoogleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { ((OriginalCustomMap)Element).OnTap(new Position(e.Point.Latitude, e.Point.Longitude)); var addingPin = new CustomPin { Type = PinType.Place, Position = new Position(e.Point.Latitude, e.Point.Longitude), Address = " - need to possibly implement - ", Id = "shelter", Label = "shelter", Url = "http://www.redcross.org" }; Map.Pins.Add(addingPin); customPins.Add(addingPin); }
private void googleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { ((MyBaseMap)Element).OnTap(new Position(e.Point.Latitude, e.Point.Longitude)); // Borramos el anterior Pin _map.Clear(); var pinMarker = new MarkerOptions(); pinMarker.SetPosition(new LatLng(e.Point.Latitude, e.Point.Longitude)); pinMarker.SetTitle("Punto de encuentro :)"); pinMarker.DescribeContents(); setAdress(pinMarker, e); // Añado el pin al mapa _map.AddMarker(pinMarker).ShowInfoWindow(); }
private void GoogleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { GoogleMap googleMap = (GoogleMap)sender; _PosXMark = e.Point.Latitude; _PosYMark = e.Point.Longitude; if (_NovoPonto == null) { _NovoPonto = googleMap.AddMarker(new MarkerOptions().SetPosition(new LatLng(_PosXMark, _PosYMark))); } else { _NovoPonto.Remove(); _NovoPonto = googleMap.AddMarker(new MarkerOptions().SetPosition(new LatLng(_PosXMark, _PosYMark))); } Btn_AddPonto.Enabled = true; new PontosClass().CarregaPontosMapa(googleMap); }
void OnMapClick(object sender, GoogleMap.MapClickEventArgs e) { //Mensagem toast Toast.MakeText(this, "Nova Posição Salva: " + e.Point.Latitude.ToString() + ", " + e.Point.Longitude.ToString(), ToastLength.Short).Show(); //Atualiza a label com a última posição salva TextView text = FindViewById <TextView>(Resource.Id.textView1); text.Text = "Última Posição Salva: " + e.Point.Latitude.ToString() + ", " + e.Point.Longitude.ToString(); //Salva na base MapPosition pos = new MapPosition(e.Point.Latitude, e.Point.Longitude); Database.InsertData <MapPosition>(pos); text.Text = "Última Posição Salva: " + e.Point.Latitude.ToString() + ", " + e.Point.Longitude.ToString(); }
private void ClickOnMap(object sender, GoogleMap.MapClickEventArgs eventArgs) { using (var markerOption = new MarkerOptions()) { markerOption.SetPosition(eventArgs.Point); _marcerRow = new MapMarkerEntity { Latitude = markerOption.Position.Latitude, Longitude = markerOption.Position.Longitude }; ViewModel.SaveMarkerInList(_marcerRow); string title = $"{ViewModel.TaskId}"; markerOption.SetTitle(title); Marker marker = _map.AddMarker(markerOption); } }
void map_MapClick(object sender, GoogleMap.MapClickEventArgs e) { map.Clear(); latLngMarker.Latitude = e.Point.Latitude; latLngMarker.Longitude = e.Point.Longitude; distance = Location.CalculateDistance(latLngMarker.Latitude, latLngMarker.Longitude, latLngUser.Latitude, latLngUser.Longitude, DistanceUnits.Kilometers); if (distance <= 1) { marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueGreen)); circle.InvokeFillColor(Android.Graphics.Color.Green); marker.SetPosition(latLngMarker); circle.InvokeCenter(latLngMarker); map.AddMarker(marker); map.AddCircle(circle); async void SendMail() { List <string> to = new List <string>(); var message = new EmailMessage { Subject = "Point", Body = "User coordinates - " + latLngUser.Latitude + " " + latLngUser.Longitude + "\n" + "Marker coordinates - " + marker.Position.Latitude + " " + marker.Position.Longitude, To = to }; await Email.ComposeAsync(message); } SendMail(); } else { marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed)); circle.InvokeFillColor(0X66FF0000); marker.SetPosition(latLngMarker); circle.InvokeCenter(latLngMarker); map.AddMarker(marker); map.AddCircle(circle); } }
void OnMapClick(object sender, GoogleMap.MapClickEventArgs e) { switch (Mode) { case Mode.Add: MapClickWhileAddMode(e.Point); break; case Mode.MarkerSelected: if (_selectedMarker != null) { _selectedMarker.SetIcon(_selectedAlarm.Enabled ? _alarm_marker_normal : _alarm_marker_disabled); _selectedMarker = null; } Mode = Mode.None; break; } }
private async void HandleOnGoogleMapClick(object sender, GoogleMap.MapClickEventArgs e) { if (!RequestExternalStoragePermissionIfNecessary(RC_WRITE_EXTERNAL_STORAGE_PERMISSION)) { return; } Address address = await GeocodingHelper.ReverseGeocodeCurrentLocation(e.Point, this); var marker = new MarkerInfo { Longtitude = e.Point.Longitude, Latitude = e.Point.Latitude, Address = address == null ? string.Empty : $"{address.CountryName} {address.AdminArea}", LastModData = DateTime.Now }; string markerString = JsonConvert.SerializeObject(marker); App.Locator.MainViewModel.CreateNewMarkerCommand.Execute(markerString); }
private void GoogleMap_MapClick(object sender, GoogleMap.MapClickEventArgs e) { ((AdminPinMap)Element).OnTap(new Position(e.Point.Latitude, e.Point.Longitude)); var addingPin = new CustomPin { Type = PinType.Place, Position = new Position(e.Point.Latitude, e.Point.Longitude), Address = " - need to possibly implement - ", Id = "medical", Label = "medical", Url = "http://www.redcross.org" }; Map.Pins.Add(addingPin); customPins.Add(addingPin); Position p = new Position(e.Point.Latitude, e.Point.Longitude); PopupMenu menu = new PopupMenu(Android.App.Application.Context, view); }
private async void setAdress(MarkerOptions pinMarker, GoogleMap.MapClickEventArgs e) { string adress = ""; // Obtengo la posible dirección a partir de la latitud y longitud Geocoder geocoder = new Geocoder(); IEnumerable <string> possibleAdresses = await geocoder.GetAddressesForPositionAsync(new Position(e.Point.Latitude, e.Point.Longitude)); adress = possibleAdresses.ElementAt(0); pinMarker.SetTitle(adress); // Añado el pin al mapa _map.AddMarker(pinMarker).ShowInfoWindow(); // Comparto el punto en App var myApp = App.Current as App; myApp.meetingPoint = new MeetingPoint { Name = adress, Place = new Position(e.Point.Latitude, e.Point.Longitude) }; }