1. 程式人生 > >AE獲取圖層中所有要素

AE獲取圖層中所有要素

原理很簡單:通過篩選獲得圖層中的要素,只需要將篩選的條件設定為空,這樣所有的要素都會被訪問;

IFeatureLayer pFeatureLayer;
 IFeatureClass pFeaterClass = pFeatureLayer.FeatureClass; string where = ""; IQueryFilter filter = new QueryFilterClass(); filter.WhereClause = where; IFeatureCursor pFeatcursor = pFeaterClass.Search(filter, false); IFeature pFeature = pFeatcursor.NextFeature(); while (pFeature!= null) { pFeature = pFeatcursor.NextFeature(); } }