来自:https://blog.csdn.net/u011609113/article/details/51372827/

在ArcGIs中很容易就能设置带有牵引线的标注。

 
在ArcEngine中实现方法也很简单。如下:
        /// <summary>
/// 设置有引线的标注
/// </summary>
/// <param name="IN_FeatureLayer">要标注的图层</param>
/// <param name="IN_Axmapcontrol">显示控件</param>
private void PRV_SetLabelWithCallout(IFeatureLayer IN_FeatureLayer,AxMapControl IN_Axmapcontrol)
{
//设定地图标注引擎
IAnnotateMap Temp_AnnotateMap = new AnnotateMapClass();
IN_Axmapcontrol.Map.AnnotationEngine = Temp_AnnotateMap;
//标注集合
IGeoFeatureLayer Temp_AnnotationLayer = IN_FeatureLayer as IGeoFeatureLayer;
IAnnotateLayerPropertiesCollection Temp_AllAnnoProps;
Temp_AllAnnoProps = Temp_AnnotationLayer.AnnotationProperties;
Temp_AllAnnoProps.Clear();//清理已有标注属性
IAnnotateLayerProperties Temp_Anno = PRV_SetPropertiesWithCallout(IN_FeatureLayer, "[OBJECTID]", IN_Axmapcontrol);
Temp_AllAnnoProps.Add(Temp_Anno);
IN_Axmapcontrol.AddLayer(IN_FeatureLayer as ILayer);
}
用到的函数:
        /// <summary>
/// 设有引线的标注参数
/// </summary>
/// <param name="IN_FeatureLayer">要标注的图层</param>
/// <param name="IN_ClassExpression">标注表达式</param>
/// <param name="IN_Axmapcontrol">显示控件</param>
/// <returns>标注参数</returns>
private IAnnotateLayerProperties PRV_SetPropertiesWithCallout(IFeatureLayer IN_FeatureLayer, string IN_ClassExpression,AxMapControl IN_Axmapcontrol)
{
//标注引擎
ILabelEngineLayerProperties2 Temp_LabelEngine2 = new LabelEngineLayerPropertiesClass();
IBasicOverposterLayerProperties4 Temp_BasicOverPoster = new BasicOverposterLayerPropertiesClass();
//表达式
Temp_LabelEngine2.Expression = IN_ClassExpression;
//引线
ILineCallout Temp_Callout = new LineCalloutClass();
//引线样式
Temp_Callout.Style = esriLineCalloutStyle.esriLCSMidpoint;
Temp_Callout.LeaderTolerance = 1;
//将外框都设为null,这样就只有引线了
Temp_Callout.Border = null;
Temp_Callout.AccentBar = null;
Temp_Callout.Gap = 10;
//引线类型,这里为点状线
ISimpleLineSymbol Temp_LineSymbol = new SimpleLineSymbolClass();
Temp_LineSymbol.Style = esriSimpleLineStyle.esriSLSDot;
Temp_Callout.LeaderLine = Temp_LineSymbol;
//文字符号设定
IFormattedTextSymbol Temp_TextSymbol = new TextSymbolClass();
//文字颜色
IRgbColor Temp_RGB = new RgbColorClass();
Temp_RGB.Red = 0;
Temp_RGB.Green = 0;
Temp_RGB.Blue = 0;
//文字字体与字号
Temp_TextSymbol = new TextSymbolClass();
Temp_TextSymbol.Color = (IColor)Temp_RGB;
Temp_TextSymbol.Size = 18;
//需要引用stdole.dll
stdole.IFontDisp Temp_Font = new stdole.StdFontClass() as stdole.IFontDisp;
Temp_Font.Name = "Arial";
Temp_TextSymbol.Background = Temp_Callout as ITextBackground;
Temp_TextSymbol.Font = Temp_Font;
Temp_LabelEngine2.Symbol = Temp_TextSymbol as ITextSymbol;
//标注放置方式
switch (IN_FeatureLayer.FeatureClass.ShapeType)//判断图层类型
{
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
Temp_BasicOverPoster.FeatureType = esriBasicOverposterFeatureType.esriOverposterPolygon;
Temp_BasicOverPoster.PolygonPlacementMethod = esriOverposterPolygonPlacementMethod.esriAlwaysHorizontal;
break;
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
Temp_BasicOverPoster.FeatureType = esriBasicOverposterFeatureType.esriOverposterPoint;
Temp_BasicOverPoster.PointPlacementMethod = esriOverposterPointPlacementMethod.esriAroundPoint;
break;
case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
Temp_BasicOverPoster.FeatureType = esriBasicOverposterFeatureType.esriOverposterPolyline;
break;
}
Temp_LabelEngine2.BasicOverposterLayerProperties = Temp_BasicOverPoster as IBasicOverposterLayerProperties;
//设定标注
IMapOverposter Temp_MapPos = IN_Axmapcontrol.Map as IMapOverposter;
IOverposterProperties Temp_OverPoster = Temp_MapPos.OverposterProperties;
IAnnotateLayerProperties Temp_AnnoPClass = Temp_LabelEngine2 as IAnnotateLayerProperties;
(IN_FeatureLayer as IGeoFeatureLayer).DisplayAnnotation = true;
return Temp_AnnoPClass;
}
效果如图:

