【发布时间】:2012-10-04 02:30:53
【问题描述】:
我有一个 MapView,我在上面调用 getController().zoomToSpan()。我对 zoomToSpan() 的问题是我希望在地图图钉之外有一个一致的(例如,15dp)填充,以便可以选择它们而无需用户捏合来缩小。目前我正在使用地图图钉的最小/最大长/纬度填充 zoomToSpan(),因此边缘上的图钉不会立即可见或可选择。
我考虑过使用固定的长/纬度填充,但我不能保证地图大头针不会太近或太远。因此,虽然固定的 long/lat 填充可能适用于大多数情况,但并非适用于所有情况。
这就是我当前设置 zoomToPan() 的方式:
mapView.getController().zoomToSpan(MapPoint.convertToGeoPoint(Math.abs(fMinLat - fMaxLat)), MapPoint.convertToGeoPoint(Math.abs(fMinLong - fMaxLong)));
这是我对如何设置它的一个想法,但我不确定它是否真的解决了问题,或者是否有更好的方法来做到这一点:
mapView.getController().zoomToSpan(MapPoint.convertToGeoPoint((float) (Math.abs(fMinLat-fMaxLat) + (Math.abs(fMaxLat - fMaxLat)) * 0.5)), MapPoint.convertToGeoPoint((float) (Math.abs(fMinLong-fMaxLong) + (Math.abs(fMinLong - fMaxLong) * 0.5))));
我已经检查了这些问题,但我已经过了让它发挥作用的点;我只是想让它变得优美:zoomToSpan implementation problem 和 Calculating zoomToSpan() degrees based on min/max lat/lng to be in the mapView。
【问题讨论】:
标签: java android google-maps