创建注记图层C# IFeatureWorkspaceAnno
http://blog.csdn.net/mydriverc/article/details/1675613
//IFeatureWorkspaceAnno Example //The following example show how to use the CreateAnnotationClass on IFeatureWorkspaceAnno
//to create a new feature-linked annotation class. In this function, the annotation class is
//feature-linked to the feature class that is supplied as an argument and is created in the
//same feature dataset as the feature class it is linked to. //The label expression is a simple expression of the values in the field called
//DESCRIPTION in the feature class it is linked to. A text symbol for the feature-linked
//annotation is red with a font of "Courier New". //e.g., nameOfFeatureClass = "States";
//on ArcSDE use ISqlSyntax::QualifyTableName for fully qualified table names.
public IFeatureClass IFeatureWorkspaceAnno_Example(IFeatureClass featureClass)
{
IDataset dataset = (IDataset)featureClass;
//cast for the feature workspace from the workspace
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)dataset.Workspace;
IFeatureWorkspaceAnno featureWorkspaceAnno = (IFeatureWorkspaceAnno)dataset.Workspace;
//set up the reference scale
ESRI.ArcGIS.Carto.IGraphicsLayerScale graphicLayerScale =
new ESRI.ArcGIS.Carto.GraphicsLayerScaleClass();
IGeoDataset geoDataset = (IGeoDataset)dataset;
graphicLayerScale.Units = ESRI.ArcGIS.esriSystem.esriUnits.esriFeet;
graphicLayerScale.ReferenceScale = 2000;
//set up symbol collection
ESRI.ArcGIS.Display.ISymbolCollection symbolCollection =
new ESRI.ArcGIS.Display.SymbolCollectionClass(); #region "MakeText"
ESRI.ArcGIS.Display.IFormattedTextSymbol myTextSymbol =
new ESRI.ArcGIS.Display.TextSymbolClass();
//set the font for myTextSymbol
stdole.IFontDisp myFont = new stdole.StdFontClass() as stdole.IFontDisp;
myFont.Name = "Courier New";
myFont.Size = 9;
myTextSymbol.Font = myFont;
//set the Color for myTextSymbol to be Dark Red
ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColorClass();
rgbColor.Red = 150;
rgbColor.Green = 0;
rgbColor.Blue = 0;
myTextSymbol.Color = (ESRI.ArcGIS.Display.IColor)rgbColor;
//Set other properties for myTextSymbol
myTextSymbol.Angle = 0;
myTextSymbol.RightToLeft = false;
myTextSymbol.VerticalAlignment = ESRI.ArcGIS.Display.esriTextVerticalAlignment.esriTVABaseline;
myTextSymbol.HorizontalAlignment = ESRI.ArcGIS.Display.esriTextHorizontalAlignment.esriTHAFull;
myTextSymbol.CharacterSpacing = 200;
myTextSymbol.Case = ESRI.ArcGIS.Display.esriTextCase.esriTCNormal;
#endregion symbolCollection.set_Symbol(0, (ESRI.ArcGIS.Display.ISymbol)myTextSymbol);
//set up the annotation labeling properties including the expression
ESRI.ArcGIS.Carto.IAnnotateLayerProperties annoProps = new
ESRI.ArcGIS.Carto.LabelEngineLayerPropertiesClass();
annoProps.FeatureLinked = true;
annoProps.AddUnplacedToGraphicsContainer = false;
annoProps.CreateUnplacedElements = true;
annoProps.DisplayAnnotation = true;
annoProps.UseOutput = true; ESRI.ArcGIS.Carto.ILabelEngineLayerProperties layerEngineLayerProps =
(ESRI.ArcGIS.Carto.ILabelEngineLayerProperties)annoProps;
ESRI.ArcGIS.Carto.IAnnotationExpressionEngine annoExpressionEngine =
new ESRI.ArcGIS.Carto.AnnotationVBScriptEngineClass();
layerEngineLayerProps.ExpressionParser = annoExpressionEngine;
layerEngineLayerProps.Expression = "[DESCRIPTION]";
layerEngineLayerProps.IsExpressionSimple = true;
layerEngineLayerProps.Offset = 0;
layerEngineLayerProps.SymbolID = 0;
layerEngineLayerProps.Symbol = myTextSymbol; ESRI.ArcGIS.Carto.IAnnotateLayerTransformationProperties annoLayerTransProp =
(ESRI.ArcGIS.Carto.IAnnotateLayerTransformationProperties)annoProps;
annoLayerTransProp.ReferenceScale = graphicLayerScale.ReferenceScale;
annoLayerTransProp.Units = graphicLayerScale.Units;
annoLayerTransProp.ScaleRatio = 1; ESRI.ArcGIS.Carto.IAnnotateLayerPropertiesCollection annoPropsColl =
new ESRI.ArcGIS.Carto.AnnotateLayerPropertiesCollectionClass();
annoPropsColl.Add(annoProps);
//use the AnnotationFeatureClassDescription to get the list of required
//fields and the default name of the shape field
IObjectClassDescription oCDesc = new ESRI.ArcGIS.Carto.AnnotationFeatureClassDescriptionClass();
IFeatureClassDescription fCDesc = (IFeatureClassDescription)oCDesc;
//create the new class
return featureWorkspaceAnno.CreateAnnotationClass("AnnoTest",
oCDesc.RequiredFields, oCDesc.InstanceCLSID, oCDesc.ClassExtensionCLSID,
fCDesc.ShapeFieldName, "", featureClass.FeatureDataset, featureClass,
annoPropsColl, graphicLayerScale, symbolCollection, true);
}
创建注记图层C# IFeatureWorkspaceAnno的更多相关文章
- 用IFeatureWorkspaceAnno.CreateAnnotationClass 创建注记图层时报“The application is not licensed to modify or create schema”的错误的解决方案。
用IFeatureWorkspaceAnno.CreateAnnotationClass 的方法创建注记图层的时候报"The application is not licensed to m ...
- 【ESRI论坛6周年征文】ArcEngine注记(Anno/ Label/Element等)处理专题 -入门篇
原发表于ESRI中国社区,转过来.我的社区帐号:jhlong http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=122097 ----------- ...
- ArcEngine标注和注记
转自原文 ArcEngine标注和注记 标注和注记是ArcEngine中提供的两种使用文字信息标注地图要素的方式.其中标注是作为图层的属性存在的,可以动态创建,注记作为地理要素被存储.需要注意的是Sh ...
- AE指定字段转成注记
转自原文 ae指定字段转成注记 ArcMap中有一个功能是Label Features,就是可以将图层内指定字段值显示以Label形式显示在主窗口上,在Label Features后,用右键点击图层, ...
- 【ArcEngine入门与提高】Element(元素)、Annotation(注记)旋转
因项目需要,需要做一个旋转注记的工具.因为注记这玩意用的比较少,网上资源也很少,所以做起来相当头疼.在经过一番研究之后,终于搞清楚注记的存储原理了,原来是和Element的类似,只不过注记是要把Ele ...
- WebGIS中自定义互联网地图局部注记的一种方案
文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1. 前言 实际项目中我们经常会遇到这样一种场景:地图底图可能是互 ...
- ArcGis 创建Annotation注记要素类、添加注记要素 并加载到Activeview AO C#
AO中一般有两种方式存储图面注记元素,一种使用TextElement,它是文档级的元素,编辑后要通过文档(mxd)保存:另一种是使用Annotation要素类,它是一个独立的要素类(featurecl ...
- 创建文本注记TextElement
1.创建一个字体 /// <summary> /// 字体设置 /// </summary> /// <param name="size">Th ...
- 创建线注记LineElement
1.根据2点创建一条线 /// <summary> /// 创建线 /// </summary> /// <param name="pnt1"> ...
随机推荐
- Java学习经验
随着Java学习的深入,越来越感觉记笔记的重要性,一方面可以使自己更加善于总结,提高对项目和自己的认知,另一方面可以让知识条例更加鲜明,并且加深对知识点的记忆.Java是一门很早开始兴起的语言,用途非 ...
- H5移动端触摸事件:touchstart、touchend、touchmove
第一部分代码事例: <html><head> <meta charset="utf-8"> <style> #main,#main1 ...
- jq相关操作
1事件: <div class="ele">123</div> box.onclick = function(ev){ ev:系统传入的事件对象 ele.i ...
- mysql slow 分析工具
慢查询有什么用? 它能记录下所有执行超过long_query_time时间的SQL语句,帮你找到执行慢的SQL,方便我们对这些SQL进行优化. 测试用 MySQL 版本. Serv ...
- centos7 安装nodejs 最新版
笔者在安装时,node为11.0.0版本.这里以11版本为例,以后更新,安装步骤时一致的. 下载node安装包到指定目录 wget https://npm.taobao.org/mirrors/nod ...
- WordPress 多语言支持(本地化)
本博客将介绍WordPress的多语言制作 首先需要在wp-content目录下创建一个languages文件夹,用于存放语言包文件. 然后在模板目录下的functions.php,然后在代码中添加函 ...
- xtrabackup实现全量备份和增量备份
mysql增量和完全备份innobackupex2.1.9版本1 yum安装: 官网地址:https://www.percona.com/doc/percona-xtrabackup/LATEST/i ...
- 【Luogu】P3381最小费用最大流模板(SPFA找增广路)
题目链接 哈 学会最小费用最大流啦 思路是这样. 首先我们有一个贪心策略.如果我们每次找到单位费用和最短的一条增广路,那么显然我们可以把这条路添加到已有的流量里去——不管这条路的流量是多大,反正它能 ...
- [BZOJ2523][Ctsc2001]聪明的学生
[BZOJ2523][Ctsc2001]聪明的学生 试题描述 一位教授逻辑学的教授有三名非常善于推理且精于心算的学生A,B和C.有一天,教授给他们三人出了一道题:教授在每个人脑门上贴了一张纸条并告诉他 ...
- BZOJ 3168 [Heoi2013]钙铁锌硒维生素 ——矩阵乘法 矩阵求逆
考虑向量ai能否换成向量bj 首先ai都是线性无关的,然后可以a线性表出bj c1*a1+c2*a2+...=bj 然后移项,得 c1/ci*a1+...-1/ci*bj+...=ai 所以当ci不为 ...