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

Rotate Markers #127

Closed firefly2442 closed 10 years ago

firefly2442 commented 10 years ago

I saw issue #79 about rotating images and you mentioned that it doesn't seem possible. But what about just the markers? It looks like API 11 added support for rotation in Views.

https://developer.android.com/reference/android/view/View.html#setRotation%28float%29

Does that change your answer at all? I'm not really familiar with the class hierarchy in Android so mostly just a shot in the dark. :)

moagrius commented 10 years ago

Sure, you could rotate the markers - a "marker" is just any View, so you can do whatever you want to a marker. FWIW, there's a library called NineOldAndroids that makes those methods available in pre-11 APIs.

The problem is rotating the map. That would be very difficult - in fact, if I was going to try to support that I'd probably start over and just draw on a single Canvas or use a SurfaceView, rather than actual Views and ViewGroups.

So, to summarize: yes, you can rotate Markers, but no, it wouldn't change my answer about rotating the tiled image :)

firefly2442 commented 10 years ago

So, I was able to save the view that's passed in to create the marker and then rotate it. This works. However, do you think it would be better to add methods to the Marker class for this functionality as well? I guess it just depends on where you feel the control of the markers and updating their position and values starts/ends.

moagrius commented 10 years ago

So, I was able to save the view that's passed in to create the marker and then rotate it. This works.

Glad to hear you got it working.

However, do you think it would be better to add methods to the Marker class for this functionality as well?

No, I think it should definitely be handled by the View itself, not the Marker - the Marker just positions any View at all relative to the TileView, and I think all behavior, layout, drawing, etc for that View should be handled outside of the Marker class.

Thanks for posting

firefly2442 commented 10 years ago

Cheers. Closing issue then.