Select to view content in your preferred language

Create a custom Identify tool with edit option

4220
1
09-30-2014 03:58 AM
SergeyGamayunov
Emerging Contributor

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);

        }

0 Kudos
1 Reply
SergeyGamayunov
Emerging Contributor

How can I select polygon by mouse click?

0 Kudos