Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            //mMap.Focus(); // Control with keyBoard
            //mMap.Mode = new AerialMode(true); // AerialMode with Lables
            //myMap.AnimationLevel = AnimationLevel.None;



            Location rambam = new Location(32.83314073512528, 34.985717330983555);
            Location shani  = new Location(31.876640708011877, 34.81796609362201);


            Pushpin pushpin = new Pushpin();

            pushpin.Location = rambam;
            pushpin.ToolTip  = "Sapir";


            MapLayer    layerPush = new MapLayer();
            Image       image     = new Image();
            BitmapImage bit       = new BitmapImage(new Uri(@"d:\Visual Studio\C#\Apps\Bing\Bing\Media\pushRed2.png"));

            image.Source = bit;
            image.Width  = 50;
            image.Height = 50;
            PositionOrigin position = PositionOrigin.TopCenter;

            layerPush.AddChild(image, shani, position);
            myMap.Children.Add(layerPush);
            myMap.Children.Add(pushpin);

            myMap.SetView(rambam, 14);
        }
Beispiel #2
0
        /// <summary>
        /// 修改下载任务在队列中的位置,并返回调整后的位置。
        /// 例如:pos=-1,origin=PositionOrigin.Current时,向前移动一位
        /// pos=-1,origin=PositionOrigin.End,调整为队列中的倒数第二位
        /// </summary>
        /// <param name="gid"></param>
        /// <param name="pos"></param>
        /// <param name="origin"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int ChangePosition(string gid, int pos, PositionOrigin origin, object id = null)
        {
            string how = "";

            switch (origin)
            {
            case PositionOrigin.Begin:
                how = "POS_SET";
                break;

            case PositionOrigin.Current:
                how = "POS_CUR";
                break;

            case PositionOrigin.End:
                how = "POS_END";
                break;

            default:
                break;
            }
            var result = JsonRpcHelper.RemoteCall(RPC_URL, "aria2.changePosition", id, gid, pos, how);

            return(Convert.ToInt32(result));
        }
        public MainWindow()
        {
            this.DataContext = this;
            Topmost          = true;

            InitializeComponent();
            handle       = new WindowInteropHelper(this).EnsureHandle(); // Get handle of main WPF Window
            handleSource = HwndSource.FromHwnd(handle);                  // Get source of handle in order to add event handlers to it
            handleSource.AddHook(HandleSimConnectEvents);

            SetButtons(true, false, false);

            DispatcherTimer timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(1)
            };

            timer.Tick += UpdatePosition;
            timer.Start();

            PlaneIconImage.Height  = 48;
            PlaneIconImage.Width   = 48;
            PlaneIconImage.Source  = new BitmapImage(planeIcon);
            PlaneIconImage.Stretch = System.Windows.Media.Stretch.None;

            PlaneIconImage.HorizontalAlignment = HorizontalAlignment.Center;
            PlaneIconImage.VerticalAlignment   = VerticalAlignment.Center;

            Location       planeIconLocation = mapCenter;
            PositionOrigin planeIconPosition = PositionOrigin.Center;

            ImageLayer.AddChild(PlaneIconImage, planeIconLocation, planeIconPosition);
            myMap.Children.Add(ImageLayer);
        }
        private void addImageToMap(object sender, RoutedEventArgs e)
        {
            List <UIElement> lstMapLayer = CustomerSiteMap.Children.Cast <UIElement>().ToList();

            for (int i = 0; i < lstMapLayer.Count; i++)
            {
                if (lstMapLayer[i].GetType().ToString() == "Microsoft.Maps.MapControl.WPF.MapLayer")
                {
                    CustomerSiteMap.Children.Remove(lstMapLayer[i]);
                }
            }
            CustomerSiteMap.UpdateLayout();

            MapLayer imageLayer = new MapLayer();


            Image image = new Image();

            image.Height = 50;
            image.Width  = 50;
            //Define the URI location of the image
            BitmapImage myBitmapImage = new BitmapImage();

            myBitmapImage.BeginInit();

            myBitmapImage.UriSource = new Uri("http://www.iconsdb.com/icons/preview/red/marker-xxl.png");
            // To save significant application memory, set the DecodePixelWidth or
            // DecodePixelHeight of the BitmapImage value of the image source to the desired
            // height or width of the rendered image. If you don't do this, the application will
            // cache the image as though it were rendered as its normal size rather then just
            // the size that is displayed.
            // Note: In order to preserve aspect ratio, set DecodePixelWidth
            // or DecodePixelHeight but not both.
            //Define the image display properties
            myBitmapImage.DecodePixelHeight = 50;
            myBitmapImage.EndInit();
            image.Source  = myBitmapImage;
            image.Opacity = 0.6;
            image.Stretch = System.Windows.Media.Stretch.None;

            //The map location to place the image at
            Location location = new Location()
            {
                Latitude = Convert.ToDouble(objCustomerLocationModel.Location.Latitude), Longitude = Convert.ToDouble(objCustomerLocationModel.Location.Longitude)
            };
            //{ Latitude =Convert.ToDouble(objCustomerLocationModel.Location.Latitude), Longitude =Convert.ToDouble(objCustomerLocationModel.Location.Longitude) };
            // Location location = new Location() { Latitude = 26.922070, Longitude = 75.778885 };
            //Location location = new Location() { Latitude = 23.424076, Longitude = 53.847818 };
            //Location location = new Location() { Latitude = 33.93911, Longitude = 67.709953 };

            //Center the image around the location specified
            PositionOrigin position = PositionOrigin.Center;

            //Add the image to the defined map layer
            imageLayer.AddChild(image, location, position);
            //Add the image layer to the map
            CustomerSiteMap.Children.Add(imageLayer);
            CustomerSiteMap.ZoomLevel = 2;
            CustomerSiteMap.BringIntoView();
        }
