ThinkGeo.com    |     Documentation    |     Premium Support

Accessing the active feature in Map.EditOverlay mode

Hello,




We are trying to access the active feature in the EditOverlay. For this we are capturing the OnRightClick event on the map and comparing the point with every feature in the InternalFeatures collection of EditShapelayer. We tried  



pointShape.IsWithin(feature), pointShape.Touches(feature)  and 



feature.GetShape().Touches(pointShape), feature.GetShape().Contains(point)  functions, but all of them are returning false. Is there something I am missing here?


Thanks and Regards,

ankit



 Epic,


 
Which type of feature in EditOverlay, for example, PointShape, LineShape or PolygonShape, different type needs to use different method.
 
Here are some sample code you can refer to:
 
 double radius = 10.0 / map.Width * mapEngine.CurrentExtent.Width;
                        EllipseShape searchingEllipse = new EllipseShape(pointShape, radius, radius);

                        foreach (Feature feature in EditShapelayer.InternalFeatures)
                        {
                            BaseShape currentShape = feature.GetShape();

                            if (currentShape is AreaBaseShape)
                            {
                                if (currentShape.Contains(pointShape))
                                {
                                    selectedFeatures.Add(feature);
                                }
                            }

                            if (currentShape is LineBaseShape)
                            {
                                if (currentShape.Intersects(searchingEllipse))
                                {
                                    selectedFeatures.Add(feature);
                                }
                            }

                            if (currentShape is PointBaseShape)
                            {
                                if (searchingEllipse.Contains(currentShape))
                                {
                                    selectedFeatures.Add(feature);
                                }
                            }
                        }

 
Thanks,
 
James