Exemplo n.º 1
0
        private void map_holding(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
        {
            Debug.WriteLine("map_holding");

            Geopoint chosenDestinationLocation;

            //Muis locatie ophalen
            sender.GetLocationFromOffset(args.Position, out chosenDestinationLocation);
            Debug.WriteLine("Geklikt op positie: " + chosenDestinationLocation.Position.Latitude + ", " + chosenDestinationLocation.Position.Longitude);

            //Tijdelijke locatie aanmaken
            BasicGeoposition tempbasic = new BasicGeoposition();

            //Parsen
            tempbasic.Latitude  = chosenDestinationLocation.Position.Latitude;
            tempbasic.Longitude = chosenDestinationLocation.Position.Longitude;

            //Tijdelijke locatie aanmaken, om de gekozen locatie om te zetten.
            Geopoint temppoint = new Geopoint(tempbasic);

            //Muis locatie porten op kaart
            MapIcon mapIconDestinationLocation = new MapIcon();

            mapIconDestinationLocation.Location = temppoint;
            mapIconDestinationLocation.Image    = mapIconStreamReference;
            mapIconDestinationLocation.Title    = "Bestemming";
            mapIconDestinationLocation.NormalizedAnchorPoint = new Point(0.5, 1.0); //Verzet het icoontje, zodat de punt van de marker staat op waar de locatie is. (anders zou de linkerbovenhoek op de locatie staan)
            MapNieuweBestemming.MapElements.Add(mapIconDestinationLocation);        //Marker op de map plaatsen

            //Bestemming in string opslaan
            string locatie = "{latitude:" + tempbasic.Latitude + ",longitude:" + tempbasic.Longitude + "}";

            //string doorsturen
            //BestemmingenVM.setDestinationLocation(locatie);
            txtBlockNewDestinationLocation.Text = locatie;
        }
        private void mapaPodaci_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
        {
            brojac++;
            if (brojac > 2)
            {
                brojac = 1;
                mapaPodaci.Routes.Remove(viewOfRouteGlobal);
                mapaPodaci.MapElements.Remove(ikonica1);
                mapaPodaci.MapElements.Remove(ikonica2);
            }
            var tappedGeoPosition = args.Location.Position;

            MapIcon ikonica = new MapIcon();

            ikonica.Location = args.Location;
            mapaPodaci.MapElements.Add(ikonica);
            if (brojac == 1)
            {
                pocetna  = tappedGeoPosition;
                ikonica1 = ikonica;
            }
            else if (brojac == 2)
            {
                ikonica2 = ikonica;
                ShowRouteOnMap(pocetna, tappedGeoPosition);
                double privremeni = Math.Round(GetDistanceBetweenPoints(pocetna.Latitude, pocetna.Longitude, tappedGeoPosition.Latitude, tappedGeoPosition.Longitude), 2);
                textBlockDuzinaRute.Text = privremeni.ToString() + " m";
                textBlockCijenaP.Text    = "Cijena: " + Math.Round(cijenaRacunanje(privremeni), 2) + " KM";
            }
        }
Exemplo n.º 3
0
        private void MyMap_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
        {
            var    tappedGeoPosition = args.Location.Position;
            string status            = "MapTapped at \nLatitude:" + tappedGeoPosition.Latitude + "\nLongitude: " + tappedGeoPosition.Longitude;

            rootPage.NotifyUser(status, NotifyType.StatusMessage);
        }
 private async void MapControl_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
 {
     var    tappedGeopositoin = args.Location.Position;
     string status            = $"faisal.ishak92 - checked in at \nLatitude : {tappedGeopositoin.Latitude}" + $"\nLongitude: { tappedGeopositoin.Longitude} ";
     var    messageDialog     = new MessageDialog(status);
     await messageDialog.ShowAsync();
 }
Exemplo n.º 5
0
        private async void MapControl1_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
        {
            //Geopoint pos = args.Location;
            //Point pos1 = args.Position;
            // MessageDialog   messageDialog = new MessageDialog(pos.Position.Longitude.ToString()+"  "+ pos.Position.Latitude.ToString());
            //   await messageDialog.ShowAsync();

            Ellipse myEllipse = new Ellipse()
            {
                Height          = 20,
                Width           = 20,
                Stroke          = new SolidColorBrush(Windows.UI.Colors.Blue),
                StrokeThickness = 2,
            };


            // Add XAML to the map.
            MapControl1.Children.Add(myEllipse);
            BasicGeoposition cityPosition = new BasicGeoposition()
            {
                Latitude = 55.6509863734914, Longitude = 37.6680877307923, Altitude = 10
            };

            SeattleLocation1 = new Geopoint(cityPosition);
            Geopoint cityCenter = new Geopoint(cityPosition);

            MapControl.SetLocation(myEllipse, cityCenter);
            MapControl.SetNormalizedAnchorPoint(myEllipse, new Point(0.5, 1));
            // AddLandmarkPhoto();
        }
Exemplo n.º 6
0
        private async void map_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
        {
            Geopoint pointToReverseGeocode = new Geopoint(args.Location.Position);

            // Reverse geocode the specified geographic location.
            MapLocationFinderResult result =
                await MapLocationFinder.FindLocationsAtAsync(pointToReverseGeocode);

            var resultText = new StringBuilder();

            if (result.Status == MapLocationFinderStatus.Success)
            {
                resultText.AppendLine(
                    result.Locations[0].Address.StreetNumber + ", " +
                    result.Locations[0].Address.Street + ", " +
                    result.Locations[0].Address.District + ", " +
                    result.Locations[0].Address.PostCode);
            }
            tbxAddress.Text = resultText.ToString();
            altitude        = args.Location.Position.Altitude;
            latitude        = args.Location.Position.Latitude;
        }
Exemplo n.º 7
0
 void Map_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
 {
     ViewModel.Location = Tuple.Create <double, double>(args.Location.Position.Latitude, args.Location.Position.Longitude);
 }
Exemplo n.º 8
0
 private void myMap_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
 {
 }
Exemplo n.º 9
0
 void MapCtrl_MapHolding(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
 {
     AddEvent(args.Location);
 }
Exemplo n.º 10
0
 private void MapMain_MapHolding(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
 {
 }
Exemplo n.º 11
0
        private void MapControl_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
        {
            localAtual = args.Location.Position;
            var posicao           = args.Location.Position;
            var tappedGeoPosition = args.Location.Position;

            latitude  = tappedGeoPosition.Latitude;
            longitude = tappedGeoPosition.Longitude;

            localSelecionado  = "Local Selecionado! \nLatitude:" + tappedGeoPosition.Latitude + "\nLongitude: " + tappedGeoPosition.Longitude;
            LocalClicado.Text = localSelecionado;
        }
Exemplo n.º 12
0
        private async void MapControl_MapTapped(Windows.UI.Xaml.Controls.Maps.MapControl sender, Windows.UI.Xaml.Controls.Maps.MapInputEventArgs args)
        {
            Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            var icons             = Convert.ToInt32(localSettings.Values["icons"]);
            var tappedGeoPosition = args.Location.Position;

            if ((icons > 1) && (_first != 0))
            {
                MapControl.MapElements.Clear();
                MapControl.Routes.Clear();
                icons = 0;
            }
            else
            {
                MapIcon icon = new MapIcon();
                icon.Location = new Geopoint(tappedGeoPosition);
                //icon.ZIndex = 0;
                MapControl.MapElements.Add(icon);
                icons++;
                _first++;
                if (icons == 1)
                {
                    _startLocation = icon.Location;
                }
                else
                {
                    _endLocation = icon.Location;
                    MapRouteFinderResult routeResult = await MapRouteFinder.GetDrivingRouteAsync(
                        _startLocation,
                        _endLocation,
                        MapRouteOptimization.Time,
                        MapRouteRestrictions.None
                        );

                    if (routeResult.Status == MapRouteFinderStatus.Success)
                    {
                        MapRouteView viewOfRoute = new MapRouteView(routeResult.Route)
                        {
                            RouteColor   = Colors.Yellow,
                            OutlineColor = Colors.Black
                        };
                        MapControl.Routes.Add(viewOfRoute);
                        await MapControl.TrySetViewBoundsAsync(
                            routeResult.Route.BoundingBox,
                            null,
                            Windows.UI.Xaml.Controls.Maps.MapAnimationKind.None);
                    }
                }
            }
            localSettings.Values["icons"] = icons;
        }