C# 选择一个 ;使用群集的地图上的POI

C# 选择一个 ;使用群集的地图上的POI,c#,windows-10-universal,C#,Windows 10 Universal,我目前正在使用Microsoft提供的地图示例。此示例在地图上创建针簇以节省空间 我发现很难选择地图上的POI并获得POI的属性 有超过1000个POI,所以我需要聚类,但样本不清楚如何选择有问题的POI 代码如下: private async Task LoadPlaceInfoAsync() { Uri dataUri = new Uri("ms-appx:///places.txt"); StorageFile file = await Stora

我目前正在使用Microsoft提供的地图示例。此示例在地图上创建针簇以节省空间

我发现很难选择地图上的POI并获得POI的属性

有超过1000个POI,所以我需要聚类,但样本不清楚如何选择有问题的POI

代码如下:

private async Task LoadPlaceInfoAsync()
    {
        Uri dataUri = new Uri("ms-appx:///places.txt");

        StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);
        IList<string> lines = await FileIO.ReadLinesAsync(file);

        // In the places.txt file, each place is represented by three lines:
        // Place name, latitude, and longitude.
        for (int i = 0; i < lines.Count; i += 3)
        {
            PlaceInfo place = new PlaceInfo
            {
                Name = lines[i],
                Location = new PlaceLocation(double.Parse(lines[i + 1]), double.Parse(lines[i + 2]))
            };

            places.Add(place);

        }
    }

    private void refreshMapIcons()
    {
        // Erase the old map icons.
        myMap.MapElements.Clear();

        // Create an icon for each cluster.
        foreach (var cluster in GetClustersForZoomLevel(previousZoomLevel))
        {
            MapIcon mapIcon = new MapIcon
            {
                Location = new Geopoint(cluster.Location.Geoposition),
                CollisionBehaviorDesired = MapElementCollisionBehavior.RemainVisible,
            };

            if (cluster.Places.Count > 1)
            {
                // The cluster represents more than one place. Use a custom marker that shows
                // how many places are represented by this cluster, and place the marker
                // centered at the cluster.
                mapIcon.Image = numberIconReferences[Math.Min(cluster.Places.Count, 9) - 2];
                mapIcon.NormalizedAnchorPoint = new Point(0.5, 0.5);
            }
            else
            {
                // The cluster represents a single place. Label the cluster with the place name.
                mapIcon.Title = cluster.Places[0].Name;
            }
            myMap.MapElements.Add(mapIcon);
        }
    }
private async Task LoadPlaceInfoAsync()
{
Uri dataUri=新的Uri(“ms-appx:///places.txt");
StorageFile文件=等待StorageFile.GetFileFromApplicationUriAsync(数据URI);
IList lines=await FileIO.ReadLinesAsync(文件);
//在places.txt文件中,每个位置由三行表示:
//地名、纬度和经度。
对于(int i=0;i1)
{
//群集代表多个位置。请使用显示的自定义标记
//此簇表示多少个位置,并放置标记
//以集群为中心。
mapIcon.Image=numberIconReferences[Math.Min(cluster.Places.Count,9)-2];
mapIcon.NormalizedAnchorPoint=新点(0.5,0.5);
}
其他的
{
//群集表示单个位置。请使用地名标记群集。
mapIcon.Title=cluster.Places[0]。名称;
}
myMap.MapElements.Add(mapIcon);
}
}

您希望如何选择POI?通过点击/点击?或者别的什么?嗨,我想能够点击POI。这将是一个UWP应用程序,所以我需要同时做这两件事,但目前我将集中精力开发手机。嗨@清道夫,你对如何做到这一点有什么想法吗?