来自: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 字符编码设置

    安装mysql时如果字符编码为默认值latin1,则需要修改为utf8以便支持中文数据. 命令如下: 1.显示数据库字符集 mysql> show create database test;+- ...

  2. Jmeter之逻辑控制器(Logic Controller)【转】

    Jmeter之逻辑控制器(Logic Controller) 前言: 1. Jmeter官网对逻辑控制器的解释是:“Logic Controllers determine the order in w ...

  3. (转)js函数前加分号和感叹号是什么意思?有什么用?

    转载地址:https://www.cnblogs.com/mq0036/p/4605255.html 一般看JQuery插件里的写法是这样的 (function($) { //... })(jQuer ...

  4. python实战之原生爬虫(爬取熊猫主播排行榜)

    """ this is a module,多行注释 """ import re from urllib import request # B ...

  5. HTML5+ App开发入门

    HTML5 Plus应用概述 HTML5 Plus移动App,简称5+App,是一种基于HTML.JS.CSS编写的运行于手机端的App,这种App可以通过扩展的JS API任意调用手机的原生能力,实 ...

  6. Java编程的逻辑 (72) - 显式条件

    ​本系列文章经补充和完善,已修订整理成书<Java编程的逻辑>,由机械工业出版社华章分社出版,于2018年1月上市热销,读者好评如潮!各大网店和书店有售,欢迎购买,京东自营链接:http: ...

  7. EFCore CodeFirst 适配数据库

    EF6中可以直接根据代码模型生成数据库Database.SetInitializer即可 在EFCore中如何实现呢? 这项功能放在了DatabaseFacade对象中,传入数据库上下文对象实例化到一 ...

  8. 008.KVM-VNC管理

    一 VNC管理 1.1 修改配置 [root@kvm-host ~]# vi /etc/libvirt/qemu.conf …… vnc_listen = "0.0.0.0" 说明 ...

  9. SpringMVC框架02——SpringMVC的Controller详解

    1.基于注解的控制器 1.1.@Controller 注解类型 在SpringMVC中使用org.springframework.stereotype.Controller注解类型声明某类的实例是一个 ...

  10. 用mac的chrome浏览器调试Android手机的网页

    一.参考链接 read chrome remote debugging documentation 调出开发者选项 二.设置android 在安卓4.2及更新的版本中,默认情况下,[开发者选项]是隐藏 ...