本文介绍了两点之间的中心图WinRT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试将Windows Phone地图的中心定位在两个点之间,调整中心和缩放以使这些点同时可见.
im trying to center the windows phone map between two points, adjusting center and zoom to make that points visible at the same time.
在Android和IOS上有执行此操作的功能,例如,这是在Android中执行的操作:
Im Android and IOS there are functions to do it, as example this is how to do it in Android:
LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(myPos.getPosition());
builder.include(defaultPos.getPosition());
mapa.animateCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 50));
如何在WinRT中做同样的事情?
How can i do the same in WinRT?
谢谢.
推荐答案
如果要使用Windows Phone 8.1而不是WinRT(Windows 8/8.1),则可以执行以下操作:
If you are targeting Windows Phone 8.1 instead of WinRT (Windows 8/8.1) then you can do the following:
var geoboundingBox = new Windows.Devices.Geolocation.GeoboundingBox(
new BasicGeoposition() { Latitude = 40, Longitude = -90 },
new BasicGeoposition() { Latitude = 45, Longitude = -100 });
map.TrySetViewAsync(new Geopoint(geoboundingBox.Center));
这篇关于两点之间的中心图WinRT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!