0

我有一个类可以处理地图上的绘制位图,问题是当你缩小图像时,图像会变大,而接近时会变小。我想做相反的事情,当你接近时变大,当你离开时变小。

我把绘画类对象:

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);
        }
    }
}
4

0 回答 0