Esempio n. 1
0
        private void AddMapIcon()
        {
            var myLandmarks             = new List <MapElement>();
            BasicGeoposition snPosition = new BasicGeoposition {
                Latitude = 47.620, Longitude = -122.349
            };

            PinPoint = new Geopoint(snPosition);
            var spaceNeedleIcon = new MapIcon
            {
                Location = PinPoint,
                ZIndex   = 0,
                Title    = "Pin"
            };

            myLandmarks.Add(spaceNeedleIcon);
            var landmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = myLandmarks
            };

            MyMapControl.Layers.Add(landmarksLayer);
            MyMapControl.Center    = PinPoint;
            MyMapControl.ZoomLevel = 14;
        }
        /// <summary>
        /// adds a point on the map
        /// </summary>
        /// <param name="snPosition">the positions where the point needs to be placed</param>
        /// <param name="text">text for context with the marker</param>
        private void DrawPoint(BasicGeoposition snPosition, string text)
        {
            var MyLandmarks = new List <MapElement>();

            Geopoint snPoint = new Geopoint(snPosition);

            var spaceNeedleIcon = new MapIcon
            {
                Location = snPoint,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
                ZIndex = 0,
                Title  = text
            };

            MyLandmarks.Add(spaceNeedleIcon);

            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarks
            };

            Map.Layers.Remove(CurrentPOI);
            Map.Layers.Add(LandmarksLayer);

            Map.Center    = snPoint;
            Map.ZoomLevel = 20;

            CurrentPOI = LandmarksLayer;
        }
Esempio n. 3
0
        public void AddSpaceNeedleIcon()
        {
            var      MyLandmarks = new List <MapElement>();
            Geopoint snPoint     = new Geopoint(_basicGeoposition);

            var spaceNeedleIcon = new MapIcon
            {
                Location = snPoint,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
                ZIndex = 0,
                Title  = "Position"
            };

            MyLandmarks.Add(spaceNeedleIcon);

            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarks
            };

            myMap.Layers.Add(LandmarksLayer);

            myMap.Center    = snPoint;
            myMap.ZoomLevel = 14;
        }
Esempio n. 4
0
        private void AddLocation(Location location)
        {
            BasicGeoposition position = new BasicGeoposition
            {
                Latitude  = location.Latitude,
                Longitude = location.Longitude,
                Altitude  = location.Altitude
            };

            Geopoint point  = new Geopoint(position);
            var      marker = new MapIcon
            {
                Location = point,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
                Title  = location.Name,
                ZIndex = 0,
            };


            Elements.Add(marker);
            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = Elements
            };

            Layers.Add(LandmarksLayer);
            SelectLocation(marker);
        }
Esempio n. 5
0
        public async void AddSpaceNeedleIcon()
        {
            var access = await Geolocator.RequestAccessAsync();

            var MyLandmarks = new List <MapElement>();


            BasicGeoposition snPosition = new BasicGeoposition {
                Latitude = Lat, Longitude = Lon
            };
            Geopoint snPoint = new Geopoint(snPosition);

            var spaceNeedleIcon = new MapIcon
            {
                Location = snPoint,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
                ZIndex = 0,
                Title  = "Twój dron"
            };

            spaceNeedleIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/indeks123.jpg"));
            spaceNeedleIcon.CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible;
            //MyLandmarks.Add(spaceNeedleIcon);

            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarks
            };

            // myMap.Layers.Add(LandmarksLayer);
        }
 private void CustomMapView_CircleAddedEvent(object sender, EventArgs e)
 {
     if (Control?.Control != null)
     {
         if (MyCircleLayoutLayer != null)
         {
             Control.Control.Layers.Remove(MyCircleLayoutLayer);
         }
         var MyCircleLayout = new List <MapElement>();
         foreach (var circle in customMapView.Circles)
         {
             BasicGeoposition s = new BasicGeoposition();
             s.Latitude  = circle.Center.Latitude;
             s.Longitude = circle.Center.Longitude;
             MapPolygon mapPolygon = GetCircleMapPolygon(s, circle.Radius.Meters, circle.FillColor, circle.StrokeColor, circle.StrokeWidth);
             MyCircleLayout.Add(mapPolygon);
         }
         MyCircleLayoutLayer = new MapElementsLayer
         {
             ZIndex      = 1,
             MapElements = MyCircleLayout
         };
         Control.Control.Layers.Add(MyCircleLayoutLayer);
     }
 }
Esempio n. 7
0
        private void DrawLine()
        {
            List <BasicGeoposition> geopositions = new List <BasicGeoposition>();

            for (var i = 0; i < ViewModel.Flight.Locations.Count; i++)
            {
                geopositions.Add(new BasicGeoposition()
                {
                    Latitude  = ViewModel.Flight.Locations.ElementAt(i).Latitude,
                    Longitude = ViewModel.Flight.Locations.ElementAt(i).Longitude
                });
            }

            var mapPolyline = new MapPolyline
            {
                Path            = new Geopath(geopositions),
                StrokeColor     = Colors.Black,
                StrokeThickness = 3
            };

            var MyLines = new List <MapElement>();

            MyLines.Add(mapPolyline);

            var LinesLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLines
            };

            Map.Layers.Add(LinesLayer);
        }
Esempio n. 8
0
        protected override void OnElementChanged(ElementChangedEventArgs <Map> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                map = e.NewElement;
                Control.ActualCameraChanging += Control_ActualCameraChanging;
                foreach (var circle in map.Circles)
                {
                    BasicGeoposition s = new BasicGeoposition();
                    s.Latitude  = circle.Center.Latitude;
                    s.Longitude = circle.Center.Longitude;
                    MapPolygon mapPolygon   = GetCircleMapPolygon(s, circle.Radius.Meters);
                    var        MyHighlights = new List <MapElement>();
                    MyHighlights.Add(mapPolygon);
                    var HighlightsLayer = new MapElementsLayer
                    {
                        ZIndex      = 1,
                        MapElements = MyHighlights
                    };
                    Control.Layers.Add(HighlightsLayer);
                }
            }
        }
Esempio n. 9
0
        public void DisplayRoute(DirectionsResponse directions)
        {
            MapPolyline routeLine = new MapPolyline()
            {
                Path = new Geopath(directions.routes[0].legs[0].points.Select(p => new BasicGeoposition {
                    Latitude = p.latitude, Longitude = p.longitude
                })),
                StrokeColor     = Colors.Black,
                StrokeThickness = 3,
                StrokeDashed    = true
            };


            var mapLines = new List <MapElement>();

            mapLines.Add(routeLine);

            var LinesLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = mapLines
            };

            _map.Layers.Add(LinesLayer);
        }
Esempio n. 10
0
        public async void SetMapElements()
        {
            var MyLandmarks = new List <MapElement>();

            foreach (var point in KnownSchools)
            {
                var school = new MapIcon
                {
                    Location = point.LatLon,
                    NormalizedAnchorPoint = new Point(0.5, 1.0),
                    ZIndex = 0,
                    Title  = point.Name,
                    Tag    = point.Name
                };
                MyLandmarks.Add(school);
            }
            //BasicGeoposition snPosition = new BasicGeoposition { Latitude = 41.873857, Longitude = -87.640664 };
            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarks
            };

            mainMap.Layers.Add(LandmarksLayer);
            mainMap.Center             = KnownSchools[0].LatLon;
            mainMap.ZoomLevel          = 14;
            mainMap.TrafficFlowVisible = true;
            await mainMap.TryTiltAsync(40);

            await mainMap.TryZoomToAsync(17);

            Schools.ItemsSource = SES;
        }
