Closed apachemaven closed 10 years ago
需要说明的是这里内部采用的是整形坐标,单位是微秒。这和Android's MapView (v1 API) 是一样的。
所以这里GeoPoint(30, 120)应该改成GeoPoint(30 * 1E6, 120 * 1E6)
为什么GeoPoint(30.1, 120.1)正确的,你可以看下构造函数的实现。 GeoPoint 有两个构造函数。
public GeoPoint(final int aLatitudeE6, final int aLongitudeE6) {
this.mLatitudeE6 = aLatitudeE6;
this.mLongitudeE6 = aLongitudeE6;
}
public GeoPoint(final double aLatitude, final double aLongitude) {
this.mLatitudeE6 = (int) (aLatitude * 1E6);
this.mLongitudeE6 = (int) (aLongitude * 1E6);
}
It seems that the
GeoPoint
passed to the methodcan not be a
integer
.For example, the following code works:
but this does not: