Windows phone 7 诺基亚地图Windows Phone中的边框
如何获取access地图边框 在WP7 Bing地图中,我可以使用属性BoundingRectangle,但在新的诺基亚地图中,我看不到类似的属性Windows phone 7 诺基亚地图Windows Phone中的边框,windows-phone-7,windows-phone-8,here-api,Windows Phone 7,Windows Phone 8,Here Api,如何获取access地图边框 在WP7 Bing地图中,我可以使用属性BoundingRectangle,但在新的诺基亚地图中,我看不到类似的属性 感谢您的帮助。我的方法是简单地为Map控件添加一个扩展方法,使用控件上的ConvertViewPortPointToGeoCoordination方法返回边界矩形: public static class MapExtensions { /// <summary> /// Returns the bounding rect
感谢您的帮助。我的方法是简单地为Map控件添加一个扩展方法,使用控件上的ConvertViewPortPointToGeoCoordination方法返回边界矩形:
public static class MapExtensions
{
/// <summary>
/// Returns the bounding rectangle representing the area displayed by the map contorl.
/// </summary>
/// <param name="map">The map control whose bounding rectangle should be returned.</param>
/// <returns>The bounding rectangle representing the area displayed by the map contorl.</returns>
public static MapBoundingRectangle GetBoundingRectangle( this Microsoft.Phone.Maps.Controls.Map map )
{
var lowerLeft = map.ConvertViewportPointToGeoCoordinate( new System.Windows.Point( 0, map.ActualHeight ) );
var upperRight = map.ConvertViewportPointToGeoCoordinate( new System.Windows.Point( map.ActualWidth, 0 ) );
return new MapBoundingRectangle( lowerLeft, upperRight );
}
}
可能不是最棒的解决方案,但它解决了我的需要,所以我希望它能有所帮助。我的方法是简单地为Map控件添加一个扩展方法,通过使用控件上的ConvertViewPortPointToGeoCoordination方法返回边界矩形:
public static class MapExtensions
{
/// <summary>
/// Returns the bounding rectangle representing the area displayed by the map contorl.
/// </summary>
/// <param name="map">The map control whose bounding rectangle should be returned.</param>
/// <returns>The bounding rectangle representing the area displayed by the map contorl.</returns>
public static MapBoundingRectangle GetBoundingRectangle( this Microsoft.Phone.Maps.Controls.Map map )
{
var lowerLeft = map.ConvertViewportPointToGeoCoordinate( new System.Windows.Point( 0, map.ActualHeight ) );
var upperRight = map.ConvertViewportPointToGeoCoordinate( new System.Windows.Point( map.ActualWidth, 0 ) );
return new MapBoundingRectangle( lowerLeft, upperRight );
}
}
可能不是最棒的解决方案,但它解决了我的需求,所以我希望它能有所帮助。试试看
GeoCoordinate topLeft = Map.ConvertViewportPointToGeoCoordinate(new Point(0, 0));
GeoCoordinate bottomRight = Map.ConvertViewportPointToGeoCoordinate(new Point(e.NewSize.Width, e.NewSize.Height));
var bounds = LocationRectangle.CreateBoundingRectangle(topLeft, bottomRight);
请参阅LocationRectangle文档
GeoCoordinate topLeft = Map.ConvertViewportPointToGeoCoordinate(new Point(0, 0));
GeoCoordinate bottomRight = Map.ConvertViewportPointToGeoCoordinate(new Point(e.NewSize.Width, e.NewSize.Height));
var bounds = LocationRectangle.CreateBoundingRectangle(topLeft, bottomRight);
请参阅LocationRectangle文档当地图在两个角的ConvertViewPortPointToGeoCoordination之间移动时,可能会提供错误的结果。当地图在两个角的ConvertViewPortPointToGeoCoordination之间移动时,可能会提供错误的结果