Esempio n. 11
0
        private void AddCamerasLayer()
        {
            var cameraMarks = new List <MapElement>();
            var cameras     = model.GetAllCameras();

            foreach (var camera in cameras)
            {
                BasicGeoposition cameraPosition = new BasicGeoposition
                {
                    Latitude  = camera.Latitude,
                    Longitude = camera.Longitude
                };
                Geopoint cameraPoint = new Geopoint(cameraPosition);

                var icon = new MapIcon
                {
                    Location = cameraPoint,
                    Tag      = camera.Id,
                    NormalizedAnchorPoint = new Point(0.5, 0.5),
                    ZIndex = 0,
                    Title  = $"{camera.City}, {camera.Country}",
                    CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible,
                };

                cameraMarks.Add(icon);
            }

            var camerasLayer = new MapElementsLayer()
            {
                ZIndex      = 1,
                MapElements = cameraMarks,
            };

            LandmarkLayers.Add(camerasLayer);
        }
Esempio n. 12
0
        private void SelectLayer(MapElementsLayer selectedLayer)
        {
            // Ignore layer changes if no layers have been created.
            if (selectedLayer == null)
            {
                return;
            }

            // The other layer becomes deselected.
            MapElementsLayer deselectedLayer = (selectedLayer == this.myLayer1) ? this.myLayer2 : this.myLayer1;

            // The deselected layer goes to z-index 0, and its elements appear disabled.
            deselectedLayer.ZIndex = 0;
            foreach (MapElement e in deselectedLayer.MapElements)
            {
                e.MapStyleSheetEntryState = MapStyleSheetEntryStates.Disabled;
            }

            // The selected layer goes to z-index 1, and its elements appear normal.
            selectedLayer.ZIndex = 1;
            foreach (MapElement e in selectedLayer.MapElements)
            {
                e.MapStyleSheetEntryState = "";
            }
        }
Esempio n. 13
0
        public void AddLandmarkPhoto()
        {
            // Create MapBillboard.

            BasicGeoposition cityPosition = new BasicGeoposition()
            {
                Latitude = 55.6509863734914, Longitude = 37.6680877307923, Altitude = 0
            };

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

            var mapBillboard = new MapBillboard(MapControl1.ActualCamera)
            {
                Location = cityCenter,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
            };

            // Add MapBillboard to a layer on the map control.

            var MyLandmarkPhotos = new List <MapElement>();

            MyLandmarkPhotos.Add(mapBillboard);

            var LandmarksPhotoLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarkPhotos
            };

            MapControl1.Layers.Add(LandmarksPhotoLayer);
        }
Esempio n. 14
0
        // Method for adding Room Location Icon
        public int AddMarker(Double latitude, Double longtitude, String title)
        {
            int      index       = gmitMap.Layers.Count;
            var      MyLandmarks = new List <MapElement>();
            Geopoint snPoint     = new Geopoint(new BasicGeoposition()
            {
                Latitude  = latitude,
                Longitude = longtitude,
                Altitude  = 0
            }, AltitudeReferenceSystem.Surface);
            var spaceNeedleIcon = new MapIcon
            {
                Location = snPoint,
                NormalizedAnchorPoint = new Point(0D, 0D),
                ZIndex = 1,
                Title  = title
            };

            MyLandmarks.Add(spaceNeedleIcon);
            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarks
            };

            gmitMap.Layers.Add(LandmarksLayer);
            return(index);
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            bdd = new gstBDD();
            txtBlockNomCine.Text   = "Pour le cinéma " + cinema.nomCine;
            gvFilms.ItemsSource    = bdd.getListFilmsByIdCinema(cinema.codeCine);
            txtBlockAdresse.Text   = "Adresse : " + cinema.adresseCine;
            txtBlockLatitude.Text  = "Latitude : " + cinema.latitudeCine.ToString();
            txtBlockLongitude.Text = "Longitude : " + cinema.longitudeCine.ToString();
            BasicGeoposition snPosition = new BasicGeoposition {
                Latitude = cinema.latitudeCine, Longitude = cinema.longitudeCine
            };
            Geopoint snPoint = new Geopoint(snPosition);

            var MyLandmarks     = new List <MapElement>();
            var spaceNeedleIcon = new MapIcon
            {
                Location = snPoint,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
                ZIndex = 0,
                Title  = cinema.nomCine
            };

            MyLandmarks.Add(spaceNeedleIcon);
            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarks
            };

            map.Layers.Add(LandmarksLayer);
            map.Center    = snPoint;
            map.ZoomLevel = 18;
        }
        // <summary>
        /// adds a point on the map
        /// </summary>
        /// <param name="snPosition">the positions where the point needs to be placed</param>
        /// <param name="text">text for context with the marker</param>
        private void DrawPoints(Destination[] destArray)
        {
            var MyLandmarks = new List <MapElement>();

            for (var i = 0; i < destArray.Length; i++)
            {
                var dest = destArray[i];
                BasicGeoposition point = new BasicGeoposition()
                {
                    Latitude = dest.Latitude, Longitude = dest.Longitude
                };
                Geopoint snPoint = new Geopoint(point);

                var icon = new MapIcon
                {
                    Location = snPoint,
                    NormalizedAnchorPoint = new Point(0.5, 1.0),
                    ZIndex = 0,
                    Title  = dest.Address
                };
                MyLandmarks.Add(icon);
            }
            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarks
            };

            Map.Layers.Remove(CurrentPOIList);
            Map.Layers.Add(LandmarksLayer);
            CurrentPOIList = LandmarksLayer;
        }
