且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

创建注记图层要素

更新时间:2021-12-17 15:08:57

转自原文创建注记图层要素

创建完文本注记TextElement后,可以选择以屏幕注记的形式加到屏幕上,也可以通过下面的方式转为注记图层要素:

 

创建注记图层要素
            IFeatureClass annocls = 获取注记图层  
IDataset pDataset = annocls as IDataset;  
ITransactions pTransactions = pDataset.Workspace as ITransactions;  
pTransactions.StartTransaction();  
IFDOGraphicsLayerFactory pFDOGLFactory = new FDOGraphicsLayerFactoryClass();  
ILayer tmpLayer = pFDOGLFactory.OpenGraphicsLayer(pDataset.Workspace as IFeatureWorkspace, annocls.FeatureDataset, pDataset.Name);  
IFDOGraphicsLayer pFDOGLayer = tmpLayer as IFDOGraphicsLayer;  
IElementCollection pElementColl = new ElementCollectionClass();  
pFDOGLayer.BeginAddElements();  
////每新增100个提交下,最后再提交下。防止过多转换失败  
if ((pElementColl != null) && (pElementColl.Count == 100))  
{  
    pFDOGLayer.DoAddElements(pElementColl, 0);  
    pFDOGLayer.EndAddElements();  
    pElementColl.Clear();  
    pTransactions.CommitTransaction();  
    pTransactions.StartTransaction();  
    pFDOGLayer.BeginAddElements();  
}  
if (pElementColl.Count > 0)  
pFDOGLayer.DoAddElements(pElementColl, 0);  
pFDOGLayer.EndAddElements();  
pElementColl.Clear();  
pTransactions.CommitTransaction();  
创建注记图层要素

 

 

 

没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的***、好奇、充满创造力的想法被现实的框架所束缚,让创造力***成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。




    本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/arxive/p/6262836.html,如需转载请自行联系原作者