我有一个类来处理地图上的绘图位图,问题是缩小图像时会变大并且随着接近变小。我想做的恰恰相反,当你接近变大时,当你离开时变小。
我把绘画类对象:
public class OverlayMapa extends Overlay {
private Double latitud = 40.654722 * 1E6;
private Double longitud = -4.694444 * 1E6;
public void draw(Canvas canvas, MapView mapView, boolean shadow)
{
Projection projection = mapView.getProjection();
GeoPoint geoPoint = new GeoPoint(latitud.intValue(), longitud.intValue());
GeoPoint picture = new GeoPoint(latitud.intValue(),longitud.intValue());
int zoom = mapView.getZoomLevel();
if (shadow == false)
{
Point centro = new Point();
projection.toPixels(geoPoint, centro);
Point pPicture = new Point();
projection.toPixels(picture, pPicture);
Bitmap bmPicture = BitmapFactory.decodeResource(mapView.getResources(), R.drawable.picture);
if(zoom == 21)
Bitmap.createScaledBitmap(bmPicture, 293, 173, false);
if(zoom == 20)
Bitmap.createScaledBitmap(bmPicture, 260, 150, false);
if(zoom == 19)
Bitmap.createScaledBitmap(bmPicture, 229, 126, false);
if(zoom == 18)
Bitmap.createScaledBitmap(bmPicture, 200, 100, false);
canvas.drawBitmap(bmPicture, pPicture.x - (bmPicture.getWidth()/2),pPicture.y - (bmPicture.getHeight()/2), null);
}
}
}