IFeatureLayerDefinition--自定义要素层接口
实现该接口的主要组件类(CoClass)--FeatureLayer
项目中使用该接口实现的方法:
将某个图层的选择集提取出来新建临时图层:
![](https://i-blog.csdnimg.cn/blog_migrate/cdec0645add3fc3c328197dda5c76203.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/81178cc93a2a3bb5048d90d76e7ec935.gif)
1 IFeatureLayer pFeatureLayer = _myMap.get_Layer(0) as IFeatureLayer; 2 //MessageBox.Show(pFeatureLayer.Name+"1111"); 3 IFeatureSelection pFeatureSelection = pFeatureLayer as IFeatureSelection; 4 ISelectionSet pSelectionSet = pFeatureSelection.SelectionSet; 5 if (pSelectionSet == null) 6 { 7 System.Windows.Forms.MessageBox.Show("请选择一块图幅!"); 8 } 9 IFeatureLayerDefinition pFeatureLayerDef = pFeatureLayer as IFeatureLayerDefinition; 10 pFeatureLayerDef.CreateSelectionLayer("tempLayer", true, null, null); 11 IFeatureLayer pTempFeatureLayer = pFeatureLayerDef as IFeatureLayer;
对图层的显示进行处理(屏蔽):
![](https://i-blog.csdnimg.cn/blog_migrate/cdec0645add3fc3c328197dda5c76203.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/81178cc93a2a3bb5048d90d76e7ec935.gif)
1 IFeatureLayer featureLayer = _myMap.Layer[0] as IFeatureLayer; 2 IFeatureLayerDefinition featureLayerDefinition = featureLayer as IFeatureLayerDefinition; 3 //只显示objectID = 657的要素,其他要素屏蔽掉 4 featureLayerDefinition.DefinitionExpression = "OBJECTID = '657'"; 5 _myActiveView.Refresh();