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


C# MapOverlay类代码示例

本文整理汇总了C#中MapOverlay的典型用法代码示例。如果您正苦于以下问题:C# MapOverlay类的具体用法?C# MapOverlay怎么用?C# MapOverlay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MapOverlay类属于命名空间,在下文中一共展示了MapOverlay类的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: DrawPoint

        public void DrawPoint(Map map, GeoCoordinate position, Color color, BitmapImage picture = null, int sizeInd = 0)
        {
            var border = new Border()
            {
                CornerRadius = new CornerRadius(50),
                Width = 30 + sizeInd * 10,
                Height = 30 + sizeInd * 10,
                BorderThickness = new Thickness(5),
                BorderBrush = new SolidColorBrush(color),
                Background = new SolidColorBrush(color)
            };

            if (picture != null)
                border.Child = new Image() { Source = picture };

            var myOverlay = new MapOverlay()
            {
                Content = border,
                GeoCoordinate = position,
                PositionOrigin = new Point(0, 0.5)
            };

            MapLayer.Add(myOverlay);

            if (map.Layers.Count == 0)
                map.Layers.Add(MapLayer);
        }
开发者ID:Noitacinrofilac,项目名称:Who-s-Hungry,代码行数:27,代码来源:MapDrawingModel.cs

示例7: 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

示例8: webClient_DownloadStringCompleted

        void webClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            var rootObject = JsonConvert.DeserializeObject<Rootobject>(e.Result);
            double lat, longitude;
            MapPolyline line = new MapPolyline();
            line.StrokeColor = Colors.Green;
            line.StrokeThickness = 2;

            double[] coord = new double[2 * rootObject.direction[0].stop.Length];
            for (int i = 0; i < rootObject.direction[0].stop.Length; i++)
            {
                lat = Convert.ToDouble(rootObject.direction[0].stop[i].stop_lat);
                longitude = Convert.ToDouble(rootObject.direction[0].stop[i].stop_lon);

                line.Path.Add(new GeoCoordinate(lat, longitude));

                Ellipse myCircle = new Ellipse();
                myCircle.Fill = new SolidColorBrush(Colors.Green);
                myCircle.Height = 15;
                myCircle.Width = 15;
                myCircle.Opacity = 60;
                MapOverlay myLocationOverlay = new MapOverlay();
                myLocationOverlay.Content = myCircle;
                myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
                myLocationOverlay.GeoCoordinate = new GeoCoordinate(lat, longitude, 200);
                MapLayer myLocationLayer = new MapLayer();
                myLocationLayer.Add(myLocationOverlay);
                map.Layers.Add(myLocationLayer);
            }
            map.MapElements.Add(line);
        }
开发者ID:huyle333,项目名称:windowsapp2013,代码行数:31,代码来源:GreenLine.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: 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

示例11: addLocationToMap

        private void addLocationToMap()
        {
            myMap = map;

            GeoCoordinate myGeocoordinate = new GeoCoordinate(latitude, longitude);

            myMap.Center = myGeocoordinate;
            myMap.ZoomLevel = 14;

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

            MapOverlay myLocationOverlay = new MapOverlay();
            myLocationOverlay.Content = myCircle;
            myLocationOverlay.PositionOrigin = new Point(0, 1);
            myLocationOverlay.GeoCoordinate = myGeocoordinate;

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

            myMap.Layers.Add(myLocationLayer);
        }
开发者ID:Boonstra,项目名称:getConnected-WP8,代码行数:25,代码来源:MapPage.xaml.cs

示例12: 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

示例13: 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

示例14: 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

示例15: CustomPushPinWithToolTip

 public CustomPushPinWithToolTip(HeritageProperty item, MapOverlay overlay)
 {
     this.ParentOverlay = overlay;
     this.Item = item;
     this.Description = item.Name;
     InitializeComponent();
     Loaded += UCCustomToolTip_Loaded;
 }
开发者ID:RhysPartlett,项目名称:oakville-heritage-properties,代码行数:8,代码来源:CustomPushPinWithToolTip.xaml.cs


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