ArcGis IMap.Get_Layers方法 的UID 参数

{6CA416B1-E160-11D2-9F4E-00C04F6BC78E} IDataLayer
{40A9E885-5533-11d0-98BE-00805F7CED21} IFeatureLayer
{E156D7E5-22AF-11D3-9F99-00C04F6BC78E} IGeoFeatureLayer
{34B2EF81-F4AC-11D1-A245-080009B6F22B} IGraphicsLayer
{5CEAE408-4C0A-437F-9DB3-054D83919850} IFDOGraphicsLayer
{0C22A4C7-DAFD-11D2-9F46-00C04F6BC78E} ICoverageAnnotationLayer
{EDAD6644-1810-11D1-86AE-0000F8751720} IGroupLayer
//获取图层
    class LayerHelper
    {
        /// 
        /// 返回IEnumLayer类型图层集合
        /// 
        /// 
        /// 
        public static IEnumLayer GetEnumLayer(IHookHelper hookHelper)
        {
            UID uid = new UIDClass();
            uid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";
            IEnumLayer pLayers = hookHelper.FocusMap.get_Layers(uid, true);
            return pLayers;
        }
        /// 
        /// 返回List 类型图层集合
        /// 
        /// 
        /// 
        public static List GetLayerList(IHookHelper hookHelper)
        {
            IEnumLayer pEnumLayer = LayerHelper.GetEnumLayer(hookHelper);
            List pLayerList = new List();
            ILayer pLayer = null;
            while ((pLayer = pEnumLayer.Next()) != null)
            {
                pLayerList.Add(pLayer);
            }
            return pLayerList;
        }
    }

getLayers

IEnumLayer getLayers(IUID uid,
                     boolean recursive)
                     throws IOException,
                            AutomationException

The layers in the map of the type specified in the uid. If recursive is true it will return layers in group layers.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

 

Parameters:

uid - A reference to a com.esri.arcgis.system.IUID (in, optional, pass 0 if not required)

recursive - The recursive (in, optional, pass true if not required)

Returns:

A reference to a com.esri.arcgis.carto.IEnumLayer

Throws:

IOException - If there are interop problems.

AutomationException - If the ArcObject component throws an exception.

你可能感兴趣的:(C#,ArcGis)