Beispiel #5
0
        private void BtnCalc_Click(object sender, RoutedEventArgs e)
        {
            string myFile = @"c:\ProgramData\Adobe\ARM\Reader_15.008.20082\Visual Studio\C#\Bing\Gpx\1_בדצמ׳_2020_22_02_01.gpx";


            ds.ReadXml(myFile);

            myTbl = ds.Tables["trkpt"];

            var locs = new LocationCollection();

            for (int i = 0; i < myTbl.Rows.Count; i = i + 10)
            {
                locs.Add(new Microsoft.Maps.MapControl.WPF.Location(Convert.ToDouble(myTbl.Rows[i]["lat"]), Convert.ToDouble(myTbl.Rows[i]["lon"])));
            }

            var routeLine = new MapPolyline()
            {
                Locations       = locs,
                Stroke          = new SolidColorBrush(Colors.Blue),
                StrokeThickness = 5
            };

            mMap.Children.Add(routeLine);

            Microsoft.Maps.MapControl.WPF.Location start = new Microsoft.Maps.MapControl.WPF.Location(locs[locs.Count - 1].Latitude, locs[locs.Count - 1].Longitude);
            Microsoft.Maps.MapControl.WPF.Location end   = new Microsoft.Maps.MapControl.WPF.Location(locs[0].Latitude, locs[0].Longitude);

            Pushpin pushpinStart = new Pushpin();

            pushpinStart.Location = start;

            Pushpin pushpinEnd = new Pushpin();

            pushpinEnd.Location = end;

            //mMap.Children.Add(pushpinStart);
            mMap.Children.Add(pushpinEnd);

            Image image = new Image();

            BitmapImage bitmap = new BitmapImage(new Uri("pack://application:,,,/Bing;component/Resources/pushRed2.png"));

            image.Source = bitmap;
            image.Width  = 50;
            image.Height = 50;

            MapLayer layer = new MapLayer();

            PositionOrigin position = PositionOrigin.BottomCenter;

            layer.AddChild(image, start, position);

            mMap.Children.Add(layer);

            mMap.SetView(start, 10);
            mMap.Center = start;
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // add a dummy pushbin
            Image pinImage = new Image();

            pinImage.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Assets/Icons/marker/yes/coffee.png", UriKind.RelativeOrAbsolute));
            pinImage.Width   = 37;
            pinImage.Height  = 37;
            pinImage.Opacity = 1d;
            pinImage.Stretch = System.Windows.Media.Stretch.None;
            PositionOrigin position = PositionOrigin.BottomCenter;

            imageLayer.AddChild(pinImage, map.TargetCenter, position);
        }
Beispiel #7
0
        private void addPointOfInterest(EntityViewModel entity)
        {
            //Add the image to the defined map layer
            if (!images.ContainsKey(entity.Id))
            {
                Image image = new Image();
                image.Height = 50;
                image.Source = entity.Image;

                //Center the image around the location specified
                PositionOrigin position = PositionOrigin.Center;
                layer.AddChild(image, new Location(entity.Latitude, entity.Longitude), position);
                images.Add(entity.Id, image);
            }
        }
Beispiel #8
0
        public VenuePage()
        {
            InitializeComponent();
            imageLayer = new MapLayer();
            mapArea.Children.Add(imageLayer);

            mapArea.Center = new GeoCoordinate(49.879738, -97.203598);
            Image pinImage = new Image();

            pinImage.Source  = new BitmapImage(new Uri("/images/prairiedevconpin.png", UriKind.Relative));
            pinImage.Stretch = Stretch.None;
            PositionOrigin origin = PositionOrigin.BottomCenter;

            imageLayer.AddChild(pinImage, mapArea.Center, origin);
        }
Beispiel #9
0
        private void MoveMapToPosition(GeoCoordinate geoCoordinate)
        {
            this.map.AnimationLevel = AnimationLevel.UserInput;
            this.map.Center         = geoCoordinate;
            this.map.ZoomLevel      = 15.0;
            Image image = new Image();

            image.Source  = ((ImageSource) new BitmapImage(new Uri("/VKMessenger;component/Resources/Map_Pin.png", UriKind.Relative)));
            image.Stretch = ((Stretch)0);
            PositionOrigin bottomCenter = PositionOrigin.BottomCenter;

            this._lastPosition = geoCoordinate;
            ((PresentationFrameworkCollection <UIElement>) this.pushpinLayer.Children).Clear();
            this.pushpinLayer.AddChild((UIElement)image, geoCoordinate, bottomCenter);
        }
Beispiel #10
0
 public void AddCarLicense(Border border, Location location, PositionOrigin positionOrigin)
 {
     if (!IsShowCarLicense)
     {
         border.Visibility = Visibility.Collapsed;
     }
     else
     {
         border.Visibility = Visibility.Visible;
     }
     try
     {
         _listCarLicense.Add(border);
         this.AddChild(border, location, positionOrigin);
     }
     catch { }
 }
Beispiel #11
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            ShowLocationPopup();

            // Start the progress bar
            App.ViewModel.LoadStations();

            this.map.Center = App.ViewModel.CurrentPosition;

            Image pinImage = new Image();

            pinImage.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri("Images/[email protected]", UriKind.Relative));
            pinImage.Opacity = 0.8;
            pinImage.Stretch = System.Windows.Media.Stretch.None;
            PositionOrigin position = PositionOrigin.Center;

            stationsLayer.AddChild(pinImage, App.ViewModel.CurrentPosition, position);
        }
        private void PushPinButton_Click(object sender, RoutedEventArgs e)
        {
            mapCenter = navMap.Center;
            waypoints.Enqueue(navMap.Center);

            Image pinImg = new Image();

            pinImg.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri("pushPinSmall.png", UriKind.Relative));
            pinImg.Opacity = 0.8;
            pinImg.Stretch = System.Windows.Media.Stretch.None;

            //Pushpin pin1 = new Pushpin();
            //pin1.Location = mapCenter;
            PositionOrigin pos = PositionOrigin.Center;

            imageLayer.AddChild(pinImg, mapCenter, pos);
            //navMap.Children.Add(pin1);
        }
Beispiel #13
0
 public PointerState Clone()
 {
     return(new PointerState
     {
         DeviceType = DeviceType,
         PositionOrigin = PositionOrigin.Clone(),
         Position = Position.Clone(),
         FingerCount = FingerCount,
         WheelDelta = WheelDelta,
         Scale = Scale,
         Rotation = Angle.FromDeg(Rotation.Deg),
         Time = Time,
         IsInContact = IsInContact,
         IsKeyControl = IsKeyControl,
         IsKeyMenu = IsKeyMenu,
         IsKeyShift = IsKeyShift,
         IsKeyWindows = IsKeyWindows,
     });
 }
Beispiel #14
0
        void SelectStationOnMap(Station selectedStation)
        {
            App.ViewModel.MapCenter = selectedStation.Coordinate;
            this.map.Center         = selectedStation.Coordinate;

            // Show a background behind the selected station
            selectedStationLayer.Children.Clear();
            Image selectedStationBackgroundImage = new Image();

            selectedStationBackgroundImage.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri("Images/[email protected]", UriKind.Relative));
            selectedStationBackgroundImage.Opacity = 0.8;
            selectedStationBackgroundImage.Stretch = System.Windows.Media.Stretch.None;
            PositionOrigin position = PositionOrigin.Center;

            selectedStationLayer.AddChild(selectedStationBackgroundImage, selectedStation.Coordinate, position);


            GeneralTransform gt          = this.TransformToVisual(this.map as UIElement);
            Point            offset      = gt.Transform(new Point(0, 0));
            double           controlTop  = offset.Y;
            double           controlLeft = offset.X;

            // Show Popup
            if (stationStatus == null)
            {
                stationStatus                 = new StationStatusUserControl(selectedStation);
                buyNowScreen                  = new Popup();
                buyNowScreen.Child            = stationStatus;
                buyNowScreen.IsOpen           = true;
                buyNowScreen.VerticalOffset   = controlTop * (-1) + 30;
                buyNowScreen.HorizontalOffset = (this.LayoutRoot.ActualWidth + controlLeft - stationStatus.Width) / 2;
                buyNowScreen.Closed          += (s1, e1) =>
                {
                    // Add you code here to do something
                    // when the Popup is closed
                };
            }
            else
            {
                stationStatus.DataContext = selectedStation;
                buyNowScreen.IsOpen       = true;
            }
        }
Beispiel #15
0
        private void AddVideo_Click(object sender, RoutedEventArgs e)
        {
            MapLayer     layer = new MapLayer();
            MediaElement video = new MediaElement();



            video.Source = new Uri(@"d:\מצלמה\רחוב שני\20170416_163950.mp4");
            video.Width  = 250;
            video.Height = 200;

            Location shani = new Location(31.876640708011877, 34.81796609362201);

            PositionOrigin positionOrigin = PositionOrigin.Center;

            layer.AddChild(video, shani, positionOrigin);

            myMap.Children.Add(layer);
        }
Beispiel #16
0
        private void pushpinLayer_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (!this._shouldPick)
            {
                return;
            }
            Point         position      = e.GetPosition((UIElement)this.map);
            GeoCoordinate geoCoordinate = new GeoCoordinate();
            GeoCoordinate location      = this.map.ViewportPointToLocation(position);

            ((PresentationFrameworkCollection <UIElement>) this.pushpinLayer.Children).Clear();
            Image image = new Image();

            image.Source  = ((ImageSource) new BitmapImage(new Uri("/VKMessenger;component/Resources/Map_Pin.png", UriKind.Relative)));
            image.Stretch = ((Stretch)0);
            PositionOrigin bottomCenter = PositionOrigin.BottomCenter;

            this.pushpinLayer.AddChild((UIElement)image, location, bottomCenter);
            this._lastPosition = location;
        }
