private async void Map_Clicked(object sender, MapClickedEventArgs e)
        {
            Pin location = new Pin()
            {
                Type     = PinType.Place,
                Label    = "",
                Address  = "",
                Position = new Position(e.Position.Latitude, e.Position.Longitude),
            };

            Map.Pins.Add(location);

            PopupView      popupProperties = new PopupView(this, e.Position);
            ScaleAnimation scaleAnimation  = new ScaleAnimation
            {
                PositionIn  = MoveAnimationOptions.Right,
                PositionOut = MoveAnimationOptions.Left
            };

            popupProperties.Animation = scaleAnimation;

            await PopupNavigation.Instance.PushAsync(popupProperties, true);
        }
Esempio n. 2
0
        /// <summary>
        /// When map is clicked, iterates through all features in the feature list and shows the feature info menu if feature has been tapped
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMapClicked(object sender, MapClickedEventArgs e)
        {
            FeatureList.ForEach((Feature feature) =>
            {
                bool ItemHit = false;

                if (feature.Geometry.Type == GeoJSONType.Polygon && Preferences.Get(Constants.MapDrawPolygonsKey, true))
                {
                    Polygon polygon = (Polygon)feature.Geometry;
                    ItemHit        |= polygon.ContainsPosition(new Position(e.Position.Longitude, e.Position.Latitude));
                }
                else if (feature.Geometry.Type == GeoJSONType.LineString && Preferences.Get(Constants.MapDrawLinesKey, true))
                {
                    LineString lineString = (LineString)feature.Geometry;
                    ItemHit |= lineString.ContainsPosition(new Position(e.Position.Longitude, e.Position.Latitude, 0));
                }

                if (ItemHit)
                {
                    _ = DisplayFeatureActionMenuAsync(feature);
                }
            });
        }
        private void MyMap_MapClicked(object sender, MapClickedEventArgs e)
        {
            Position p = e.Position;

            //if (MyMap.Pins.Count >= 2)
            //{
            //    MyMap.Pins.Remove(SelectedPin);
            //}

            SelectedLocation = new Location()
            {
                Latitude  = p.Latitude,
                Longitude = p.Longitude
            };
            if (SenderReciver)
            {
                CheckPin(StartPin);
                StartPin = new Pin
                {
                    Position = p,
                    Label    = "Senders location",
                    Type     = PinType.SavedPin
                };
                MyMap.Pins.Add(StartPin);
            }
            else
            {
                CheckPin(EndPin);
                EndPin = new Pin
                {
                    Position = p,
                    Label    = "Recivers Location",
                    Type     = PinType.Place
                };
                MyMap.Pins.Add(EndPin);
            }
        }
        private void MyMap_MapClicked(object sender, MapClickedEventArgs e)
        {
            myMap.Pins.Clear();
            Pin pin1 = new Pin()
            {
                Position = new Position(e.Point.Latitude, e.Point.Longitude),
                Address  = "",
                Label    = "",
            };

            pin1.Icon = BitmapDescriptorFactory.FromView(new ContentView()
            {
                WidthRequest    = 20,
                HeightRequest   = 20,
                BackgroundColor = Color.Blue,
                Content         = new Image()
                {
                    Source = ImageSource.FromFile("markericon.png")
                }
            });
            myMap.Pins.Add(pin1);

            // draw Circle
            Circle circle = new Circle
            {
                Center      = new Position(pin1.Position.Latitude, pin1.Position.Longitude),
                Radius      = new Distance(500),
                StrokeColor = Color.FromHex("#88FF0000"),
                StrokeWidth = 5,
                FillColor   = Color.FromHex("#88FFC0CB")
            };

            myMap.Circles.Add(circle);

            Constantce.Lat = e.Point.Latitude;
            Constantce.lon = e.Point.Longitude;
        }
Esempio n. 5
0
        void MapClicked(object sender, MapClickedEventArgs e)
        {
            switch (_selectedType)
            {
            case SelectedElementType.Polyline:
                _polyline.Geopath.Add(e.Position);
                break;

            case SelectedElementType.Polygon:
                _polygon.Geopath.Add(e.Position);
                break;

            case SelectedElementType.Circle:
                if (_circle.Center == default(Position))
                {
                    _circle.Center = e.Position;
                }
                else
                {
                    _circle.Radius = Distance.BetweenPositions(_circle.Center, e.Position);
                }
                break;
            }
        }
        public void OnMapClicked(object sender, MapClickedEventArgs e)
        {
            Pin pin = new Pin
            {
                Label    = "Nazwa",
                Address  = "adres",
                Type     = PinType.SavedPin,
                Position = new Position(e.Position.Latitude, e.Position.Longitude)
            };

            positions.Add(new Position(e.Position.Latitude, e.Position.Longitude));
            Polyline polyline = new Polyline
            {
                StrokeColor = Color.Blue,
                StrokeWidth = 6
            };

            foreach (Position pos in positions)
            {
                polyline.Geopath.Add(pos);
            }
            maps.Pins.Add(pin);
            maps.MapElements.Add(polyline);
        }
