point intersect problem

Sep 25, 2012 at 10:50 AM

to get shape data on which I've clicked I use next code:

void Map1MouseUp(object sender, MouseEventArgs e){            
if(e.Button != MouseButtons.Right) return;            
Coordinate c = map1.PixelToProj(e.Location);            
if(map1.Layers.Count < 1) return;            
IMapPolygonLayer mpl = map1.Layers[0] as IMapPolygonLayer;            
if(mpl == null) return;           
 IFeatureSet fs = map1.Layers[0].DataSet as IFeatureSet;           
 IFeatureList list = fs.Features;            
foreach(IFeature feature in list){                
if(feature.Intersects(c)){                    
DataRow row = feature.DataRow;                
}           
}
}

But now I need to get point on the IMapPointLayer, not shape. I guess Intersect will not work,. So how can I select point on my map?

Nov 16, 2012 at 7:28 AM

Maybe you can just make a "distance" function, so you call it within the cycle through your features evaluating the distance from the clicked coordinates.

Then you can and decide to catch the nearest in some way, maybe taking into account a minimum distance limit above which you do not select any feature

 

Oscar