将注记feature添加到map中的方法。

  我是文明,文章来源于项目实践,以下即代表我的个人认同与看法,有不同看法的可以留言哈,谢谢你的阅读,文章有错字或代码错误请指正,谢谢你哦。

第一次写博客,有写的不好的请见谅;

介绍我这个方法的主要功能:在feature中有一种特殊的feature :annofeature;

将annofeature导入IMap中的图层;

            

//sfilepath为路径, sFileName为路径名称;

//zj 为注记要素的名称;

            IMapDocument mapDocumnet = new MapDocumentClass();
            mapDocumnet.New(sFilePath + "\\" + sFileName + ".mxd"); 
            IMap map = mapDocumnet.get_Map(0);
            tmap.Name = "Layers";
            //添加图层
            IAnnotationLayerFactory annofac = new FDOGraphicsLayerFactoryClass();
            IAnnotationLayer annoly = annofac.OpenAnnotationLayer(workspace as IFeatureWorkspace, null, "ZJ");       
            map.AddLayer(annoly as ILayer);

以上为核心代码,不懂可以问我,谢谢

发布了35 篇原创文章 · 获赞 8 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/wenming111/article/details/78252553