• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MapIcon类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MapIcon类属于命名空间,在下文中一共展示了MapIcon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetLocation

        public async void GetLocation()
        {
            Geoposition pos = await _geolocator.GetGeopositionAsync();
            var pin = new MapIcon()
            {
                Location = pos.Coordinate.Point,
                Title = "You are here!",
                Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Image/Location_Icon.png")),
                NormalizedAnchorPoint = new Point() { X = 0.32, Y = 0.78 },
            };
            map.MapElements.Add(pin);
            await map.TrySetViewAsync(pos.Coordinate.Point, 15);
            (App.Current as App).User.user_x = pos.Coordinate.Point.Position.Latitude.ToString();
            (App.Current as App).User.user_y = pos.Coordinate.Point.Position.Longitude.ToString();
            using (var client = new HttpClient())
            {
                try
                {
                    client.BaseAddress = new Uri(@"http://pubbus-coeus.azurewebsites.net/");
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    HttpResponseMessage response = await client.PutAsJsonAsync("api/users/" + (App.Current as App).User.user_id, (App.Current as App).User);

                    //Printf("Da cap nhat vi tri: " + (App.Current as App).User.user_x + ":" + (App.Current as App).User.user_y);
                }
                catch (Exception ex)
                {
                    Printf(ex.Message);
                }
            }
        }
开发者ID:pubbus,项目名称:Projects,代码行数:31,代码来源:Map_Control.xaml.cs


示例2: CreateListElement

        private void CreateListElement()
        {
            try
            {
                var mapIcon = new MapIcon
                {
                    Location = new Geopoint(new BasicGeoposition
                    {
                        Latitude = UserLocation.Latitude,
                        Longitude = UserLocation.Longitude
                    }),
                    NormalizedAnchorPoint = new Point(0.5, 1.0),
                    Title = Singleton.Singleton.Instance().CurrentUser.username
                };

                ListMapIcons.Add(mapIcon);
                MapElements = new ObservableCollection<MapElement>();
                foreach (var icon in ListMapIcons)
                {
                    MapElements.Add(icon);
                }
            }
            catch (Exception)
            {
                new MessageDialog(loader.GetString("ErrorGeo")).ShowAsync();
            }

        }
开发者ID:Haz3,项目名称:Soonzik,代码行数:28,代码来源:GeolocalisationViewModel.cs


示例3: button_Click

        private async void button_Click(object sender, RoutedEventArgs e)
        {
            var accessStatus = await Geolocator.RequestAccessAsync();
            switch (accessStatus)
            {
                case GeolocationAccessStatus.Allowed:
                    Geolocator gl = new Geolocator();
                    Geoposition gp = await gl.GetGeopositionAsync();
                    Geopoint myloc = gp.Coordinate.Point;
                    map1.Center = myloc;
                    map1.ZoomLevel = 15;
                    map1.LandmarksVisible = true;
                    MapIcon mi = new MapIcon();
                    mi.Location = myloc;
                    mi.NormalizedAnchorPoint = new Point(0.5, 1.0);
                    mi.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/pin.png"));
                    mi.ZIndex = 0;
                    map1.MapElements.Add(mi);
                    break;
                case GeolocationAccessStatus.Denied:
                    break;
                case GeolocationAccessStatus.Unspecified:
                    break;
            }

        }
开发者ID:sarthakbhol,项目名称:Windows10AppSamples,代码行数:26,代码来源:MainPage.xaml.cs


