how to selected point!!!

Topics: Algorithms
May 17, 2012 at 3:57 AM

HI,

I am using mapbox control to display point on the map, I want to program function allows the user selected point, when the point is selected then it will be the highlight. Help me please.

May 17, 2012 at 4:29 AM
Edited May 17, 2012 at 4:54 AM

here my code:

 

SharpMap.Map _map = DisplayMap.Map;
                if (_map.Layers.Count > 0)
                {
                    SharpMap.Layers.VectorLayer needLayer = (SharpMap.Layers.VectorLayer)_map.Layers[LayersDataGridView.SelectedRows[0].Index];
                    SharpMap.Geometries.Point p = DisplayMap.Map.ImageToWorld(imagePos.Location);
                    SharpMap.Data.FeatureDataRow rowSelected = FindGeoNearPoint(p, needLayer, 100);

                    SharpMap.Layers.VectorLayer laySelected = new SharpMap.Layers.VectorLayer("Selection");

                    if (rowSelected != null)
                    {
                        laySelected.DataSource = new SharpMap.Data.Providers.GeometryProvider(rowSelected.Geometry);

                        laySelected.Style.Fill = new System.Drawing.SolidBrush(Color.Blue);

                        _map.Layers.Add(laySelected);
                    }
                    DisplayMap.Map = _map;
                }

but point selected not highlight?

 

Developer
May 17, 2012 at 8:15 AM

have you tried to explicitely redraw the map?

May 17, 2012 at 8:51 AM

yes, i tried but point selected not highlight.

Editor
May 17, 2012 at 11:51 AM

try the following code:

laySelected.Style.PointColor = new System.Drawing.SolidBrush(Color.Gold);

May 18, 2012 at 2:52 AM

nice, thanks.