当前位置: 首页>>代码示例>>C#>>正文


C# MapLayer.Add方法代码示例

本文整理汇总了C#中MapLayer.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MapLayer.Add方法的具体用法?C# MapLayer.Add怎么用?C# MapLayer.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MapLayer的用法示例。


在下文中一共展示了MapLayer.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: showlocations

        private void showlocations()
        {
            foreach (Place p in _vm.Places)
            {
                Grid MyGrid = new Grid();
                MyGrid.RowDefinitions.Add(new RowDefinition());
                MyGrid.RowDefinitions.Add(new RowDefinition());
                MyGrid.Background = new SolidColorBrush(Colors.Transparent);

                BitmapImage bmi = new BitmapImage(new Uri("/Assets/pushpinPhone.png", UriKind.Relative));
                Image img = new Image();
                img.Tag = (p);
                img.Source = bmi;
               
        
                MyGrid.Children.Add(img);


                //Creating a MapOverlay and adding the Grid to it.
                MapOverlay MyOverlay = new MapOverlay();
                MyOverlay.Content = MyGrid;

                MyOverlay.GeoCoordinate = new GeoCoordinate(p.Latitude, p.Longitude);


                MyOverlay.PositionOrigin = new Point(0, 0.5);

                //Creating a MapLayer and adding the MapOverlay to it
                MapLayer MyLayer = new MapLayer();
                MyLayer.Add(MyOverlay);
                mapWithMyLocation.Layers.Add(MyLayer);
            }
        }
开发者ID:landerarnoys,项目名称:Shredder,代码行数:33,代码来源:MainPage.xaml.cs

示例2: MapPickPage

        public MapPickPage() {
            InitializeComponent();

            MapLayer mainLayer = new MapLayer();
            mainLayer.Add(selectedPushpinOverlay);
            mainLayer.Add(myPositionOverlay);
            Map.Layers.Add(mainLayer);

            Map.ZoomLevel = 16;

            GetMyMapLocationAsync();
        }
开发者ID:Grief-Code,项目名称:kilogram,代码行数:12,代码来源:MapPickPage.xaml.cs

示例3: AddMapIcon

        private void AddMapIcon(Map map, GeoCoordinate geoPosition)
        {
            // Create a small circle to mark the current location.
            Ellipse myCircle = new Ellipse();
            myCircle.Fill = new SolidColorBrush(Colors.Blue);
            myCircle.Height = 20;
            myCircle.Width = 20;
            myCircle.Opacity = 50;


            // Create a MapOverlay to contain the circle.
            MapOverlay myLocationOverlay = new MapOverlay();
            myLocationOverlay.Content = myCircle;
            myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate = geoPosition;


            // Create a MapLayer to contain the MapOverlay.
            MapLayer myLocationLayer = new MapLayer();
            myLocationLayer.Add(myLocationOverlay);

            // Add the MapLayer to the Map.
            maploc.Layers.Add(myLocationLayer);


        }
开发者ID:AegeanApp,项目名称:Aegean-App-V1,代码行数:26,代码来源:MapsPage.xaml.cs

示例4: ShowMyLocationOnTheMap

        private async void ShowMyLocationOnTheMap()
        {
            // Get my current location.
            Geolocator myGeolocator = new Geolocator();
            Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
            Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
            GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);

            // Create a small circle to mark the current location.
            Ellipse myCircle = new Ellipse();
            myCircle.Fill = new SolidColorBrush(Colors.Blue);
            myCircle.Height = 20;
            myCircle.Width = 20;
            myCircle.Opacity = 50;

            // Create a MapOverlay to contain the circle.
            MapOverlay myLocationOverlay = new MapOverlay();
            myLocationOverlay.Content = myCircle;
            myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate = myGeoCoordinate;

            // Create a MapLayer to contain the MapOverlay.
            MapLayer myLocationLayer = new MapLayer();
            myLocationLayer.Add(myLocationOverlay);

            // Add the MapLayer to the Map.
            Haritam.Layers.Add(myLocationLayer);
        }