示例4: HandleMapPath

 /// <summary>
 /// Handles MVVM Message for Map path.
 /// </summary>
 /// <param name="path">The path.</param>
 private void HandleMapPath(Geopath path)
 {
     // Remove previous paths from MapControl
     mapActivity.MapElements.Clear();
     // Validate input path
     if (path != null &&
         path.Positions.Any())
     {
         // Configure path to draw with polyline and assign path to MapControl
         MapPolyline loMapPolyline = new MapPolyline();
         loMapPolyline.Path = path;
         loMapPolyline.StrokeColor = (Color)Resources["SystemAccentColor"];
         loMapPolyline.StrokeThickness = 3;
         mapActivity.MapElements.Add(loMapPolyline);
         // Configure start position icon and assign path to MapControl
         BasicGeoposition loStartPosition = path.Positions[0];
         MapIcon loStartIcon = new MapIcon();
         loStartIcon.Location = new Geopoint(loStartPosition);
         loStartIcon.NormalizedAnchorPoint = new Point(0.5, 1.0);
         loStartIcon.Title = XportBand.Resources.Strings.MapPositionStartText;
         loStartIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/LocationDarkGreen.png"));
         mapActivity.MapElements.Add(loStartIcon);
         // Configure end position icon and assign path to MapControl
         BasicGeoposition loEndPosition = path.Positions[path.Positions.Count - 1];
         MapIcon loEndIcon = new MapIcon();
         loEndIcon.Location = new Geopoint(loEndPosition);
         loEndIcon.NormalizedAnchorPoint = new Point(0.5, 1.0);
         loEndIcon.Title = XportBand.Resources.Strings.MapPositionEndText;
         loEndIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/LocationDarkRed.png"));
         mapActivity.MapElements.Add(loEndIcon);
         // Center map to start position and assign default zoom level to 15 (TODO: auto-zoom)
         mapActivity.Center = new Geopoint(loStartPosition);
         mapActivity.ZoomLevel = 15;
     }
 }
开发者ID:yorchideas,项目名称:XportBand,代码行数:39,代码来源:ActivityDetailsView.xaml.cs


示例5: OnNavigatedTo

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;
            // Map Token for testing purpose,    
            // otherwise you'll get an alart message in Map Control   
            MyMap.MapServiceToken = "NGj5WksCMeAFIY5vFJQ3-Q";
            geolocator = new Geolocator();
            geolocator.DesiredAccuracyInMeters = 50;

            try
            {
                // Getting Current Location   
                Geoposition geoposition = await geolocator.GetGeopositionAsync(
                    maximumAge: TimeSpan.FromMinutes(5),
                    timeout: TimeSpan.FromSeconds(10));

                MapIcon mapIcon = new MapIcon();
                // Locate your MapIcon   
                mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/mygeo.png"));
                // Show above the MapIcon   
                mapIcon.Title = "我的位置";
                // Setting up MapIcon location   
                mapIcon.Location = new Geopoint(new BasicGeoposition()
                {
                    //Latitude = geoposition.Coordinate.Latitude, [Don't use]   
                    //Longitude = geoposition.Coordinate.Longitude [Don't use]   
                    Latitude = geoposition.Coordinate.Point.Position.Latitude,
                    Longitude = geoposition.Coordinate.Point.Position.Longitude
                });
                // Positon of the MapIcon   
                mapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5);
                MyMap.MapElements.Add(mapIcon);
                List<Geolocation> allsite = await Geolocator_service.Read();
                foreach(Geolocation item in allsite)
                {
                    MapIcon mapItem = new MapIcon();
                    // Locate your MapIcon   
                    mapItem.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/geo.png"));
                    // Show above the MapIcon   
                    mapItem.Title = item.Name;
                    // Setting up MapIcon location   
                    mapItem.Location = new Geopoint(new BasicGeoposition()
                    {
                        //Latitude = geoposition.Coordinate.Latitude, [Don't use]   
                        //Longitude = geoposition.Coordinate.Longitude [Don't use]   
                        Latitude = item.Latitude,
                        Longitude = item.Longitude
                    });
                    // Positon of the MapIcon   
                    //mapItem.NormalizedAnchorPoint = new Point(0.5, 0.5);
                    MyMap.MapElements.Add(mapItem);
                }
                // Showing in the Map   
                //
            }
            catch (UnauthorizedAccessException)
            {
                new MessageDialog("定位服务被关闭!");
            }   
        }
开发者ID:bajinsheng,项目名称:Traveler,代码行数:60,代码来源:FootPrint.xaml.cs


