1

我制作了一个带有 osmdroid mapview 的应用程序,用户可以将 jpeg 作为groundoverlay 导入到地图中,导入的图像将是建筑物的平面图并将填充 mapview。有谁知道我将如何将地图视图的滚动边界设置为groundoverlay 的边缘,以便用户无法滚动到groundoverlay/平面图之外。

任何关于此的想法都会很棒

4

1 回答 1

2

用 设置可视区域mapView.setScrollableAreaLimit(groundOverlayBoundingBox)

您可能还需要限制最小缩放级别 ( MapView#setMinZoomLevel)。

现在,如何计算GroundOverlay BoundingBox

  • 如果你GroundOverlay没有轴承 => 查看GroundOverlay#draw源代码,atpEastpSouthEast计算。这应该是一个很好的起点。

编辑 - 数学:

GeoPoint pEast = position.destinationPoint(width, 90.0f);   
GeoPoint pSouthEast = pEast.destinationPoint(height, -180.0f);
int north = position.getLatitudeE6()*2 - pSouthEast.getLatitudeE6();
int west = position.getLongitudeE6()*2 - pEast.getLongitudeE6();
BoundingBoxE6 bb = new BoundingBoxE6(north, pEast.getLongitudeE6(),
  pSouthEast.getLatitudeE6(), west);
  • 如果它有一个轴承,......棘手。GeometryMath#getBoundingBoxForRotatatedRectangleosmdroid 中有一个可以提供帮助的。但是卷轴不能与地面覆盖边缘完美契合。
于 2014-07-28T16:36:45.417 回答