开发者ID:ramazanguclu,项目名称:EnUcuzUrun,代码行数:28,代码来源:Harita.xaml.cs

示例5: InitApartments

        private async void InitApartments()
        {
            var apartments = await App.MobileService.GetTable<Apartment>().Where(a => a.Published == true).ToListAsync();
            listApartments.ItemsSource = apartments;

            mapApartments.Layers.Clear();
            MapLayer layer = new MapLayer();
            foreach (Apartment apartment in apartments)
            {
                MapOverlay overlay = new MapOverlay();
                overlay.GeoCoordinate = new GeoCoordinate(apartment.Latitude, apartment.Longitude);
                overlay.PositionOrigin = new Point(0, 0);
                Grid grid = new Grid { Height = 40, Width = 25, Background = new SolidColorBrush(Colors.Red) };
                TextBlock text = new TextBlock { Text = apartment.Bedrooms.ToString(), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center };
                grid.Children.Add(text);
                overlay.Content = grid;
                grid.Tap += (s, e) =>
                {
                    MessageBox.Show(
                        "Address: " + apartment.Address + Environment.NewLine + apartment.Bedrooms + " bedrooms",
                        "Apartment", MessageBoxButton.OK);
                    mapApartments.SetView(overlay.GeoCoordinate, 15, MapAnimationKind.Parabolic);
                };
                layer.Add(overlay);
            }
            mapApartments.Layers.Add(layer);
        }
开发者ID:NoamSheffer,项目名称:rentahome,代码行数:27,代码来源:MainPage.xaml.cs

示例6: ShowMyLocationOnTheMap

        private async void ShowMyLocationOnTheMap()
        {
            // Get my current location.
            Geolocator myGeolocator = new Geolocator();
            Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
            Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
            GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);

            // Make my current location the center of the Map.
            this.mapWithMyLocation.Center = myGeoCoordinate;
            this.mapWithMyLocation.ZoomLevel = 13;

            // Create a small circle to mark the current location.
            Ellipse myCircle = new Ellipse();
            myCircle.Fill = new SolidColorBrush(Colors.Red);
            myCircle.Height = 20;
            myCircle.Width = 20;
            myCircle.Opacity = 50;

            // Create a MapOverlay to contain the circle.
            MapOverlay myLocationOverlay = new MapOverlay();
            myLocationOverlay.Content = myCircle;
            myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate = myGeoCoordinate;

            // Create a MapLayer to contain the MapOverlay.
            MapLayer myLocationLayer = new MapLayer();
            myLocationLayer.Add(myLocationOverlay);

            // Add the MapLayer to the Map.
            mapWithMyLocation.Layers.Add(myLocationLayer);

            txTop.Text = ("My Location - Lat " + myGeoCoordinate.Latitude.ToString("0.0000") + "   Lon " + myGeoCoordinate.Longitude.ToString("0.0000"));
        }
开发者ID:alexpt2000,项目名称:CompassV1,代码行数:34,代码来源:Map.xaml.cs

示例7: ShowMyLocationOnTheMap

        private async void ShowMyLocationOnTheMap()
        {
            Geolocator myGeolocator = new Geolocator();
            Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
            Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
            GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);

            this.BettingMap.Center = myGeoCoordinate;
            this.BettingMap.ZoomLevel = 15;

            Ellipse myCircle = new Ellipse();
            myCircle.Fill = new SolidColorBrush(Colors.Blue);
            myCircle.Height = 20;
            myCircle.Width = 20;
            myCircle.Opacity = 50;

            MapOverlay myLocationOverlay = new MapOverlay();
            myLocationOverlay.Content = myCircle;
            myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate = myGeoCoordinate;

            MapLayer myLocationLayer = new MapLayer();
            myLocationLayer.Add(myLocationOverlay);

            BettingMap.Layers.Add(myLocationLayer);
        }