示例6: StartCurrentPosition

        private void StartCurrentPosition()
        {
            _progressIndicator.IsIndeterminate = true;

            _customLayer = new MapLayer();
            MapControl.Layers.Add(_customLayer);
            MapControl.Center = new GeoCoordinate(48.8607, 2.3504);
            MapControl.ZoomLevel = 10;

            Random rand = new Random();
            
            foreach (var evt in model.ItemsByDate)
            {
                MapIcon posIcon = new MapIcon()
                {
                    Width = 40,
                    Height = 40,
                    AnchorPoint = MapIconAnchorPoint.Center,
                    Coordinate = new GeoCoordinate(evt.loc[0], evt.loc[1]),
                    Source = new Uri("/PanoramaApp1;component/Images/MapObjects.png", UriKind.RelativeOrAbsolute),
                    Content =  GetPushPinTemplate( evt.text + " - " + evt.nb_plus, evt)
                };
                _customLayer.Children.Add(posIcon);
            }

            _progressIndicator.IsIndeterminate = false;
        }
开发者ID:remiolivier,项目名称:bma-myhero,代码行数:27,代码来源:MapEventsListPage.xaml.cs


示例7: InitializeMap

        private async void InitializeMap()
        {
            var queryHintGeoPosition = new BasicGeoposition
            {
                Latitude = 47.643,
                Longitude = -122.131
            };
            var result =
                await
                    MapLocationFinder.FindLocationsAsync(App.EventModel.EventAddress, new Geopoint(queryHintGeoPosition));
            if (result != null && result.Locations.Count != 0)
            {
                await mapControl.TrySetViewAsync(result.Locations[0].Point, 16, 0, 0, MapAnimationKind.None);
            }

            var mapIconStreamReference =
                RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/mappin.png"));
            var mapIcon = new MapIcon
            {
                Location = mapControl.Center,
                NormalizedAnchorPoint = new Point(0.5, 1.0),
                Title = "Event location",
                Image = mapIconStreamReference,
                ZIndex = 0
            };

            mapControl.MapElements.Add(mapIcon);
        }
开发者ID:ValdimarThor,项目名称:UWPQuickStart,代码行数:28,代码来源:EventDetails.xaml.cs


示例8: DrawPolyline

        private async Task DrawPolyline(List<BasicGeoposition> geopositions)
        {
            ActivityMap.MapElements.Clear();

            if (geopositions.Any())
            {
                var polyLine = new MapPolyline { Path = new Geopath(geopositions), StrokeThickness = 4, StrokeColor = (Color)App.Current.Resources["StravaRedColor"] };
                ActivityMap.MapElements.Add(polyLine);

                MapIcon startMapIcon = new MapIcon();
                startMapIcon.Location = new Geopoint(geopositions.First());
                startMapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5);
                startMapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Start.png"));
                ActivityMap.MapElements.Add(startMapIcon);

                MapIcon endMapIcon = new MapIcon();
                endMapIcon.Location = new Geopoint(geopositions.Last());
                endMapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5);
                endMapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/End.png"));
                ActivityMap.MapElements.Add(endMapIcon);

                var zoomed = false;
                while (!zoomed)
                    zoomed = await ActivityMap.TrySetViewBoundsAsync(GeoboundingBox.TryCompute(geopositions), null, MapAnimationKind.None);
            }
        }
开发者ID:cgourlay,项目名称:Kliva,代码行数:26,代码来源:ActivityDetailControl.xaml.cs


示例9: AddMapIcon

        public async void AddMapIcon(Geopoint snPoint,string namePin)
        {
            try
            {
                myLocation = await refreshLoc();
                if (myLocation != null)
                {
                    string adresse = await gs.reverseGeocode(myLocation);
                    MapControl1.Center = myLocation;
                    //set a map icon start
                    MapIcon mapIconStart = new MapIcon();
                    mapIconStart.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/icon-map.png"));
                    mapIconStart.Location = myLocation;
                    mapIconStart.NormalizedAnchorPoint = new Point(0.5, 1.0);
                    mapIconStart.Title = namePin;
                    mapIconStart.ZIndex = 1;
                    MapControl1.MapElements.Add(mapIconStart);
                    MapControl1.ZoomLevel = 14;
                }
                else
                {
                    Debug.WriteLine("Erreur geoloc Null");
                }
            }
            catch
            {

            }
        }
开发者ID:StartupMobilite,项目名称:Apero,代码行数:29,代码来源:EventMap.xaml.cs


