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

来源:互联网 发布:linux系统shell 编辑:程序博客网 时间:2024/06/06 03:48

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

介绍我这个方法的主要功能:在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);


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

阅读全文
0 0
原创粉丝点击