缩放以显示必应地图中的所有位置 [英] Zoom to show all locations in bing maps
问题描述
说我有3个图钉:(1)加利福尼亚,(2)佛罗里达,(3)纽约.为了使所有这3个对象都可见,我必须缩小得足够远才能看到整个国家.但是要说的不是,我有(1)加利福尼亚,(2)内华达州,(3)德克萨斯州.我只需要缩小以覆盖美国的西南角即可. Windows Phone 7 API的bing映射中是否有任何功能可以帮助我解决此问题.基本上,我要缩小到足以看到一组位置的位置.
Say I have 3 pushpins: (1) California, (2) Florida, (3) New York. In order for all the 3 of them to be visible, I'd have to zoom out far enough to pretty much see the whole country. But say instead of that I had (1) California, (2) Nevada, (3) Texas. I'd have to zoom out only to cover the south west corner of the US. Is there any function in the bing maps for Windows Phone 7 API that helps me with this. Basically, I want to zoom out just enough to see a set of locations.
谢谢!
推荐答案
是.有可能的. CurrentItems是我的地图的来源.
Yes. it is possible. CurrentItems is source for my map.
var locations = CurrentItems.Select(model => model.Location);
map.SetView(LocationRect.CreateLocationRect(locations));
这篇关于缩放以显示必应地图中的所有位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!