来自: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. 一个无锁消息队列引发的血案(六)——RingQueue(中) 休眠的艺术 [续]

    目录 (一)起因 (二)混合自旋锁 (三)q3.h 与 RingBuffer (四)RingQueue(上) 自旋锁 (五)RingQueue(中) 休眠的艺术 (六)RingQueue(中) 休眠的 ...

  2. JAVA数据库编程(JDBC技术)-入门笔记

    本菜鸟才介入Java,我现在不急着去看那些基本的语法或者一些Java里面的版本的特征或者是一些晋级的知识,因为有一点.Net的OOP编程思想,所以对于Java的这些语法以及什么的在用到的时候在去发现学 ...

  3. 二十三、springboot之session共享

    通过redis实现session共享 SpringBoot集成springsession 1.引入依赖(gradle方式) dependencies { compile('org.springfram ...

  4. poj1273

    赤裸裸的最大流 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstr ...

  5. android view的多种移动方式(测试集合)

    前言 由于最近在写一个涉及移动方面的自定义View,在做移动的时候用到了类似offsetTopAndBottom .setTranslationY.scrollTo.scrollBy等方法,对于他们的 ...

  6. laravel队列,事件简单使用方法

    A.队列的使用 1.队列配置文件存储在 config/queue.php 根据自己的情况进行配置 2..env文件 QUEUE_DRIVER=database(根据个人情况配置,redis等) 3.创 ...

  7. 交叉验证(Cross Validation)简介

    参考    交叉验证      交叉验证 (Cross Validation)刘建平 一.训练集 vs. 测试集 在模式识别(pattern recognition)与机器学习(machine lea ...

  8. 039 DataFrame的理解

    1.构成 由RDD+Schema构成 RDD: DataFrame中的数据 ===> df.rdd Schema: RDD中数据的结构 ===> df.schema df是dataFram ...

  9. 024.Zabbix告警等级机制

    一 等级告警 告警升级可以对告警结果按自定义的时间段进行进行消息发送,并执行命令,形成一个梯度的告警处理. 二 按时间自定义告警梯度 2.1 添加时间发生的时间戳和发送时间 2.2 设置三个等级梯度 ...

  10. 关于dubbo和zookeeper 注册中心

    Dubbo采用全Spring配置方式,透明化接入应用,对应用没有任何API侵入,只需用Spring加载Dubbo的配置即可,Dubbo基于Spring的Schema扩展进行加载.如果不想使用Sprin ...