This project has moved. For the latest updates, please go here.

[Solved]Set center on click of any location

Topics: SharpMap Project, SharpMap v0.9 / v1.x, SharpMap v2.0, WinForms Controls
Oct 13, 2010 at 6:54 AM
Edited Oct 18, 2010 at 7:50 PM

Hi Team,

I am working on sharpmap, I am having map with zoom in,zoom out buttons, and one trackbar to rotate the map with 0 to 360 degree.

also I have functionality to have to zoom in, and zoom out with mouse scroll. what i am trying to do i am clicking any point suppose "London" there i have marker so i zoomed in there.

and some what rotated map.

now i am not able to see marker, the marker should be focus right? map is going outside the window. 

how I can set  focus marker if i have rotated my map.



Vivek Kumar

Oct 13, 2010 at 10:49 AM

Vivek, if you use MapTransform with a different Matrix than Matrix.Identity, you probably will need to apply the MapTransform -or is it Inverse?- on the Point clicked as well before you transform that to world coordinates.

This is what I meant when I called it odd behavior.

Hth FObermaier

Oct 13, 2010 at 11:33 AM
Edited Oct 18, 2010 at 7:50 PM

Hi FObermaier,

I am trying to set the rotation with onclick of map x and y.

suppose you have clicked some where what I trying to do is I am taking X,Y and seeting center according to that, then rotate .

so that point will not go out of window,.

I am doing this.




Please let me know some example.



Oct 13, 2010 at 2:59 PM
Edited Oct 18, 2010 at 7:50 PM

Hi all,

I resloved it.

by doing this.

I am sharing it here.




The map will rotate acrooss the point you clicked.


Vivek Kumar