My problem is that the images, although they rotate and stay in the correct position, they are no longer up-right. For example if the user is moving south and my map is rotated a full 180 degress then so are my images and the user will see them upside down.
My approach to this is to override ItemizedOverlay.draw and apply some transformations to the images to get them the way I want. So first off, is this a reasonable approach. I'm wondering if I should just dispense with using Overlays and draw the icons manually.
My last attempt went something like this
Using java Syntax Highlighting
- public void draw(final Canvas canvas, MapView mapview, final boolean shadow)
- {
- // Im gonna mess with the canvas here so save it
- canvas.save();
- Matrix m = canvas.getMatrix();
- // Im trying to determine here how the original point where the icon was located gets moved by the rotation
- float [] pts = { iconPoint.x, iconPoint.y};
- m.mapPoints(pts);
- // now try to undo the rotation of the actual icon, but keep it in the same spot on map
- m.postRotate(-bearing , pts[0], pts[1] );
- canvas.setMatrix(m);
- super.draw(canvas, mapview, shadow);
- canvas.restore();
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