开发者ID:vlatkooo,项目名称:MyTicket,代码行数:26,代码来源:MainPage.xaml.cs

示例8: Seanslar_getCompleted

        void Seanslar_getCompleted(seanslar sender)
        {
            loader.IsIndeterminate = false;

            PanoramaRoot.Title = sender.SalonBilgisi.name;
            pItem1.DataContext = sender.SalonBilgisi;
            listFilmler.ItemsSource = sender.SalonBilgisi.movies;

            if (sender.SalonBilgisi.latitude.ToString() != "false")
            {
                SalonCoordinate = new GeoCoordinate(double.Parse(sender.SalonBilgisi.latitude), double.Parse(sender.SalonBilgisi.longitude));
                myMap.SetView(SalonCoordinate, 17);

                pinpoint_salon newPin = new pinpoint_salon();
                MapOverlay newOverlay = new MapOverlay();
                newOverlay.Content = newPin;
                newOverlay.GeoCoordinate = SalonCoordinate;
                newOverlay.PositionOrigin = new Point(0, 0);
                MapLayer MyLayer = new MapLayer();
                MyLayer.Add(newOverlay);
                myMap.Layers.Add(MyLayer);
            }
            else
            {
                myMap.Visibility = Visibility.Collapsed;
                recMap.Visibility = System.Windows.Visibility.Collapsed;
            }

        }
开发者ID:yajinn,项目名称:sinemaciWP,代码行数:29,代码来源:SalonPage.xaml.cs

示例9: AddPinOnMap

 private void AddPinOnMap()
 {
     geo1 = new GeoCoordinate(Convert.ToDouble(ObjRootObjectJourney.data.latlong[0].latitude), Convert.ToDouble(ObjRootObjectJourney.data.latlong[0].longitude));
     geo2 = new GeoCoordinate(Convert.ToDouble(ObjRootObjectJourney.data.latlong[ObjRootObjectJourney.data.latlong.Count - 1].latitude), Convert.ToDouble(ObjRootObjectJourney.data.latlong[ObjRootObjectJourney.data.latlong.Count - 1].longitude));
     Image pinIMG = new Image();
     pinIMG.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Images/map/pin_green.png", UriKind.Relative));
     pinIMG.Width = 50;
     pinIMG.Height = 50;
     MapOverlay myLocationOverlay = new MapOverlay();
     myLocationOverlay.Content = pinIMG;
     myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
     myLocationOverlay.GeoCoordinate = geo1;
     MapLayer myLocationLayer = new MapLayer();
     myLocationLayer.Add(myLocationOverlay);
     mapJourney.Layers.Add(myLocationLayer);
     myLocationLayer = null;
     myLocationOverlay = null;
     pinIMG = null;
     pinIMG = new Image();
     pinIMG.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Images/map/pin_red.png", UriKind.Relative));
     pinIMG.Width = 50;
     pinIMG.Height = 50;
     myLocationOverlay = new MapOverlay();
     myLocationOverlay.Content = pinIMG;
     myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
     myLocationOverlay.GeoCoordinate = geo2;
     myLocationLayer = new MapLayer();
     myLocationLayer.Add(myLocationOverlay);
     mapJourney.Layers.Add(myLocationLayer);
     myLocationLayer = null;
     myLocationOverlay = null;
     pinIMG = null;
     mapJourney.ZoomLevel = ZoomLevel;
     mapJourney.Center = geo2;
 }
开发者ID:kushalSengupta,项目名称:AgeasDriver,代码行数:35,代码来源:FrmMap.xaml.cs

