windows phone 8.1 bing 映射聚类
windows phone 8.1 bing maps clustering
您好,我正在使用 this link and i have a MapLayer with multiple MapOverlays with differents pois on map. And i want to do the clustering thing. I try to do this 中描述的 windows 地图控件,但不存在 ClusteringLayer,也没有图钉。我该怎么做聚类?
var cluster = new ClusteringLayer();
layer = new ClusteringLayer(Mymap)
{
ClusterRadius = 10,
ClusterType = ClusteringType.Grid
};
//Add event handlers to create the pushpins
layer.CreateClusteredItemPushpin += CreateClusteredItemPushpin1;
layer.CreateItemPushpin+=layer_CreateItemPushpin;
private MapOverlay layer_CreateItemPushpin(object item, ClusteredPoint clusterInfo)
{
var x = clusterInfo.Location;
var poi = new BuildingPoi { Coordinate = x, Buid = _selectedBuild };
var imagePoiLocation = new Image
{
Source = new BitmapImage(new Uri("/Assets/MapPin.png", UriKind.Relative)),
DataContext = poi
};
var over = new MapOverlay();
imagePoiLocation.Tap += loadClickedBuilding;
over.Content = imagePoiLocation;
over.PositionOrigin = new Point(0.5, 0.5);
over.GeoCoordinate = new GeoCoordinate(x.Latitude, x.Longitude);
return over;
}
private MapOverlay CreateClusteredItemPushpin1(ClusteredPoint clusterInfo)
{
var x = clusterInfo.Location;
var poi = new BuildingPoi { Coordinate = x, Buid = _selectedBuild };
var imagePoiLocation = new Image
{
Source = new BitmapImage(new Uri("/Assets/MapPin.png", UriKind.Relative)),
DataContext = poi
};
var over = new MapOverlay();
imagePoiLocation.Tap += loadClickedBuilding;
over.Content = imagePoiLocation;
over.PositionOrigin = new Point(0.5, 0.5);
over.GeoCoordinate = new GeoCoordinate(x.Latitude, x.Longitude);
return over;
}
由于他们没有任何可直接引用的 nuget 包或 dll,您需要下载特定 class 的 source code,例如 ClusteringLayer
& PushPin
将相关的 .cs 文件或项目本身添加到您的机器,并在您的 windows phone 项目中添加该项目的引用以获取 ClusteringLayer
和 PushPin
classes .
请参阅以下 ClusteringLayer
class 的屏幕截图。对于其他classes,只需将解决方案导入visual studio,您将看到所有classes 的源代码。顺便说一句,ClusteringLayer
构造函数在集群中至少需要一个参数。
我建议你下载源代码,并通过源代码中的示例熟悉它的用法。
您好,我正在使用 this link and i have a MapLayer with multiple MapOverlays with differents pois on map. And i want to do the clustering thing. I try to do this 中描述的 windows 地图控件,但不存在 ClusteringLayer,也没有图钉。我该怎么做聚类?
var cluster = new ClusteringLayer();
layer = new ClusteringLayer(Mymap)
{
ClusterRadius = 10,
ClusterType = ClusteringType.Grid
};
//Add event handlers to create the pushpins
layer.CreateClusteredItemPushpin += CreateClusteredItemPushpin1;
layer.CreateItemPushpin+=layer_CreateItemPushpin;
private MapOverlay layer_CreateItemPushpin(object item, ClusteredPoint clusterInfo)
{
var x = clusterInfo.Location;
var poi = new BuildingPoi { Coordinate = x, Buid = _selectedBuild };
var imagePoiLocation = new Image
{
Source = new BitmapImage(new Uri("/Assets/MapPin.png", UriKind.Relative)),
DataContext = poi
};
var over = new MapOverlay();
imagePoiLocation.Tap += loadClickedBuilding;
over.Content = imagePoiLocation;
over.PositionOrigin = new Point(0.5, 0.5);
over.GeoCoordinate = new GeoCoordinate(x.Latitude, x.Longitude);
return over;
}
private MapOverlay CreateClusteredItemPushpin1(ClusteredPoint clusterInfo)
{
var x = clusterInfo.Location;
var poi = new BuildingPoi { Coordinate = x, Buid = _selectedBuild };
var imagePoiLocation = new Image
{
Source = new BitmapImage(new Uri("/Assets/MapPin.png", UriKind.Relative)),
DataContext = poi
};
var over = new MapOverlay();
imagePoiLocation.Tap += loadClickedBuilding;
over.Content = imagePoiLocation;
over.PositionOrigin = new Point(0.5, 0.5);
over.GeoCoordinate = new GeoCoordinate(x.Latitude, x.Longitude);
return over;
}
由于他们没有任何可直接引用的 nuget 包或 dll,您需要下载特定 class 的 source code,例如 ClusteringLayer
& PushPin
将相关的 .cs 文件或项目本身添加到您的机器,并在您的 windows phone 项目中添加该项目的引用以获取 ClusteringLayer
和 PushPin
classes .
请参阅以下 ClusteringLayer
class 的屏幕截图。对于其他classes,只需将解决方案导入visual studio,您将看到所有classes 的源代码。顺便说一句,ClusteringLayer
构造函数在集群中至少需要一个参数。
我建议你下载源代码,并通过源代码中的示例熟悉它的用法。