マップ上のビットマップの描画を処理するクラスがありますが、ズームアウトすると画像が大きくなり、近づくと小さくなるという問題があります。近づくと大きくなり、離れると小さくなるという、正反対のことをしたいのです。
私は絵画クラスのオブジェクトを置きます:
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);
}
}
}