Esempio n. 17
0
        public void AddMapIcon(Geopoint geopoint, MapControl mapControl, string title)
        {
            MapIcon LocationIcon = new MapIcon()
            {
                Location = geopoint,
                CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible,
                //Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Icon.png")),
                Title = title,
                NormalizedAnchorPoint = new Point(0.5, 1.0)
            };
            var Icons = new List <MapElement>();

            Icons.Add(LocationIcon);
            MapElementsLayer mapLayer = new MapElementsLayer()
            {
                ZIndex      = 1,
                MapElements = Icons,
            };

            mapLayer.MapElementPointerEntered += MapLayer_MapElementPointerEntered;
            mapLayer.MapElementPointerExited  += MapLayer_MapElementPointerExited;
            mapControl.Layers.Add(mapLayer);
            mapControl.Center    = geopoint;
            mapControl.ZoomLevel = 16;
        }
Esempio n. 18
0
        public MainPage()
        {
            this.InitializeComponent();

            // Init Pivot
            mainPivot.SelectionChanged += PivotChanged;

            isMapElementsLayersAPIPresent =
                Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.Maps.MapElementsLayer");

            if (isMapElementsLayersAPIPresent)
            {
                // Init map elements layer
                layer = new MapElementsLayer
                {
                    ZIndex = 1
                };
                map.Layers.Add(layer);
            }
            else
            {
                map.Visibility = Visibility.Collapsed;
            }

            // Get Nearby bus stop
            GetNearbyBusStop();
        }
Esempio n. 19
0
        private void MapLayer_MapElementPointerEntered(MapElementsLayer sender, MapElementsLayerPointerEnteredEventArgs args)
        {
            var mapIcon = args.MapElement as MapIcon;

            mapIcon.Title = "You point here";
            //mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Icon.png"));
        }
Esempio n. 20
0
        private void AddPushpin(string deviceID, Windows.Devices.Geolocation.BasicGeoposition position)
        {
            var mapDevices = new List <MapElement>();

            Windows.Devices.Geolocation.BasicGeoposition snPosition = new Windows.Devices.Geolocation.BasicGeoposition {
                Latitude = position.Latitude, Longitude = position.Longitude
            };

            var pushpin = new MapIcon
            {
                Location = new Geopoint(snPosition),
                NormalizedAnchorPoint = new Point(0.5, 1),
                ZIndex = 1000,
                Tag    = "NEW",
                Title  = deviceID,
                Image  = RandomAccessStreamReference.CreateFromUri(new Uri(resourceLoader.GetString("Map_Pushpin_New"))),
            };

            mapDevices.Add(pushpin);

            var mapDevicesLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = mapDevices
            };

            MapLayers.Add(mapDevicesLayer);
            CTRL_Map_Main.Layers.Add(mapDevicesLayer);
        }
        // Add needleIcon to map with venueName
        public void AddSpaceNeedleIcon(string longitude, string latitude, string venueName)
        {
            var MyLandmarks = new List <MapElement>();

            BasicGeoposition snPosition = new BasicGeoposition {
                Latitude = Convert.ToDouble(latitude), Longitude = Convert.ToDouble(longitude)
            };
            Geopoint snPoint = new Geopoint(snPosition);

            var spaceNeedleIcon = new MapIcon
            {
                Location = snPoint,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
                ZIndex = 0,
                Title  = venueName
            };

            MyLandmarks.Add(spaceNeedleIcon);

            var LandmarksLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLandmarks
            };

            myMap.Layers.Add(LandmarksLayer);

            myMap.Center    = snPoint;
            myMap.ZoomLevel = 14;
        }
