Dotspatial map control info

Oct 17, 2012 at 9:42 AM

Hi ,

Here in my application I have a dotspatial map control , when user clicks particular place on map how to get information of that particular point.

Developer
Oct 17, 2012 at 7:33 PM
Edited Oct 17, 2012 at 7:34 PM

I use MapFunctions but that may be way overkill for what you want to do.  I don't have a simple example using MapFunction but it goes something like this where my MapFunction was called GCMFSelect, the DotSpatial Map Control is dsMap:

  1. Implement GCMFSelect which derives off of DotSpatial.Controls.MapFunction.
  2. Override the OnMouseUp method which gets passed a GeoMouseArgs which has the geographic coordinate.  This is where you do your work.
  3. In  your form load, you can add your MapFunction something like this:

 

                    m_MFSelect = new GCMFSelect(dsMap);
                    m_MFSelect.Deactivate();
                    dsMap.MapFunctions.Add(m_MFSelect);
You would not have to call Deactivate().  I do that so it is off by default, then I can activate it when I want to handle the event (like I am in selection mode).

Kyle
Oct 18, 2012 at 5:44 AM

Hi,

Thanks for your time.

What is this m_MFSelect all about and in OnMouseUp method what shall i do 

Developer
Oct 18, 2012 at 1:00 PM

m_MFSelect  was just a member variable in the Windows.Form we implemented.  It is totally up to you what you do in OnMouseUp or any other event.  I assume you want the geographic (i.e. real world coordinate) of the mouse-click in the map.  OnMouseUp would supply that to you in GeoMouseArgs.  Then you do in there whatever it is you have set out to do.

Oct 19, 2012 at 9:55 AM

whats this dsmap ..