示例10: AddMapIcon

 private void AddMapIcon()
 {
     MapIcon icon = new MapIcon();
     icon.Location = new Geopoint(geo);
     icon.NormalizedAnchorPoint = new Point(0.5, 1.0);
     icon.Title = name;
     map.MapElements.Add(icon);
 }
开发者ID:wc-graffiti,项目名称:benjonorakugaki-wp8,代码行数:8,代码来源:Spot.cs


示例11: AddMapIcon

 private void AddMapIcon(Geocoordinate location, String name)
 {
     //Add an mapicon for the given location
     MapIcon mapIcon = new MapIcon();
     mapIcon.Location = location.Point;
     mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0);
     mapIcon.Title = name;
     InputMap.MapElements.Add(mapIcon);
 }
开发者ID:pjcbakx,项目名称:RouteFencingWindows10,代码行数:9,代码来源:MainPage.xaml.cs


示例12: AddIcon

 private void AddIcon(double latitude, double longitude, string title, string image, bool navigate = false)
 {
     MapIcon mapIcon1 = new MapIcon();
     mapIcon1.Location = new Geopoint(new BasicGeoposition() { Latitude = latitude, Longitude = longitude });
     mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0);
     mapIcon1.Title = title;
     mapIcon1.Image = RandomAccessStreamReference.CreateFromUri(new Uri(string.Format("ms-appx:///Assets/DataImages/{0}", image)));
     mapIcon1.ZIndex = 0;
     mapControl.MapElements.Add(mapIcon1);
 }
开发者ID:mvegaca,项目名称:EventsCode,代码行数:10,代码来源:MapListPage.xaml.cs


示例13: button_Click

 private void button_Click(object sender, RoutedEventArgs e)
 {
     MapIcon mapIcon1 = new MapIcon();
     mapIcon1.Location = myMap.Center;
     mapIcon1.NormalizedAnchorPoint = new Point(0.5, 1.0);
     mapIcon1.Title = "My Friend";
     mapIcon1.Image = mapIconStreamReference;
     mapIcon1.ZIndex = 0;
     myMap.MapElements.Add(mapIcon1);
 }
开发者ID:AparnaChinya,项目名称:SRM-Demos,代码行数:10,代码来源:MainPage.xaml.cs


示例14: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var vm = new MapViewModel((Distributeurs)e.Parameter);
            this.DataContext = vm;

            var itemGeoPoint = new Geopoint(new BasicGeoposition() { Latitude = vm.ItemDistributeur.Geometry.Coordonnees[1], Longitude = vm.ItemDistributeur.Geometry.Coordonnees[0] });
            var MaMapIcon1 = new MapIcon();
            MaMapIcon1.Location = itemGeoPoint;

            MaMap.MapElements.Add(MaMapIcon1);
        }
开发者ID:nicodev77,项目名称:AppUniverselleBach3,代码行数:11,代码来源:Map.xaml.cs


示例15: AddIcon

 public void AddIcon()
 {
     for (int i = 0; i < pushPin.Items().Count; i++)
     {
         MapIcon myIcon = new MapIcon();
         myIcon.NormalizedAnchorPoint = new Point(0.5, 1.0);
         myIcon.Title = "Apartment here";
         MyMap.MapElements.Add(myIcon);
         myIcon.Location = pushPin.MyGeopoint(i);
     }
 }
开发者ID:ystvan,项目名称:FranceVacancesProject,代码行数:11,代码来源:Map.xaml.cs


示例16: displayPOIbicikelj

 private void displayPOIbicikelj(StationInfo bicikelj) {
     BasicGeoposition snPosition = new BasicGeoposition() { Latitude = double.Parse(bicikelj.lat), Longitude = double.Parse(bicikelj.lng) };
     Geopoint snPoint = new Geopoint(snPosition);
     MapIcon mapIcon = new MapIcon();
     mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/bikegreen.png"));
     mapIcon.Location = snPoint;
     mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0);
     mapIcon.Title = bicikelj.name;
     mapIcon.ZIndex = 0;
     myMap.MapElements.Add(mapIcon);
 }
开发者ID:KlemenKozelj,项目名称:SlovenianTrafficInfos,代码行数:11,代码来源:bingMap.xaml.cs


