public Feature HitTest(Geometry.Point2D worldPos) { Feature result = null; if (LayerData.GeoType == "1") { foreach (Feature f in LayerData.Features) { Geometry.Point2D p = new Geometry.Point2D(f.GeoData); if (p.DistTo(worldPos) < 5 * MapControl.Current.Scale) { result = f; break; } } } else if (LayerData.GeoType == "2") { foreach (Feature f in LayerData.Features) { Geometry.Polyline poly = new Geometry.Polyline(f.GeoData); if (poly.DistToPoint(worldPos) < 5 * MapControl.Current.Scale) { result = f; break; } } } else if (LayerData.GeoType == "4") { foreach (Feature f in LayerData.Features) { Geometry.Polygon poly = new Geometry.Polygon(f.GeoData); if (poly.IsPointIn(worldPos)) { result = f; break; } } } return(result); }