Issue
I have been searching for solution on this problem for a couple of days now. I want to add a image as an overlay(or whatever is the best solution). The image visualize a part of the map but with it's own graphics. So it's important that it scales, positions and behaves as if it were a part of the map.
The image is quite large(800x1200) so maybe it can be an advantage to use som type of tilebased solution.
Solution
I found a solution!! (http://groups.google.com/group/android-developers/browse_thread/thread/79b233ab9ec64e1e#)
I am using a overlay and in the draw method i do this.
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
if(shadow){
return;
}
super.draw(canvas, mapView, shadow);
// convert bitmap's bounding box into pixels
Point top_left = new Point();
mapView.getProjection().toPixels(topLeft, top_left);
Point bottom_right = new Point();
mapView.getProjection().toPixels(bottomRight, bottom_right);
// Prepare two rectangles (pixels)
Rect src = new Rect( 0,0,bmp.getWidth() - 1, bmp.getHeight() - 1 );
Rect dst = new Rect( top_left.x, top_left.y, bottom_right.x,bottom_right.y );
// draw bitmap
canvas.drawBitmap(bmp, src, dst, null);
}
// I set the geoPoints (geoPointTopLeft,geoPointBottomRight) of the picture in the constructor
Answered By - Jonas Törnqvist
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.