示例17: UpdateMap

        private void UpdateMap()
        {
            resultsMap.Children.Clear();
            foreach (PlaceViewModel p in App.ViewModel.Places)
            {
                MapIcon icon = new MapIcon();
                icon.Location = new Geopoint(new BasicGeoposition() { Latitude = p.Lat, Longitude = p.Lon });
                icon.Title = App.ViewModel.Places.IndexOf(p).ToString();

                resultsMap.MapElements.Add(icon);
            }
        }
开发者ID:Saulmil,项目名称:FindR,代码行数:12,代码来源:Results.xaml.cs


示例18: displayPOIparking

        private void displayPOIparking(Parkirisca parking) {
            BasicGeoposition snPosition = new BasicGeoposition() { Latitude = parking.KoordinataY_wgs, Longitude = parking.KoordinataX_wgs };
            Geopoint snPoint = new Geopoint(snPosition);

            MapIcon mapIcon = new MapIcon();
            mapIcon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/parkgreen.png"));
            mapIcon.Location = snPoint;
            mapIcon.NormalizedAnchorPoint = new Point(0.5, 1.0);
            mapIcon.Title = parking.Ime;
            mapIcon.ZIndex = 0;
            myMap.MapElements.Add(mapIcon);
        }
开发者ID:KlemenKozelj,项目名称:SlovenianTrafficInfos,代码行数:12,代码来源:bingMap.xaml.cs


示例19: OnNavigatedTo

        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            // Specify a known location.
            BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 48.869465, Longitude = 2.394892 };
            Geopoint cityCenter = new Geopoint(cityPosition);

            // Set the map location.
            MapControl1.Center = cityCenter;
            MapControl1.ZoomLevel = 14;
            MapControl1.LandmarksVisible = true;

            // Set your current location.
            var accessStatus = await Geolocator.RequestAccessAsync();
            switch (accessStatus)
            {
                case GeolocationAccessStatus.Allowed:

                    // Get the current location.
                    Geolocator geolocator = new Geolocator();
                    Geoposition pos = await geolocator.GetGeopositionAsync();
                    Geopoint myLocation = pos.Coordinate.Point;

                    // Set the map location.
                    MapControl1.Center = myLocation;
                    MapControl1.ZoomLevel = 12;
                    MapControl1.LandmarksVisible = true;

                    BasicGeoposition startLocation = new BasicGeoposition() { Latitude = myLocation.Position.Latitude, Longitude = myLocation.Position.Longitude };

                    //set a map icon (mylocation)

                    Geopoint snPoint = new Geopoint(startLocation);
                    MapIcon mapIconStart = new MapIcon();
                    mapIconStart.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/map-pin.png"));
                    mapIconStart.Location = snPoint;
                    mapIconStart.NormalizedAnchorPoint = new Point(0.5, 1.0);
                    mapIconStart.Title = "Vous";
                    mapIconStart.ZIndex = 0;
                    MapControl1.MapElements.Add(mapIconStart);


                    break;

                case GeolocationAccessStatus.Denied:
                    // Handle the case  if access to location is denied.
                    break;

                case GeolocationAccessStatus.Unspecified:
                    // Handle the case if  an unspecified error occurs.
                    break;
            }
        }
开发者ID:StartupMobilite,项目名称:Apero,代码行数:52,代码来源:EventMap.xaml.cs


示例20: updateControl

 private void updateControl()
 {
     Debug.WriteLine("UpdateControl");
     BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = Latitude, Longitude = Longitude };
     Geopoint cityCenter = new Geopoint(cityPosition);
     mapC.Center = cityCenter;
     MapIcon mapicon = new MapIcon();
     mapicon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///images/mapicon_scaled.png"));
     mapicon.Location = cityCenter;            
     mapicon.NormalizedAnchorPoint = new Point(0.5, 1.0);
     mapicon.ZIndex = 0;
     mapC.MapElements.Add(mapicon);
 }
开发者ID:agangal,项目名称:TeamSnapV3,代码行数:13,代码来源:MapControlForListView.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MapId类代码示例发布时间:2022-05-24
下一篇:
C# MapEntityIndex类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap