AE中通过UID使用getLayer

在ArcGIS Engine中,可以通过UID(全局唯一标识符)来获取特定类型的图层,如IFeatureLayer。UID可以是GUID的字符串形式,可以从注册表或代码中获取。示例代码展示了如何使用UID获取IFeatureLayer图层。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

UID的官方解释是:


COM interfaces and coclasses are identified by a globally unique identifier (GUID). The GUID for an interface is called an interface ID (IID). The GUID for a coclass is called class ID (CLSID). A ProgID is a text alias for a CLSID; the ProgID is a string composed of the project name and the class name of the coclass. The UID coclass can be used to represent the GUID of an object.

如何获取GUID:
 1.在注册表中使用查找功能,查找接口名称,即可发现要找的GUID;
 2.通过代码获取。
    1)代码如下
       string uid = (typeof(IFeatureLayer)).GUID.ToString();
       MessageBox.Show("所查询的GUID为:"+uid); 

    2)UID中value的几种值以及表示的意思:

          {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

UID使用示例:

        /// <summary> 
        /// 获取图层 
        /// </summary> 
        /// <returns></returns> 
        private IEnumLayer GetLayers()
        {

            //UID puid = new UIDClass();
            //string uid = (typeof(IFeatureLayer)).GUID.ToString();
            //puid.Value = "{" + uid + "}";


            UID uid = new UIDClass();
            uid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";

            IEnumLayer layers = mainMapControl.Map.get_Layers(uid, true);
            return layers;
        }




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值