Beispiel #17
0
        private void addImageToMap(object sender, RoutedEventArgs e)
        {
            MapLayer imageLayer = new MapLayer();


            Image image = new Image();

            image.Height = 150;
            //Define the URI location of the image
            BitmapImage myBitmapImage = new BitmapImage();

            myBitmapImage.BeginInit();
            myBitmapImage.UriSource = new Uri("http://upload.wikimedia.org/wikipedia/commons/d/d4/Golden_Gate_Bridge10.JPG");
            // To save significant application memory, set the DecodePixelWidth or
            // DecodePixelHeight of the BitmapImage value of the image source to the desired
            // height or width of the rendered image. If you don't do this, the application will
            // cache the image as though it were rendered as its normal size rather then just
            // the size that is displayed.
            // Note: In order to preserve aspect ratio, set DecodePixelWidth
            // or DecodePixelHeight but not both.
            //Define the image display properties
            myBitmapImage.DecodePixelHeight = 150;
            myBitmapImage.EndInit();
            image.Source  = myBitmapImage;
            image.Opacity = 0.6;
            image.Stretch = System.Windows.Media.Stretch.None;

            //The map location to place the image at
            Location location = new Location()
            {
                Latitude = 37.8197222222222, Longitude = -122.478611111111
            };
            //Center the image around the location specified
            PositionOrigin position = PositionOrigin.Center;

            //Add the image to the defined map layer
            imageLayer.AddChild(image, location, position);
            //Add the image layer to the map
            MapTileOverlay.Children.Add(imageLayer);
        }
Beispiel #18
0
        private void AddImage_Click(object sender, RoutedEventArgs e)
        {
            MapLayer imageLayer = new MapLayer();

            Image image = new Image();


            BitmapImage bit = new BitmapImage(new Uri("pack://application:,,,/Bing;component/Resources/shani.JPG"));


            image.Source = bit;

            image.Width  = 150;
            image.Height = 150;

            Location shani = new Location(31.876640708011877, 34.81796609362201);

            PositionOrigin positionOrigin = PositionOrigin.Center;

            imageLayer.AddChild(image, shani, positionOrigin);

            myMap.Children.Add(imageLayer);
        }
Beispiel #19
0
        void ViewModel_StationsSearched(object sender, EventArgs e)
        {
            Progress.IsIndeterminate = false;
            Progress.Visibility      = System.Windows.Visibility.Collapsed;

            AvailabilityToIconValueConverter converter =
                this.Resources["AvailabilityToIconValueConverter"] as AvailabilityToIconValueConverter;

            foreach (Station s in App.ViewModel.Stations)
            {
                string iconName = (string)converter.Convert(s.Availability, null, null, null);
                iconName = iconName.Replace("Menu", "");
                //iconName = iconName.Replace("@2x", "");

                Image pinImage = new Image();
                pinImage.Source  = new System.Windows.Media.Imaging.BitmapImage(new Uri(iconName, UriKind.Relative));
                pinImage.Opacity = 0.8;
                pinImage.Stretch = System.Windows.Media.Stretch.None;
                PositionOrigin position = PositionOrigin.Center;
                pinImage.Tag = s;
                stationsLayer.AddChild(pinImage, s.Coordinate, position);
                pinImage.MouseLeftButtonDown += new MouseButtonEventHandler(pinImage_MouseLeftButtonDown);
            }
        }
Beispiel #20
0
        public void SetPosition(int offset, PositionOrigin origin)
        {
            if (origin == PositionOrigin.BEGINNING)
            {
                if ((offset < 0) || ((_startIndex + offset) > (_length - 1)))
                {
                    throw new IndexOutOfRangeException("Offset must be positive and within the bounds of the buffer");
                }

                _position = _startIndex + offset;
            }
            else
            {
                // The position origin is the end of the buffer.

                int lastIdx = (_startIndex + _length) - 1;
                if (offset > 0 || (offset + lastIdx) < _startIndex)
                {
                    throw new IndexOutOfRangeException("Offset must be a negative integer and within the bouds of the buffer");
                }

                _position = offset + lastIdx;
            }
        }
        //add Image
        public void addImageToMap(String UriString, Location location)
        {
            MapLayer imageLayer = new MapLayer();


            Image image = new Image();

            image.Height = 150;
            //Define the URI location of the image
            BitmapImage myBitmapImage = new BitmapImage();

            myBitmapImage.BeginInit();
            myBitmapImage.UriSource = new Uri(@UriString, UriKind.RelativeOrAbsolute);
            // To save significant application memory, set the DecodePixelWidth or
            // DecodePixelHeight of the BitmapImage value of the image source to the desired
            // height or width of the rendered image. If you don't do this, the application will
            // cache the image as though it were rendered as its normal size rather then just
            // the size that is displayed.
            // Note: In order to preserve aspect ratio, set DecodePixelWidth
            // or DecodePixelHeight but not both.
            //Define the image display properties
            myBitmapImage.DecodePixelHeight = 150;
            myBitmapImage.EndInit();
            image.Source  = myBitmapImage;
            image.Opacity = 0.6;
            image.Stretch = System.Windows.Media.Stretch.None;


            //Center the image around the location specified
            PositionOrigin position = PositionOrigin.Center;

            //Add the image to the defined map layer
            imageLayer.AddChild(image, location, position);
            //Add the image layer to the map
            myMap.Children.Add(imageLayer);
        }
Beispiel #22
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            myMap.Children.Clear();
            LinesBus lineInfo = new LinesBus();
            BusStop  busstop  = new BusStop();
            Api      api      = new Api();

            var lat = TxtLat.Text;
            var lng = TxtLon.Text;
            var ryn = Rayon.Text;



            String getApiBusStop  = api.GetApi("http://data.metromobilite.fr/api/linesNear/json?x=" + lng + "&y=" + lat + "&dist=" + ryn + "&details=true");
            String getApiBusLines = api.GetApi("http://data.metromobilite.fr/api/routers/default/index/routes");


            List <BusStop>  busStops   = JsonConvert.DeserializeObject <List <BusStop> >(getApiBusStop);
            List <BusStop>  names      = busStops.GroupBy(y => y.Name).Select(x => x.First()).ToList();
            List <LinesBus> linedetail = JsonConvert.DeserializeObject <List <LinesBus> >(getApiBusLines);



            foreach (BusStop name in names)
            {
                foreach (BusStop bustop in busStops)
                {
                    if (name.Name.Equals(bustop.Name))
                    {
                        IEnumerable <string> newLines = name.Lines.Union(bustop.Lines);
                        name.GetType().GetProperty("Lines").SetValue(name, newLines);
                    }
                }
            }
            foreach (BusStop name in names)
            {
                toto = "";
                //Lignes.Items.Add(name.Name);



                foreach (string lines in name.Lines)
                {
                    toto += "\n" + lines;

                    foreach (LinesBus lineColor in linedetail)
                    {
                        if (lineColor.Id.Equals(lines))
                        {
                            lineInfo = lineColor;
                        }
                    }
                    MapLayer imageLayer = new MapLayer();
                    Image    image      = new Image();
                    image.Height = 150;
                    //Define the URI location of the image
                    BitmapImage myBitmapImage = new BitmapImage();
                    myBitmapImage.BeginInit();
                    myBitmapImage.UriSource         = new Uri("https://orig00.deviantart.net/4dfb/f/2014/090/6/1/pikachu___01_by_mighty355-d7cdjy7.png");
                    myBitmapImage.DecodePixelHeight = 50;
                    myBitmapImage.EndInit();
                    image.Source  = myBitmapImage;
                    image.Opacity = 1;
                    image.Stretch = System.Windows.Media.Stretch.None;


                    Location       location = new Location(name.Lat, name.Lon);
                    PositionOrigin position = PositionOrigin.Center;
                    imageLayer.AddChild(image, location, position);
                    ToolTipService.SetToolTip(imageLayer, $"Nom de l'arrêt: {name.Name}\n Lignes: {toto}");
                    myMap.Children.Add(imageLayer);
                }
            }
            // Lignes.Items.Add($"\nMode de transport: {lineInfo.Mode}\nNom Complet : {lineInfo.LongName}");


            //Lignes.Items.Add($"\n");
        }
Beispiel #23
0
 void AddToMapLayer(UIElement element, Location location, PositionOrigin origin = default(PositionOrigin))
 {
     lyr.AddChild(element, location, origin);
     currentLine.Add(element);
 }
        private void MapWithPushpins_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            // Disables the default mouse double-click action.
            e.Handled = true;

            // Determin the location to place the pushpin at on the map.

            //Get the mouse click coordinates
            Point mousePosition = e.GetPosition(this);
            //Convert the mouse coordinates to a locatoin on the map
            Location pinLocation = metroMap.ViewportPointToLocation(mousePosition);

            // Remove previous pins
            metroMap.Children.Clear();

            // The pushpin to add to the map.
            pin          = new Pushpin();
            pin.Location = pinLocation;

            // Adds the pushpin to the map.
            //metroMap.Children.Add(pin);

            longitude = pinLocation.Longitude.ToString().Replace(",", ".");
            latitude  = pinLocation.Latitude.ToString().Replace(",", ".");
            rayon     = "800";
            url       = $"http://data.metromobilite.fr/api/linesNear/json?x={longitude}&y={latitude}&dist=500&details=true";
            stopsApi  = new Api(url);
            List <BusStop> busStops = JsonConvert.DeserializeObject <List <BusStop> >(stopsApi.getResponse());

            // Nouvelle liste d'objet BusStop sans les doublons
            List <BusStop> busStopsWithoutDoubles = busStops.GroupBy(busStop => busStop.name).Select(x => x.First()).ToList();

            // Injection des lignes manquantes pour chaques arret avec suppression des doublons de ligne
            foreach (BusStop busStopWD in busStopsWithoutDoubles)
            {
                foreach (BusStop busStop in busStops)
                {
                    if (busStopWD.name.Equals(busStop.name))
                    {
                        IEnumerable <string> newLines = busStopWD.lines.Union(busStop.lines);
                        busStopWD.GetType().GetProperty("lines").SetValue(busStopWD, newLines);
                    }
                }
            }

            // Affichage des pins des arrets et de leurs lignes
            foreach (BusStop busStop in busStopsWithoutDoubles)
            {
                count     = 1;
                linesInfo = "";
                foreach (string line in busStop.lines)
                {
                    if (count == 7)
                    {
                    }
                    lineApi   = new Api("http://data.metromobilite.fr/api/routers/default/index/routes?codes=" + line);
                    lineInfos = JsonConvert.DeserializeObject <List <BusLine> >(lineApi.getResponse());

                    color      = $"#{lineInfos.First().color}";
                    li         = new ListViewItem();
                    li.Content = $"        {line} : {lineInfos.First().longName}";
                    if (color != "#")
                    {
                        mySolidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom(color));
                        li.Foreground     = mySolidColorBrush;
                    }
                    linesInfo += "\n- " + lineInfos.First().longName;
                    count++;
                }
                MapLayer stopPin = new MapLayer();
                Image    image   = new Image();
                image.Height = 150;
                //Define the URI location of the image
                BitmapImage myBitmapImage = new BitmapImage();
                myBitmapImage.BeginInit();
                myBitmapImage.UriSource = new Uri("https://cdn3.iconfinder.com/data/icons/maps-and-pins-4/512/map_pin_destination_location_adress_bus_stop-256.png");

                myBitmapImage.DecodePixelHeight = 35;
                myBitmapImage.EndInit();
                image.Source  = myBitmapImage;
                image.Opacity = 1;
                image.Stretch = System.Windows.Media.Stretch.None;

                Location       location = new Location(busStop.lat, busStop.lon);
                PositionOrigin position = PositionOrigin.Center;
                stopPin.AddChild(image, location, position);

                ToolTipService.SetToolTip(stopPin, busStop.name + " :" + linesInfo);
                metroMap.Children.Add(stopPin);
            }
        }
 public override ushort EstimateAnswerCurrentSerializedSize()
 {
     return((ushort)(sizeof(uint) + sizeof(uint)
                     + (PositionOrigin.EstimateCurrentSerializedSize() + sizeof(uint))
                     + (Destination.EstimateCurrentSerializedSize() + sizeof(uint))));
 }
 public static void AddChild(this MapLayer layer, UIElement img, GeoCoordinate pos, PositionOrigin origin)
 {
     MapLayer.SetPosition(img, new Location(pos.lat, pos.lng));
     layer.Children.Add(img);
 }