0

我们想检查一个位置是否在可见的 Bing 地图上,但我们目前的努力告诉我们所有位置都在地图上。

初始化地图后,我们使用 Map 'getBounds' 方法返回当前地图的 LocationRect:

var mapRect = MAP.getBounds();

然后我们使用地图中的值初始化一个位置矩形:

var rect = new Microsoft.Maps.LocationRect(mapRect);

然后使用 LocationRect 方法“包含”进行检查:

alert ("result:" + rect.contains(new Microsoft.Maps.Location(38.0, 5.0)));

我想这是因为我们用错误的值初始化矩形,我们将不胜感激一些关于我们做错了什么的线索。

4

1 回答 1

0

我对文档的误解。LocationRect 应该被调用

var rect = new Microsoft.Maps.LocationRect(mapRect.location, mapRect.height, mapRect.width);

于 2013-02-06T00:02:09.983 回答