ImageClickEventArgs

Topics: SharpMap v0.9 / v1.x, WinForms Controls
Aug 31, 2010 at 4:57 PM

I do not seem to be able to get the clickable map (allowing Center and Zoom) "How To..." to work.  Any clues?

 

Error    1    Unknown identifier "ImageClickEventArgs"   but will allow "system.eventArgs" but this does not center my map!

 

Help

 

Cheers

James

Coordinator
Sep 1, 2010 at 8:03 AM

Hello James,

on WindowsForms you need to use MouseClick event, which passes MouseClickEventArgs to the handler. I updated the HowTo.

Why reinvent the wheel, there is a MapImage/MapBox control in the SharpMap.UI project, that offers zoom/query/pan functionality.

Hth FObermaier

Sep 1, 2010 at 10:42 AM

Thanks FObermaier

 

That has sorted the problem for me.  I can now connect the toolstrip buttons to my map and they work well. But how do I get the results out from the measuring and query tools in the toolbar?

 

Cheers

James

Coordinator
Sep 1, 2010 at 11:09 AM

You need to subscribe to the MapQueried event of MapImage or MapBox.  It passes the resulting (Feature)DataTable.

Hth FObermaier

Sep 1, 2010 at 11:40 AM

Thanks again...

I'll try it out later and let you know how I get on!

 

Cheers

James

 

Sep 1, 2010 at 7:38 PM

Hi FObermaier

 

Still having a bit of a nightmare!  When I select the "i" button on the toolbar then click on the mapBox1 which contains a nicely displayed SHP file in a single (only layer) vector layer, I am having trouble generating a data set/table and then conecting it to a datagridview component... I seem to be going around in circles and getting nowhere fast!

 

Please do you have any sample code you might kindly provide?

 

tia

 

James

Coordinator
Sep 2, 2010 at 7:09 AM

Hello James,

have a look at the WinFormSamples project. All vector related samples provide query functionality.

Hth FObermaier

Sep 2, 2010 at 9:41 AM

Hello again!

 

Where do I get hold of the code for the "WinFormSamples project"?

 

Cheers

James

Sep 2, 2010 at 9:46 AM

Hi FObermaier

 

Please ignore my last post... it is in the Source Code area... sorry for being somewhat DUH!

 

Cheers

James

Sep 2, 2010 at 3:43 PM

Yep... it's me again.

The mapToolBar1 query button using "MapQueried" works fine and I can now populate a dataGridView. 

Next... how do I get data when I have used the measure tool (i.e., get areas, lengths, etc) ?

 

Cheers

James

Coordinator
Sep 2, 2010 at 6:03 PM

MeasureTool? Which control do you use? Are you using trunk or some branch of SharpMap?

Is there something like a MapMeasured event?

Cheers FObermaier

Sep 3, 2010 at 10:58 AM

I think I got it from the trunk.  The MapToolBar has 10 buttons for

1.   pan (hand icon),

2.   zoom-in ("+" magnifying glass),

3.   zoom-out ("-" magnifying glass),

4.   selected zooming ("Drag selection box" magnifying glass),

5.   zoom to extents (Globe icon),

6.   one-to-one zooming ("1:1" graphic),

7.   query ("i" and "?" graphic),

8.   measure (yellow ruler graphic),

9.   previous extent (large green left arrow),and

10.  next extent (large green right arrow).

 

If I click the query button (7) the MapQueried event gives me the datatable and I can populate a daragridview control... can I get the data from the measure tool (8) and get it to populate my dataviewgrid control ?

 

Cheers

James

 

 

Coordinator
Sep 3, 2010 at 11:29 AM

Hello James,

there is no MapToolBar control in SharpMap.UI project from trunk. You must have at least applied a patch.

If you are using the patch provided by dan and joel (it has a MapToolBar control and a MapBox with a Measure tool and a MapMeasured event), you need to setup the datatable yourself since the MapMeasured event returns numeric values.

Hth FObermaier

Sep 3, 2010 at 11:48 AM

I think you might be right... I think it was a Dan based fix from a while back...

 

there is a MapQueried which exposes segmentLength, totalLength and area.  Works fine!

 

Just would like to draw a polygon (like the measure tool) and select stuff (points in a specified layer) within the polygon and get the info in a FeatureDataTable... my quest continues..

 

Thanks for all your help... SharpMap rocks!

 

Cheers

James