Esempio n. 7
0
 private void Map_MapClicked(object sender, MapClickedEventArgs e)
 {
     Current?.CancelCommand.Execute(null);
     CreateLocation(e.Point.Latitude, e.Point.Longitude);
 }
Esempio n. 8
0
 private void OnMapClicked(object sender, MapClickedEventArgs e)
 {
     e.Handled = clicker == null ? false : (bool)clicker?.Invoke(sender as MapView, e);
 }
Esempio n. 9
0
 private void OnMapClicked(object sender, MapClickedEventArgs e)
 {
     e.Handled = (bool)clicker?.Invoke(sender as MapView, e);
     //Samples.SetPins(mapView, e);
     //Samples.DrawPolylines(mapView, e);
 }
Esempio n. 10
0
 private void OnMapClicked(object sender, MapClickedEventArgs e)
 {
     e.Handled = Clicker != null ? (Clicker?.Invoke(sender as MapView, e) ?? false) : false;
     //Samples.SetPins(mapView, e);
     //Samples.DrawPolylines(mapView, e);
 }
Esempio n. 11
0
 void MapClicked(object sender, MapClickedEventArgs e)
 {
     LastMapClickLabel.Text = $"Last MapClick: {e.Position.Latitude}, {e.Position.Longitude}";
 }
Esempio n. 12
0
 void OnMapClicked(object sender, MapClickedEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine($"MapClick: {e.Position.Latitude}, {e.Position.Longitude}");
 }
Esempio n. 13
0
        private void Map_OnMapClicked(object sender, MapClickedEventArgs e)
        {
            var position = new Position(e.Point.Latitude, e.Point.Longitude);

            GetCountryFromTap(position);
        }
Esempio n. 14
0
 private void OnMapClicked(object?sender, MapClickedEventArgs e)
 {
     e.Handled = clicker?.Invoke(sender as MapView, e) ?? false;
 }
Esempio n. 15
0
 void Map_MapClicked(object sender, MapClickedEventArgs e)
 {
     HidePopUp();
 }
Esempio n. 16
0
 private async void MapClickedAsync(object sender, MapClickedEventArgs e)
 {
     e.Handled = true;
     await RBLayer.MapClickedAsync(sender, e);
 }
Esempio n. 17
0
        /*
         * private void MapView_Info(object sender, MapInfoEventArgs e)
         * {
         *  if (e?.MapInfo?.Feature != null)
         *  {
         *      foreach (var style in e.MapInfo.Feature.Styles)
         *      {
         *          if (style is CalloutStyle)
         *          {
         *              style.Enabled = !style.Enabled;
         *              e.Handled = true;
         *          }
         *      }
         *
         *      mapView.RefreshGraphics();
         *  }
         * }*/

        private void OnMapClicked(object sender, MapClickedEventArgs e)
        {
            //e.IsFocused = Clicker != null ? (bool)Clicker?.Invoke(sender as MapView, e) : false;
            //Samples.SetPins(mapView, e);
            //Samples.DrawPolylines(mapView, e);
        }