示例10: AddPoint

        private void AddPoint(Map controlMap, GeoCoordinate geo)
        {
            // With the new Map control:
            //  Map -> MapLayer -> MapOverlay -> UIElements
            //  - Add a MapLayer to the Map
            //  - Add an MapOverlay to that layer
            //  - We can add a single UIElement to that MapOverlay.Content
            MapLayer ml = new MapLayer();
            MapOverlay mo = new MapOverlay();

            // Add an Ellipse UI
            Ellipse r = new Ellipse();
            r.Fill = new SolidColorBrush(Color.FromArgb(255, 240, 5, 5));
            // the item is placed on the map at the top left corner so
            // in order to center it, we change the margin to a negative
            // margin equal to half the width and height
            r.Width = r.Height = 12;
            r.Margin = new Thickness(-6, -6, 0, 0);

            // Add the Ellipse to the Content 
            mo.Content = r;
            // Set the GeoCoordinate of that content
            mo.GeoCoordinate = geo;
            // Add the MapOverlay to the MapLayer
            ml.Add(mo);
            // Add the MapLayer to the Map
            controlMap.Layers.Add(ml);
        }
开发者ID:natsirt20,项目名称:School,代码行数:28,代码来源:Geolocation.xaml.cs

示例11: App_PositionUpdated

        void App_PositionUpdated(object sender, EventArgs e)
        {
            Dispatcher.BeginInvoke(() =>
            {
                ForeLocationCount++;

                if(oneMarker == null){
                    oneMarker = new MapOverlay();
                    MapLayer oneMarkerLayer = new MapLayer();

                    Ellipse Circhegraphic = new Ellipse();
                    Circhegraphic.Fill = new SolidColorBrush(Colors.Yellow);
                    Circhegraphic.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
                    Circhegraphic.StrokeThickness = 10;
                    Circhegraphic.Opacity = 0.8;
                    Circhegraphic.Height = 30;
                    Circhegraphic.Width = 30;

                    oneMarker.Content = Circhegraphic;
                    oneMarker.PositionOrigin = new Point(0.5, 0.5);
       
                    oneMarkerLayer.Add(oneMarker);
                    map1.Layers.Add(oneMarkerLayer);
                }

                oneMarker.GeoCoordinate = App.lastLocation;

                if (!App.RunningInBackground)
                {
                    map1.Center = oneMarker.GeoCoordinate;
                }

                statusBox.Text = "Count :" + ForeLocationCount  + "/"+ App.GottenLocationsCunt + ", sess: " + App.RunningInBackgroundCunt;
            });   
        }
开发者ID:ZeynepCamurdan,项目名称:maps-samples,代码行数:35,代码来源:MainPage.xaml.cs

示例12: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            string quakeQueryString = string.Empty;

            if (NavigationContext.QueryString.TryGetValue("quake", out quakeQueryString))
            {
                quake = Earthquake.DeserializeFromQueryString(quakeQueryString);
            }
            else return;

            ContentPanel.DataContext = quake;

            QuakeMap.Center = quake.Location;
            Pushpin pin = new Pushpin
            {
                GeoCoordinate = quake.Location,
                Content = quake.FormattedMagnitude
            };
            if (quake.Magnitude >= appSettings.MinimumWarningMagnitudeSetting)
                pin.Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush;

            MapOverlay overlay = new MapOverlay();
            overlay.Content = pin;
            overlay.GeoCoordinate = quake.Location;
            overlay.PositionOrigin = new Point(0, 1);

            MapLayer layer = new MapLayer();
            layer.Add(overlay);
            QuakeMap.Layers.Add(layer);

            base.OnNavigatedTo(e);
        }
开发者ID:adamsp,项目名称:wsnz-windowsphone,代码行数:32,代码来源:QuakeDisplayPage.xaml.cs

