moagrius / TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
MIT License
1.46k stars 337 forks source link

Rotation of the TileView #27

Closed corsc closed 11 years ago

corsc commented 11 years ago

I attempted to add rotation support to the TileView by using View.rotate() using the something like this:

                    this.mDegree = (float) Math.toDegrees(Math.atan2((event.getY(0) - event.getY(1)),
                                    (event.getX(0) - event.getX(1)))) + rotation_angle;
                    this.mDeltaDegree = this.mDegree - this.mStartDegree;
                    this.mTileView.setRotation(this.mDeltaDegree);
                    this.mTileView.updateViewport();
                    this.mTileView.requestRender();

Unfortunately when i zoom in and the rotate 90 degrees i get the "letterbox" effect.

I have tried forcing the DetailLevel.getIntersections() to return more tiles and I have tried to fool various components into drawing more or expanding the viewport with no success.

Do you have any suggestions as to what I could try next?

Thanks

moagrius commented 11 years ago

I appreciate what you're trying to do, and it'd be a very cool addition, but I think it'd require a massive rewrite to all the major components - I think you're taking on a very big job.

I'd probably start where you mentioned (intersections), which will likely require some crazy math - next would be "anti-rotating" markers and callouts, then figuring out touch events. I think the basic setRotation isn't going to be sufficient.

If you decide to move forward with it, let me know if I can help by pointing out or explaining how certain things work. That said, I think it's probably a lot to bite off

corsc commented 11 years ago

Thanks for your quick reply. I will take this to my client but given their timeline this kind of huge change is unlikely to get approved. Thanks for all your help

moagrius commented 11 years ago

np, good luck