我正在尝试在地图上显示图钉,但由于我有很多图钉,我只想在地图的可视区域内显示图钉,这有望使地图更具响应性。
我从查询到数据库中获取 xy 点列表。这是我到目前为止的代码..
List<Pushpin> ListofPoints = new List<Pushpin>();
foreach (var element in query)
{
//Add a pin to the map
Pushpin pushpin = new Pushpin();
Location location = new Location();
location.Latitude = Convert.ToDouble(element.X);
location.Longitude = Convert.ToDouble(element.Y);
pushpin.Location = location;
ListofPoints.Add(pushpin);
map1.Children.Add(pushpin);
}
// Position map based on a collection of Pushpins points
var x = from l in ListofPoints
select l.Location;
map1.SetView(LocationRect.CreateLocationRect(x));
ListofPoints.Clear();
任何人都可以就如何仅在地图的可视区域上显示点提供任何建议/代码吗?
谢谢