Rotate Map for V2

Topics: SharpMap v2.0, WinForms Controls
Mar 10, 2010 at 11:37 AM
Edited Mar 11, 2010 at 4:02 PM

My question relates to displaying a rotated map view (in my case to the current heading of a vehicle):


I found some discussion on Rotating the map  back in 2008 but the discussion was focussed on V0.9, however John Diss did mention for V2 "...you would use IRenderer.RenderTransform".
I searched for references to IRenderer.RenderTransform and rotating the map for V2 in the discussions but couldn't find anything.

Could anyone please elaborate on how to rotate map view for V2?

PS Been monitoring Sharpmap for some time, played with V0.9 and now V2 - you guys are truly doing a great job, I look forward to being able to contribute as my familiarity increases! I checked out the latest source from the repo and got enough of it to build to start working with :)

 

Coordinator
Mar 11, 2010 at 8:15 PM
Edited Mar 11, 2010 at 8:25 PM

Hello tidyup,

I think this does not work out of the box. But as a start you can use this patchfile.

It basically adds a ViewRotation property to MapPresenter2D class, which feeds its _rotationMatrix property.
This _rotationMatrix is used on building the _toViewTransform matrix which is then used for rendering. Currently
there is no way of setting this matrix externally.

To make things even easier I added that very same property (ViewRotation) to the MapViewControl which
simply passes it to / gets it from its internal presenter class.

Hth FObermaier