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


C# MapControl.FindMapElementsAtOffset方法代码示例

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


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

示例1: OnMapTapped

        private void OnMapTapped(MapControl sender, MapInputEventArgs args)
        {
            var icon = sender.FindMapElementsAtOffset(args.Position).OfType<MapIcon>().FirstOrDefault();

            if (icon != null)
            {
                CafeSummaryViewModel cafe;
                if (this.cafeMapIcons.TryGetValue(icon, out cafe))
                {
                    this.ViewModel.SelectCafe.Execute(cafe);
                }    
            }
        }
开发者ID:kieranlynam,项目名称:LondonCoffee,代码行数:13,代码来源:MapPage.xaml.cs

示例2: MyMap_MapTapped

		private async void MyMap_MapTapped(MapControl sender, MapInputEventArgs args)
		{
			List<BusStop> startStopList;
			List<BusStop> endStopList;

			var resultText = new StringBuilder();
			resultText.AppendLine(string.Format("Position={0},{1}", args.Position.X, args.Position.Y));
			resultText.AppendLine(string.Format("Location={0:F9},{1:F9}", args.Location.Position.Latitude, args.Location.Position.Longitude));

			foreach (var mapObject in sender.FindMapElementsAtOffset(args.Position))
			{
				//resultText.AppendLine("Found: " + mapObject.ReadData<PointList>().Name);
			}
			//MessageDialogHelper.Show(resultText.Tostring(), "");

			if (wayPoints1 == null)
			{
				wayPoints1 = new Geopoint(new BasicGeoposition { Latitude = args.Location.Position.Latitude, Longitude = args.Location.Position.Longitude });
				MessageDialogHelper.Show("Chọn điểm đến", "");
			}
			else if (wayPoints2 == null)
			{
				wayPoints2 = new Geopoint(new BasicGeoposition { Latitude = args.Location.Position.Latitude, Longitude = args.Location.Position.Longitude });

				try
				{
					startStopList = findNearbyBusStop(wayPoints1, MyConstants.RADIUS);
					endStopList = findNearbyBusStop(wayPoints2, MyConstants.RADIUS);
					List<List<BusNode>> foundAnswerList = new List<List<BusNode>>();
					foreach (BusStop ss in startStopList)
					{
						foreach (BusStop es in endStopList)
						{
							// Begin Algorithm
							AStarAlgo AS1 = new AStarAlgo(ss, es);
							AS1.algorithm();
							if (AS1.answer.Count() != 0)
							{
								// We found an answer
								foundAnswerList.Add(AS1.answer);
							}							
						}
					}

					foreach(List<BusNode> ans in foundAnswerList)
					{
						// print to map
						/*
						for (int i = 0; i < foundAnswer.Count(); i++)
						{
							findShortestRoute(SampleDataSource.FindBusStopByCode(foundAnswer[i].stopCode).geo,
								SampleDataSource.FindBusStopByCode(foundAnswer[i + 1].stopCode).geo);
						}
						*/
						// print to string
						string detail = AStarResultToString(ans);
					}
					
				}
				catch (Exception exc)
				{
					string msg = exc.Message;
				}
				wayPoints2 = null;
				wayPoints1 = null;
			}
		}
开发者ID:haoict,项目名称:MY_WP_BusFinder,代码行数:67,代码来源:FindRoutePage.xaml.cs

示例3: MyMap_MapTapped

    //MapTapped - not Map.Tapped!!
    private async void MyMap_MapTapped(MapControl sender, MapInputEventArgs args)
    {
      var resultText = new StringBuilder();
      resultText.AppendLine(string.Format("Position={0},{1}", args.Position.X, args.Position.Y));
      resultText.AppendLine(string.Format("Location={0:F9},{1:F9}", args.Location.Position.Latitude, args.Location.Position.Longitude));

      foreach( var mapObject in sender.FindMapElementsAtOffset(args.Position))
      {
        resultText.AppendLine("Found: " + mapObject.ReadData<PointList>().Name);
      }
      var dialog = new MessageDialog(resultText.ToString());
      await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => await dialog.ShowAsync());
    }
开发者ID:MuffPotter,项目名称:201505-MVA,代码行数:14,代码来源:MainPage.xaml.cs


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