示例13: detail

        public detail()
        {
            InitializeComponent();
            List<Stand> tab = (List<Stand>)PhoneApplicationService.Current.State["stands"];
            int index = (int)PhoneApplicationService.Current.State["index"];

            //MessageBox.Show(index.ToString());
            Stand item = tab[index];

            station_id.Text = "Station n°" + item.Id;
            add.Text = item.Add.ToString();
            ab.Text = "Places : " + item.Ab.ToString();
            ap.Text = "Velos : " + item.Ap.ToString();
            ac.Text = "Capacité disponible : " + item.Ac.ToString();
            tc.Text = "Capacité totale: : " + item.Tc.ToString();

            GeoCoordinate loc = new GeoCoordinate();
            //Location loc = new Location();
            loc.Longitude = item.Lng;
            loc.Latitude = item.Lat;

            Map Carte = new Map();
            Carte.Center = loc;
            Carte.ZoomLevel = 17.0;

            Pushpin pin = new Pushpin();
            pin.GeoCoordinate = loc;
            //pin.Location = loc;
            ContentMap.Children.Add(Carte);

            ImageBrush imgBrush = new ImageBrush();
            imgBrush.Stretch = System.Windows.Media.Stretch.UniformToFill;
            imgBrush.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"velo_bleu.png", UriKind.Relative));

            Grid MyGrid = new Grid();
            MyGrid.RowDefinitions.Add(new RowDefinition());
            MyGrid.RowDefinitions.Add(new RowDefinition());
            MyGrid.Background = new SolidColorBrush(Colors.Transparent);

            Rectangle MyRectangle = new Rectangle();
            MyRectangle.Fill = imgBrush;
            MyRectangle.Height = 52;
            MyRectangle.Width = 85;
            MyRectangle.SetValue(Grid.RowProperty, 0);
            MyRectangle.SetValue(Grid.ColumnProperty, 0);

            MyGrid.Children.Add(MyRectangle);

            MapLayer layer = new MapLayer();
            MapOverlay overlay = new MapOverlay();
            overlay.GeoCoordinate = pin.GeoCoordinate;
            overlay.Content = MyGrid;
            layer.Add(overlay);

            //Carte.Children.Add(pin);
            Carte.Layers.Add(layer);
        }
开发者ID:CSemmezies,项目名称:TP--WPF-Velo-Bleu,代码行数:57,代码来源:detail.xaml.cs

示例14: CreatePushpins

        private void CreatePushpins()
        {
            var overlay = new MapOverlay();
            overlay.GeoCoordinate = new System.Device.Location.GeoCoordinate(19.433481, -99.134065);
            BitmapImage bmp = new BitmapImage(new Uri("/mexico.jpg", UriKind.Relative));
            overlay.Content = new Image() { Source = bmp, Width = 50 };

            var overlay2 = new MapOverlay();
            overlay2.GeoCoordinate = new System.Device.Location.GeoCoordinate(-12.115488, -77.044122);
            BitmapImage bmp2 = new BitmapImage(new Uri("/peru.jpg", UriKind.Relative));
            overlay2.Content = new Image() { Source = bmp2, Width=50 };

            var layer = new MapLayer();
            layer.Add(overlay);
            layer.Add(overlay2);

            map.Layers.Add(layer);
        }
开发者ID:janneison,项目名称:Semana4,代码行数:18,代码来源:MainPage.xaml.cs

示例15: MainPage

        // Constructor
        public MainPage()
        {
            InitializeComponent();

            markerLayer = new MapLayer();

            startMark = AddMarkersToMap("Start", new GeoCoordinate(60.2214, 24.7572));
            markerLayer.Add(startMark);

            enddMark = AddMarkersToMap("End", new GeoCoordinate(61.4468, 23.8646));
            markerLayer.Add(enddMark);

            map1.Layers.Add(markerLayer);

            geoQ = new RouteQuery();
            geoQ.QueryCompleted += geoQ_QueryCompleted;

            Debug.WriteLine("All construction done for rutting");
        }
开发者ID:ZubaerNaseem,项目名称:maps-samples,代码行数:20,代码来源:MainPage.xaml.cs


注:本文中的MapLayer.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。