ArcEngine设置有牵引线的标注的更多相关文章

  1. Arcengine设置坐标系

    转自原文 Arcengine设置坐标系 ArcGIS Engine提供了一系列对象供开发者管理GIS系统的坐标系统. 对大部分开发者而言了解ProjectedCoordinateSystem, Geo ...

  2. GoogleMap的鼠标点击标注、搜索和设置城市的简单应用

    资源 Google Map API包含了大量的文档.示例和各种资料.在使用前需要申请自己的密钥 墙内要用:http://maps.google.cn/maps/api/js? 墙外可用:https:/ ...

  3. IntelliJ IDEA 教程设置讲解

    IntelliJ IDEA 常用设置讲解 说明 IntelliJ在业界被公认为最好的java开发工具之一,尤其在智能代码助手.代码自动提示.重构.J2EE支持.Ant.JUnit.CVS整合.代码审查 ...

  4. IntelliJ IDEA 常用设置讲解

    说明 IntelliJ IDEA 有很多人性化的设置我们必须单独拿出来讲解,也因为这些人性化的设置让我们这些 IntelliJ IDEA 死忠粉更加死心塌地使用它和分享它. 常用设置 IntelliJ ...

  5. 【Matplotlib】绘图常见设置说明

    说明:此贴会不定期进行更新! 设置1:图像的大小设置. 如果已经存在figure对象,可以通过以下代码设置尺寸大小: f.set_figheight(15) f.set_figwidth(15) 若果 ...

  6. 【Matplotlib】 刻度设置(2)

    Tick locating and formatting 该模块包括许多类以支持完整的刻度位置和格式的配置.尽管 locators 与主刻度或小刻度没有关系,他们经由 Axis 类使用来支持主刻度和小 ...

  7. IntelliJ IDEA 常用设置讲解1

    IntelliJ IDEA 有很多人性化的设置我们必须单独拿出来讲解,也因为这些人性化的设置让我们这些 IntelliJ IDEA 死忠粉更加死心塌地使用它和分享它. 常用设置 IntelliJ ID ...

  8. openlayer3之高级标注实现

    首先看实现效果: 实现要点: 1)树形标注实现 2)复杂标注样式定义 3)效率优化 1.树形标注实现 树形标注采用字体符号来实现,包括以下几个步骤 1)载入字体 2)设置标注值与字体对照关系 3)设置 ...

  9. arcengine新建要素类

    ArcGIS里面新建数据集,看起来简单,平时都是默认创建,实际上好多细节问题我们都没注意到 一.在数据集上新建要素类: How to create a feature class within a f ...

随机推荐

  1. 读写分离MYSQL类

    2014年4月27日 12:34:08 概述: 1. 根据sql语句判断是连接读库还是写库 2. 链式调用$this->where()->get() 3. 不同的主机对应不同的实例, 不再 ...

  2. Eureka的自我保护模式

    一 Eureka的自我保护模式 进入自我保护模式最直观的体现就是Eureka Server首页的警告,如下图: 默认情况下,如果Eureka Server在一定时间内没有接收到某个微服务实例的心跳,E ...

  3. JavaScript之this学习心得

    this在运行时绑定,并不是在编写时绑定,它的上下文取决于函数调用的各种条件.this既不指向自身,也不指向函数的词法作用域.this是在函数被调用时发生的绑定,指向什么完全取决于函数在哪里被调用. ...

  4. IntelliJ IDEA快捷键:Ctrl+空格

    The Code Completion feature lets you quickly complete different kinds of statements in  the code.For ...

  5. [转] 实时监听input输入的变化(兼容主流浏览器)

    遇到如此需求,首先想到的是change事件,但用过change的都知道只有在input失去焦点时才会触发,并不能满足实时监测的需求,比如监测用户输入字符数. 在经过查阅一番资料后,欣慰的发现firef ...

  6. 解决vue项目打包后背景图片找不到的问题

    在build->webpack.base.conf.js里添加一句代码: 具体位置在module->rules下 publicPath:"../../",

  7. 010.Zabbix的zatree插件安装

    一 zatree简介 zatree 是来自国内58公司开发的监控软件zabbix的一个插件,主要功能是提供host group的树形展示和在item里指定关键字查询及数据排序. 二 安装前准备 2.1 ...

  8. 常用工具(Windows版本)

    为原有版本修改为markdown后的更新,这个编辑器真心不错,只需要把原来喜欢的表格改成列表即可. 代码工具 代码管理工具 SourceTree:支持windows和mac跨平台使用的git图形化客户 ...

  9. Struts 2 学习笔记

    1.Struts2 jar包 struts2-core-2.1.8.1 struts2的核心jar包,不可缺少的 xwork-core-2.1.6 xwork的核心包,由于Struts2是由xwork ...

  10. Codeforces Round #373 (Div. 2) A. Vitya in the Countryside 水题

    A. Vitya in the Countryside 题目连接: http://codeforces.com/contest/719/problem/A Description Every summ ...