How can I check, if the point belongs to polygon? I want to create curstom identify tool with edit option. My idea is to click on the polygon ( building/park/etc) in ArcMap and, if cursor coordinates belongs to polygon, get its parameters from building_layer for further changing (number of building, street name etc). Or maybe there's a more easy way to solve my problem,
I use C# and ArcMap 10.
public IPoint GetMapCoordinatesFromScreenCoordinates(IPoint screenPoint, IActiveView activeView)
{
if (screenPoint == null | screenPoint.IsEmpty | activeView == null)
{
return null;
}
IScreenDisplay screenDisplay = activeView.ScreenDisplay;
IDisplayTransformation displayTransformation = screenDisplay.DisplayTransformation;
double x, y;
screenPoint.QueryCoords(out x, out y);
MessageBox.Show(string.Format("X:{0} - Y:{1}", x.ToString(), y.ToString()));
return displayTransformation.ToMapPoint((System.Int32)screenPoint.X, (System.Int32)screenPoint.Y);
}
protected override void OnMouseDown(MouseEventArgs arg)
{
IMxDocument doc = ArcMap.Application.Document as IMxDocument;
IActiveView activeView1 = doc.ActiveView;
var mouse_click_coords = new ESRI.ArcGIS.Geometry.Point() { X = arg.X, Y = arg.Y };
var p = GetMapCoordinatesFromScreenCoordinates(mouse_click_coords, activeView1);
}
How can I select polygon by mouse click?