地图屏幕坐标转地图坐标

IPoint point = this.m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

 

IIdentify identify = FeatureLayer as IIdentify;
                    if (identify == null)
                    {
                        continue;
                    }
                    IPoint point2 = this.m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
                    IArray array = identify.Identify(point2);
                    if (array == null || array.Count<1)
                    {
                        continue;
                    }
                    for (int i = 0; i < array.Count; i++)
                    {
                        IRowIdentifyObject row = (IRowIdentifyObject)array.get_Element(i);
                        if (row == null)
                            continue;
                        IFeature pFeature = row.Row as IFeature;
                        if (pFeature != null)
                        {
                            if (Geometry == null)
                            {
                                Geometry = pFeature.ShapeCopy;
                            }
                            else
                            {
                                ITopologicalOperator topological = Geometry as ITopologicalOperator;
                                if (!topological.IsSimple)
                                {
                                    topological.Simplify();
                                }
                                Geometry = topological.Union(pFeature.ShapeCopy) as IGeometry;
                            }
                        }
                    }

posted @ 2020-04-22 09:06  天要下雨娘要嫁人  阅读(239)  评论(0)    收藏  举报