how to select intersected shapes?

Aug 7, 2012 at 2:00 AM

if a point feature intersect a polygon feature ,i want to select the point feature how should i do?

the point feature is a picturesymbol!

any one helps?

thanks in advance!

Developer
Aug 9, 2012 at 4:31 AM

I'm not sure I understand your question. Are you asking how to select a feature (which happens to be a point) or how to determine if a point lies on a polygon?

Aug 13, 2012 at 2:57 AM

well it just like that two polygon features overlay on each other but it happen to be a point feature which symboliser is a picturesymbol! in this situation how to select the point feature?

Aug 14, 2012 at 11:26 AM

What i understood from your question, the solution is very easy:

DotSpatial.Topology.Geometry gm1, gm2;
gm1 = (DotSpatial.Topology.Geometry)(feat1.BasicGeometry);// point
foreach (DotSpatial.Data.IFeature feat2 in layer2.DataSet.Features) // polygon layer
{
   gm2 = (DotSpatial.Topology.Geometry)(feat2.BasicGeometry);
   if (gm2.Intersects(gm1))
   {
       // code for whatever you want to do
    }
}

 

Hope it helps

Aug 17, 2012 at 1:55 AM

well this is very useful, if you know that the definite point feature intersect  with the definite polygon feature, but in my situation I want to use the code map.functionmode=functionmode.select to select the point feature!  can you tell me more about it ?

thanks for your reply!

Developer
Aug 17, 2012 at 3:24 PM

FunctionMode.Select lets the user select features, which will appear by default in Cyan when selected. This throws a 

Map.MapFrame.SelectionChanged

 

You can then access yourFeatureLayer.Selection, for example.

Aug 29, 2012 at 1:22 AM

thanks for your reply, your suggest is very good!