Esempio n. 18
0
        private async void MapControl_MapClicked(object sender, MapClickedEventArgs e)
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;
                if (PageStatusEnum == PageStatusEnum.Searching)
                {
                    var mapSpan = Xamarin.Forms.GoogleMaps.MapSpan.FromCenterAndRadius(new Xamarin.Forms.GoogleMaps.Position(e.Point.Latitude, e.Point.Longitude), Xamarin.Forms.GoogleMaps.Distance.FromKilometers(1));

                    MapControl.MoveToRegion(mapSpan);

                    //Location Geocoding
                    var locations = await Geocoding.GetPlacemarksAsync(new Location(e.Point.Latitude, e.Point.Longitude));

                    var locationDecoded = locations?.FirstOrDefault();

                    //Setting Pin
                    if (OrderStateEnum == OrderStateEnum.StartPicker)
                    {
                        _startLocation = e.Point;

                        var pin = MapControl.Pins.FirstOrDefault(x => x.Label == "Start");
                        if (pin != null)
                        {
                            pin.Position = new Position(_startLocation.Latitude, _startLocation.Longitude);
                        }
                        else
                        {
                            MapControl.Pins.Add(new Xamarin.Forms.GoogleMaps.Pin
                            {
                                Type     = PinType.Place,
                                Position = new Position(_startLocation.Latitude, _startLocation.Longitude),
                                Label    = "Start",
                                Icon     = (Device.RuntimePlatform == Device.Android) ? BitmapDescriptorFactory.FromBundle("ic_pickuplocation.png") : BitmapDescriptorFactory.FromView(new Image()
                                {
                                    Source = "ic_pickuplocation.png", WidthRequest = 25, HeightRequest = 25
                                }),
                                Tag = 1
                            });
                        }



                        StartText = locationDecoded.Thoroughfare + " " + locationDecoded.FeatureName + ", " + locationDecoded.SubAdminArea;
                    }
                    else
                    {
                        _destinationLocation = e.Point;

                        var pin = MapControl.Pins.FirstOrDefault(x => x.Label == "Destination");
                        if (pin != null)
                        {
                            pin.Position = new Position(_destinationLocation.Latitude, _destinationLocation.Longitude);
                        }
                        else
                        {
                            MapControl.Pins.Add(new Xamarin.Forms.GoogleMaps.Pin
                            {
                                Type     = PinType.Place,
                                Position = new Position(_destinationLocation.Latitude, _destinationLocation.Longitude),
                                Label    = "Destination",
                                Icon     = (Device.RuntimePlatform == Device.Android) ? BitmapDescriptorFactory.FromBundle("ic_pickuplocation.png") : BitmapDescriptorFactory.FromView(new Image()
                                {
                                    Source = "ic_pickuplocation.png", WidthRequest = 25, HeightRequest = 25
                                }),
                                Tag = 2
                            });
                        }

                        DestinationText = locationDecoded.Thoroughfare + " " + locationDecoded.FeatureName + ", " + locationDecoded.SubAdminArea;
                    }

                    CanCalculate = _startLocation != null && _destinationLocation != null;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 19
0
 private void OnMapClicked(object sender, MapClickedEventArgs mapClickedEventArgs)
 {
     Command?.Execute(mapClickedEventArgs);
 }
Esempio n. 20
0
 private void MapControlOnClicked(object sender, MapClickedEventArgs e)
 {
     //Doesn't work.
     //var info = MapControl.GetMapInfo(e.Point.ToMapsui(), 12);
 }
Esempio n. 21
0
 private void HaritaMap_MapClicked(object sender, MapClickedEventArgs e)
 {
     AdresleriGoster();
 }
Esempio n. 22
0
 protected virtual void Map_MapClicked(object sender, MapClickedEventArgs e)
 {
 }
Esempio n. 23
0
 private void MyMap_MapClicked(object sender, MapClickedEventArgs e)
 {
 }
Esempio n. 24
0
        async void OnTapCrearRuta(object sender, MapClickedEventArgs args)
        {
            string nombre = await DisplayPromptAsync("Título", "Introduce número y título",
                                                     "Añadir", "Cancelar", placeholder : "Por ejemplo: 1. Alcazaba");

            //El nombre es null cuando el usuario pulsa el botón de Cancelar.
            if (nombre == null)
            {
                return;
            }
            Pin      nuevoPin      = new Pin();
            Position nuevaPosicion = new Position();

            if (Ruta.Camino == null)
            {
                Ruta.Camino = new List <Posicion>();
            }
            if (Ruta.Ubicaciones == null)
            {
                Ruta.Ubicaciones = new List <Ubicacion>();
            }
            if (nombre.Length == 0)
            {
                nuevaPosicion = args.Position;
                var      x        = nuevaPosicion.Latitude;
                var      y        = nuevaPosicion.Longitude;
                Posicion posicion = new Posicion(Ruta.Id, x, y);
                Ruta.Camino.Add(posicion);
            }
            else
            {
                nuevoPin = new Pin
                {
                    Position = args.Position,
                    Label    = nombre,
                    Type     = PinType.SearchResult
                };

                nuevoPin.InfoWindowClicked += async(s, arg) =>
                {
                    string pinName = ((Pin)s).Label;
                    await DisplayAlert("Info Window Clicked", $"El audio que toca es {pinName}.", "Ok");
                };
                double    x         = nuevoPin.Position.Latitude;
                double    y         = nuevoPin.Position.Longitude;
                Ubicacion ubicacion = new Ubicacion(Ruta.Id, nombre, x, y);
                Posicion  posicion  = new Posicion(Ruta.Id, x, y);
                Ruta.Camino.Add(posicion);
                Ruta.Ubicaciones.Add(ubicacion);
            }
            for (int i = 0; i < 1; i++)
            {
                for (int j = 0; j < 1; j++)
                {
                    if (nuevoPin.Position != new Position())
                    {
                        Map.Pins.Add(nuevoPin);
                    }
                }

                if (actualPosition != new Position())
                {
                    if (nuevaPosicion != new Position())
                    {
                        Union = new Polyline
                        {
                            StrokeColor = Color.Black,
                            StrokeWidth = 12,
                            Geopath     =
                            {
                                actualPosition,
                                nuevaPosicion
                            }
                        };
                        actualPosition = nuevaPosicion;
                    }
                    else if (nuevoPin.Position != new Position())
                    {
                        Union = new Polyline
                        {
                            StrokeColor = Color.Black,
                            StrokeWidth = 15,
                            Geopath     =
                            {
                                actualPosition,
                                nuevoPin.Position
                            }
                        };
                        actualPosition = nuevoPin.Position;
                    }
                    Map.MapElements.Add(Union);
                }
                else if (actualPosition == new Position())
                {
                    if (nuevaPosicion != new Position())
                    {
                        actualPosition = nuevaPosicion;
                    }
                    else if (nuevoPin.Position != new Position())
                    {
                        actualPosition = nuevoPin.Position;
                    }
                }
            }
        }
Esempio n. 25
0
 private void NativeControl_MapClicked(object sender, MapClickedEventArgs e)
 {
     ClickedAction?.Invoke(sender, e);
 }
Esempio n. 26
0
 private bool CanSubmit(MapClickedEventArgs arg)
 {
     return(false);
 }
        private async void OnMapClicked(object sender, MapClickedEventArgs e)
        {
            if (String.IsNullOrWhiteSpace(nazwaEntry.Text))
            {
                await DisplayAlert("Błąd", "Podaj nazwę punktu", "Ok");

                return;
            }

            CustomPin pin = new CustomPin
            {
                Type     = PinType.SavedPin,
                Position = new Position(e.Position.Latitude, e.Position.Longitude),
                Label    = nazwaEntry.Text,
                Address  = opisEntry.Text,
                Name     = "Xamarin",
                Url      = "http://xamarin.com/about/",
            };

            pin.MarkerClicked += async(s, args) =>
            {
                args.HideInfoWindow = true;
                string pinName = ((CustomPin)s).Label;
                // string pytanie = ((CustomPin)s).Question;
                string opis = ((CustomPin)s).Address;
                await DisplayAlert($"{pinName}, {e.Position.Latitude}, {e.Position.Longitude}", $"{opis}", "Anuluj");

                // string odpowiedz = ((CustomPin)s).Answer;

                /* if(await DisplayAlert($"{pinName}", $"{opis}","Quiz", "Anuluj"))
                 * {
                 *   await Navigation.PushAsync(new QuestionPage(new Question()));
                 * }*/
            };
            customMap.CustomPins = new List <CustomPin> {
                pin
            };
            customMap.Pins.Add(pin);
            routePoints.Add(new Points()
            {
                X           = e.Position.Latitude,
                Y           = e.Position.Longitude,
                RouteId     = 1,
                Name        = nazwaEntry.Text,
                Description = opisEntry.Text
            });
            if (customMap.Pins.Count > 10 && routePoints.Count > 10)
            {
                await DisplayAlert("Uwaga!", "Można do trasy dodać maksymalnie 10 punktów", "Ok");

                customMap.Pins.Remove(pin);
            }

            /*var json = JsonConvert.SerializeObject(new Points()
             * {
             *  X = e.Position.Latitude,
             *  Y = e.Position.Longitude,
             *  RouteId = 1,
             *  Name = nazwaEntry.Text,
             *  Description = opisEntry.Text
             * });
             * var content = new StringContent(json, Encoding.UTF8, "application/json");
             * HttpClient client = new HttpClient();
             * var result = await client.PostAsync("http://dearjean.ddns.net:44301/api/Points3", content);
             * if (result.StatusCode == HttpStatusCode.Created)
             * {
             *  await DisplayAlert("Komunikat", "Dodanie puntku przebiegło pomyślnie", "Ok");
             * }
             * else
             *  await DisplayAlert("Błąd", "Spróbuj ponownie później", "Ok");*/
        }
Esempio n. 28
0
        /// <summary>
        /// Add a point to the temporary geometry by clicking the map (only active when geometry creation is active)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MapsuiMapView_MapClicked(object sender, MapClickedEventArgs e)
        {
            var mp = sender as Mapsui.Map;

            ViewModel.AddTempPoint(e.Point);
        }
Esempio n. 29
0
 private void Map_OnMapClicked(object sender, MapClickedEventArgs e)
 {
     ViewModel.CloseDetailPanelCommand.Execute();
     ViewModel.IsLayerChooserVisible = false;
     ViewModel.IsAgentListVisible    = false;
 }
 private void MapControl_OnMapClicked(object sender, MapClickedEventArgs e)
 {
     _vm.SetNewLocation(e.Position);
 }