Esempio n. 22
0
        public async void HighlightArea()
        {
            // Create MapPolygon.

            double           centerLatitude  = MapControl1.Center.Position.Latitude;
            double           centerLongitude = MapControl1.Center.Position.Longitude;
            BasicGeoposition cityPosition    = new BasicGeoposition()
            {
                Latitude = 55.6509863734914, Longitude = 37.6680877307923, Altitude = 10
            };

            Geopoint cityCenter = new Geopoint(cityPosition);
            var      mapPolygon = new MapPolygon
            {
                Path = new Geopath(new List <BasicGeoposition> {
                    new BasicGeoposition()
                    {
                        Latitude = cityCenter.Position.Latitude + 0.0005, Longitude = cityCenter.Position.Longitude - 0.001
                    },
                    new BasicGeoposition()
                    {
                        Latitude = cityCenter.Position.Latitude - 0.0005, Longitude = cityCenter.Position.Longitude - 0.001
                    },
                    new BasicGeoposition()
                    {
                        Latitude = cityCenter.Position.Latitude - 0.0005, Longitude = cityCenter.Position.Longitude + 0.001
                    },
                    new BasicGeoposition()
                    {
                        Latitude = cityCenter.Position.Latitude + 0.0005, Longitude = cityCenter.Position.Longitude + 0.001
                    },
                }),
                ZIndex          = 100,
                FillColor       = Colors.Red,
                StrokeColor     = Colors.Blue,
                StrokeThickness = 3,
                StrokeDashed    = false,
            };

            // Add MapPolygon to a layer on the map control.
            var MyHighlights = new List <MapElement>();

            MyHighlights.Add(mapPolygon);

            var HighlightsLayer = new MapElementsLayer
            {
                ZIndex      = 100,
                MapElements = MyHighlights,
                Visible     = true
            };

            MapControl1.Layers.Add(HighlightsLayer);

            foreach (var d in MapControl1.Layers)
            {
                MessageDialog messageDialog = new MessageDialog(d.ZIndex.ToString());
                await messageDialog.ShowAsync();
            }
        }
Esempio n. 23
0
        private void NavigateToCameraPage(MapElementsLayer sender, MapElementsLayerClickEventArgs args)
        {
            int id = (int)args.MapElements[0].Tag;

            var camera = this.camerasViewModel.GetById(id);

            this.Frame.Navigate(typeof(CameraPage), camera);
        }
Esempio n. 24
0
        private void AddLayer2()
        {
            this.myLayer2                  = new MapElementsLayer();
            this.myLayer2.MapElements      = MainPage.CreateCityParksCollection();
            this.myLayer2.MapElementClick += (sender, args) => SelectLayer(this.myLayer2);

            this.myLayers.Add(this.myLayer2);
        }
Esempio n. 25
0
        private void AddLayer1()
        {
            this.myLayer1                  = new MapElementsLayer();
            this.myLayer1.MapElements      = MainPage.CreateCityBuildingsCollection();
            this.myLayer1.MapElementClick += (sender, args) => SelectLayer(this.myLayer1);

            this.myLayers.Add(this.myLayer1);
        }
        // The elements in layer 1 receive a default style.
        private void AddLayer1()
        {
            this.myLayer1             = new MapElementsLayer();
            this.myLayer1.MapElements = MainPage.CreateCityBuildingsCollection();
            this.myLayer1.MapElementPointerEntered += (sender, args) => UpdateMapElementOnPointerEntered(args.MapElement, ToDefaultStyleEntryState);
            this.myLayer1.MapElementPointerExited  += (sender, args) => UpdateMapElementOnPointerExited(args.MapElement, ToDefaultStyleEntryState);
            this.myLayer1.MapElementClick          += (sender, args) => UpdateMapElementOnClick(args.MapElements[0], ToDefaultStyleEntryState);

            this.myLayers.Add(this.myLayer1);
        }
