AE中如何由IFeature 如何获取所对应的FeatureClass

暗袭雨天910
推荐于2016-09-09 · TA获得超过1.1万个赞
知道大有可为答主
回答量:1021
采纳率:100%
帮助的人:2413万
展开全部
private void OnDeleteFeatureMethod(object o) { IFeature pFeature = o as IFeature; IFeatureClass pFeatureClass = pFeature.Class as IFeatureClass; for (int i = 0; i < axMapControl1.Map.LayerCount;i++ ) { IFeatureLayer iFeatureLayer = axMapControl1.get_Layer(i) as IFeatureLayer; IFeatureClass iFeatureCla = iFeatureLayer.FeatureClass; if (iFeatureCla == pFeatureClass) { IWorkspace pWorkSpace = m_EngineEditor.EditWorkspace; textBox3.Text += "操作的文件全路径:" + pWorkSpace.PathName + "\\" + axMapControl1.get_Layer(i).Name + ".shp " + "\r\n"; break; } } if (pFeature.Shape.GeometryType == esriGeometryType.esriGeometryPoint) { IGeometry iGe = pFeature.Shape; IPoint ipo = new PointClass(); ipo = iGe as IPoint; int a = 0; int b = 0; axMapControl1.FromMapPoint(ipo, ref a, ref b); textBox3.Text += "删除的点的ID号:" + pFeature.OID + ",坐标:(" + a + "," + b + ")" + "\r\n"; } else if (pFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon) { textBox3.Text += "删除的多边形对象的ID号:" + pFeature.OID + ",坐标:"; IPolygon pPolygon = (IPolygon)pFeature.Shape; int a = 0; int b = 0; //把该feature强制转换为一个点的集合,再取点的坐标 IPointCollection pPointCollection = pPolygon as IPointCollection; for (int i = 0; i < pPointCollection.PointCount - 1; i++) { IPoint ipo = pPointCollection.get_Point(i); axMapControl1.FromMapPoint(ipo, ref a, ref b); textBox3.Text += "(" + a + "," + b + ")" + "\t"; } textBox3.Text += "\r\n"; } else if (pFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline) { textBox3.Text += "删除的线对象的ID号:" + pFeature.OID + ",其坐标:"; IPolyline pPolygon = (IPolyline)pFeature.Shape; int a = 0; int b = 0; //把该feature强制转换为一个点的集合,再取点的坐标 IPointCollection pPointCollection = pPolygon as IPointCollection; for (int i = 0; i < pPointCollection.PointCount; i++) { IPoint ipo = pPointCollection.get_Point(i); axMapControl1.FromMapPoint(ipo, ref a, ref b); textBox3.Text += "(" + a + "," + b + ")" + "\t"; } textBox3.Text += "\r\n"; } axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); }
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式