Esempio n. 27
0
            public LandmarksViewModel()
            {
                var MyElements = new List <MapElement>();

                var LandmarksLayer = new MapElementsLayer
                {
                    ZIndex      = 1,
                    MapElements = MyElements
                };
            }
        /// <summary>
        /// adds a polyline on the map
        /// </summary>
        private async void AddLine()
        {
            var size = ViewModel.DestinationsList.Count;

            if (CurrentLine != null)
            {
                Map.Layers.Remove(CurrentLine);
            }
            if (size <= 1)
            {
                return;
            }
            var destArray = ViewModel.GetDestinationsAsArray();
            var coords    = new List <BasicGeoposition>();

            DrawPoints(destArray);
            for (var i = 0; i < destArray.Length; i++)
            {
                var dest = destArray[i];
                BasicGeoposition point = new BasicGeoposition()
                {
                    Latitude = dest.Latitude, Longitude = dest.Longitude
                };
                coords.Add(point);
            }

            Geopath path = new Geopath(coords);

            MapPolyline polygon = new MapPolyline();

            polygon.StrokeColor     = Colors.Blue;
            polygon.StrokeThickness = 5;
            polygon.Path            = path;
            polygon.StrokeDashed    = true;

            var MyLines = new List <MapElement>();

            MyLines.Add(polygon);
            var LinesLayer = new MapElementsLayer
            {
                ZIndex      = 1,
                MapElements = MyLines
            };

            if (CurrentLine != null)
            {
                Map.Layers.Remove(CurrentLine);
            }
            Map.Layers.Add(LinesLayer);
            this.CurrentLine = LinesLayer;
            await Map.TrySetViewBoundsAsync(GeoboundingBox.TryCompute(coords), null, MapAnimationKind.None);

            //Map.ZoomLevel = bingMap.ZoomLevel * 0.85
        }
Esempio n. 29
0
        private void RetrieveMerchantLocations()
        {
            MapIcons = new List <MapIcon>();

            MapIcons.Add(CreateMerchantMarker(Establishment));

            var landmarkLayer = new MapElementsLayer
            {
                ZIndex      = 0,
                MapElements = new List <MapElement>(MapIcons)
            };

            MerchantMarkers.Add(landmarkLayer);
        }
Esempio n. 30
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            BusStopAll receiveData = (BusStopAll)e.Parameter;

            if (receiveData != null)
            {
                latitude  = receiveData.Lat;
                longitude = receiveData.Lon;

                id   = receiveData.BusStopId;
                stop = receiveData.BusStopName;

                title.Text = stop;

                GetStopBusTimesAsync(id);  // Async refresh

                if (MainPage.isMapElementsLayersAPIPresent)
                {
                    MapElementsLayer layer = new MapElementsLayer
                    {
                        ZIndex = 1
                    };
                    map.Layers.Add(layer);

                    List <MapElement> BusStopMarkers = new List <MapElement>();

                    BasicGeoposition stopPosition = new BasicGeoposition
                    {
                        Latitude  = latitude,
                        Longitude = longitude
                    };

                    map.Center    = new Geopoint(stopPosition);
                    map.ZoomLevel = 17;

                    BusStopMarkers.Add(new MapIcon
                    {
                        Location = new Geopoint(stopPosition),
                        NormalizedAnchorPoint = new Point(0.5, 1.0),
                        ZIndex = 0,
                        Title  = stop
                    }
                                       );

                    layer.MapElements = BusStopMarkers;
                }
            }
        }