1.AddInEditorExtension

功能描述:编辑器扩展,实现在编辑要素,对编辑事件的监听,及对新创建的要素的处理

核心代码:

void Events_OnStartEditing()
{
//Since features of shapefiles, coverages etc cannot be validated, ignore wiring events for them
if (ArcMap.Editor.EditWorkspace.Type != esriWorkspaceType.esriFileSystemWorkspace)
{
//wire OnCreateFeature Edit event
Events.OnCreateFeature += new IEditEvents_OnCreateFeatureEventHandler(Events_OnCreateChangeFeature);
//wire onChangeFeature Edit Event
Events.OnChangeFeature += new IEditEvents_OnChangeFeatureEventHandler(Events_OnCreateChangeFeature);
}
}
//Invoked at the end of Editor session (Editor->Stop Editing)
void Events_OnStopEditing(bool Save)
{
//Since features of shapefiles, coverages etc cannot be validated, ignore wiring events for them
if (ArcMap.Editor.EditWorkspace.Type != esriWorkspaceType.esriFileSystemWorkspace)
{
//unwire OnCreateFeature Edit event
Events.OnCreateFeature -= new IEditEvents_OnCreateFeatureEventHandler(Events_OnCreateChangeFeature);
//unwire onChangeFeature Edit Event
Events.OnChangeFeature -= new IEditEvents_OnChangeFeatureEventHandler(Events_OnCreateChangeFeature);
}
} void Events_OnCreateChangeFeature(ESRI.ArcGIS.Geodatabase.IObject obj)
{
IFeature inFeature = (IFeature)obj;
if (inFeature.Class is IValidation)
{
IValidate validate = (IValidate)inFeature;
string errorMessage;
//Validates connectivity rules, relationship rules, topology rules etc
bool bIsvalid = validate.Validate(out errorMessage);
if (!bIsvalid)
{
System.Windows.Forms.MessageBox.Show("Invalid Feature\n\n" + errorMessage);
}
else
{
System.Windows.Forms.MessageBox.Show("Valid Feature");
}
}
}

注:具体工具的ProgId在这里查询 https://www.cnblogs.com/gisoracle/p/5971974.html

2.AddInExtensionPersist

功能描述:ArcMap扩展,实现对ArcMap事件的监听

比如启动,加载,保存等事件

3.AddInReportManager

功能说明:ESRI自带的一种报表导出方案

主要接口IReportDataSource,IReportTemplate

需要提前做好.rlf文件

4.AddInTimeSeriesGraph

功能描述:折线图 Tool

示例数据路径:C:\Program Files (x86)\ArcGIS\DeveloperKit10.1\Samples\data\StreamflowDateTime

相关接口

IIdentify :Provides access to members that identify features,相关矢量图层

IDisplayTable :Provides access to members that work with the display table associated with a standalone table. 该接口包含Joined 字段

IFeatureLayerDefinition:

ILookupSymbol .LookupSymbol ():Returns a reference to the renderer's symbol for the input feature.查询某个要素的Symbol

IDataGraphWindow2 :Provides access to members that control the DataGraph Window. ESRI自带的专题图窗口,可以使用下述代码调用显示

pDGWin = new DataGraphWindowClass();
pDGWin.DataGraphBase = pDataGraphBase;
pDGWin.Application = ArcMap.Application;
pDGWin.Show(true); pDataGraphs.AddDataGraph(pDataGraphBase);

设置Title,坐标轴显示内容等

pDataGraphT = new DataGraphTClass();
pDataGraphBase = (IDataGraphBase)pDataGraphT; // load template from <ARCGISHOME>\GraphTemplates\
string strPath = null;
strPath = Environment.GetEnvironmentVariable("ARCGISHOME");
try
{
pDataGraphT.LoadTemplate(strPath + @"GraphTemplates\timeseries.tee");
}
catch
{ } // graph, axis and legend titles. Substitute them for different input layer
pDataGraphT.GeneralProperties.Title = "Daily Streamflow for Guadalupe Basin in 1999";
pDataGraphT.LegendProperties.Title = "Monitoring Point";
pDataGraphT.get_AxisProperties().Title = "Streamflow (cfs)";
pDataGraphT.get_AxisProperties().Logarithmic = true;
pDataGraphT.get_AxisProperties().Title = "Date";
pDataGraphBase.Name = layerName;

设置绘图内容:

ISeriesProperties pSP = null;
pSP = pDataGraphT.AddSeries("line:vertical");
pSP.ColorType = esriGraphColorType.esriGraphColorCustomAll;
pSP.CustomColor = pSymbol.Color.RGB;
pSP.WhereClause = whereClause;
pSP.InLegend = true;
pSP.Name = gageID; pSP.SourceData = pLayer;
pSP.SetField(, timefldName);
pSP.SetField(, dataFldName);
IDataSortSeriesProperties pSortFlds = null;
pSortFlds = (IDataSortSeriesProperties)pSP;
int idx = ;
pSortFlds.AddSortingField(timefldName, true, ref idx); pDataGraphBase.UseSelectedSet = true; ITrackCancel pCancelTracker = null;
pCancelTracker = new CancelTracker();
pDataGraphT.Update(pCancelTracker);

其他代码片段:

以下代码实现在检索时,先检测定义查询的Sql语句,如果有内容,则与新的查询语句And,没有,则直接使用新的查询语句

IFeatureLayerDefinition pFeatureLayerDef = null;
pFeatureLayerDef = (IFeatureLayerDefinition)pLayer;
string definitionExpression = null;
definitionExpression = pFeatureLayerDef.DefinitionExpression; string whereClause = null;
if (definitionExpression == "")
whereClause = "[" + gageIDFldName + "] = '" + gageID + "'";
else
whereClause = "[" + gageIDFldName + "] = '" + gageID + "' AND " + definitionExpression;

5.AlgorithmicColorRamp

功能说明:

接口:

IContentsView: Provides access to members that control table of contents views,

Used to manage a contents view. The tabs in ArcMap's Table of Contents (TOC) are examples of a contents view.

示例用法:判断TOC中选中的内容

IContentsView ContentsView = null;
ContentsView = ArcMap.Document.CurrentContentsView;
if (ContentsView is TOCDisplayView)
{
if (ContentsView.SelectedItem is DBNull)
{
//
// If we don't have anything selected.
//
MessageBox.Show("SelectedItem is Null C#." + "Select a layer in the Table of Contents.", "No Layer Selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
//
// Get the selected Item.
//
VarSelectedItem = ContentsView.SelectedItem;
//
// Selected Item should implement the IGeoFeatureLayer interface - therefore we
// have selected a feature layer with a Renderer property (Note: Other interfaces
// also have a Renderer property, which may behave differently.
//
if (VarSelectedItem is IGeoFeatureLayer)
{
       //....
      }

6.AngleAngleConstructor

接口

IEditSketch3:Provides access to members that access and manipulate the edit sketch.

2.Brushing

ArcGIS AddIN Sample学习笔记的更多相关文章

  1. arcgis for flex 学习笔记(一)

    初步认识 地图由图层.要素.样式等组成.地图上有N个图层,图层上有N个要素,每个要素可以存放点.线.面等,每个要素可以设置样式,如果显示图片.或文字均可以先创建一个mxml组件,然后设置到要素上. 面 ...

  2. ArcGIS JS 学习笔记1 用ArcGIS JS 实现仿百度地图的距离量测和面积量测

    一.开篇 在博客注册了三年,今天才决定写第一篇博客,警告自己不要懒!!! 二.关于ArcGIS JS 版本选择 在写这篇博客时ArcGIS JS 4.0正式版已经发布.它和3.x版本的不同是,Map不 ...

  3. ArcGIS API for JavaScript 4.2学习笔记[1] 显示地图

    ArcGIS API for JavaScript 4.2直接从官网的Sample中学习,API Reference也是从官网翻译理解过来,鉴于网上截稿前还没有人发布过4.2的学习笔记,我就试试吧. ...

  4. box2dweb 学习笔记--sample讲解

    前言: 之前博文"台球游戏的核心算法和AI(1)" 中, 提到过想用HTML5+Box2d来编写实现一个台球游戏. 以此来对比感慨一下游戏物理引擎的巨大威力. 做为H5+box2d ...

  5. ArcGIS API for Silverlight学习笔记

    ArcGIS API for Silverlight学习笔记(一):为什么要用Silverlight API(转) 你用上3G手机了吗?你可能会说,我就是喜欢用nokia1100,ABCDEFG跟我都 ...

  6. ArcGIS API for JavaScript 4.2学习笔记[0] AJS4.2概述、新特性、未来产品线计划与AJS笔记目录

    放着好好的成熟的AJS 3.19不学,为什么要去碰乳臭未干的AJS 4.2? 4.2全线基础学习请点击[直达] 4.3及更高版本的补充学习请关注我的博客. ArcGIS API for JavaScr ...

  7. ArcGIS API for JavaScript 4.2学习笔记[21] 对3D场景上的3D要素进行点击查询【Query类学习】

    有人问我怎么这个系列没有写自己做的东西呢? 大哥大姐,这是"学习笔记"啊!当然主要以解读和笔记为主咯. 也有人找我要实例代码(不是示例),我表示AJS尚未成熟,现在数据编辑功能才简 ...

  8. 面图层拓扑检查和错误自动修改—ArcGIS案例学习笔记

    面图层拓扑检查和错误自动修改-ArcGIS案例学习笔记 联系方式:谢老师,135_4855_4328,xiexiaokui#139.com 数据源: gis_ex10\ex01\parcel.shp, ...

  9. 计算平面面积和斜面面积-ArcGIS案例学习笔记

    计算平面面积和斜面面积-ArcGIS案例学习笔记 联系方式:谢老师,135_4855_4328,xiexiaokui#139.com 数据:实验数据\Chp8\Ex5\demTif.tif 平面面积= ...

随机推荐

  1. EF Core中执行Sql语句查询操作之FromSql,ExecuteSqlCommand,SqlQuery

    一.目前EF Core的版本为V2.1 相比较EF Core v1.0 目前已经增加了不少功能. EF Core除了常用的增删改模型操作,Sql语句在不少项目中是不能避免的. 在EF Core中上下文 ...

  2. Go语言二叉树定义及遍历算法实现

    // binary_tree 二叉树 package Algorithm import ( "reflect" ) // 二叉树定义 type BinaryTree struct ...

  3. C# Monitor实现

    Monitor的code如下,非常简单: public static class Monitor { public static extern void Enter(Object obj); publ ...

  4. ORACLE通过SQL将一行数据转换为多行

    转换前和需要转成的格式如下图: sql语句如下: , ; 效果如下:

  5. 使用python实现深度神经网络 2(转)

    https://blog.csdn.net/oxuzhenyi/article/details/73026796 导数与梯度.矩阵运算性质.科学计算库numpy 一.实验介绍 1.1 实验内容 虽然在 ...

  6. 机器学习中Batch Size、Iteration和Epoch的概念

    Batch Size:批尺寸.机器学习中参数更新的方法有三种: (1)Batch Gradient Descent,批梯度下降,遍历全部数据集计算一次损失函数,进行一次参数更新,这样得到的方向能够更加 ...

  7. vim配置go语法高亮

    操作系统 : CentOS7.3.1611_x64 go 版本 : go1.8.3 linux/amd64 vim版本 :version 7.4.160 vim配置go语言语法高亮的问题已经遇到过好几 ...

  8. [转]Redis cluster failover

    今天测试了redis cluster  failover 功能,在切换过程中很快,但在failover时有force 与takeover 之分 [RHZYTEST_10:REDIS:6237:M ~] ...

  9. 转 Java虚拟机5:Java垃圾回收(GC)机制详解

    转 Java虚拟机5:Java垃圾回收(GC)机制详解 Java虚拟机5:Java垃圾回收(GC)机制详解 哪些内存需要回收? 哪些内存需要回收是垃圾回收机制第一个要考虑的问题,所谓“要回收的垃圾”无 ...

  10. 【Wildfly】从默认的自动重启修改为手动重启

    最近在使用Wildfly作为Web服务器,用的是10.0.0版本.默认情况下,Wildfly的部署方式是通过将项目放到%WILDFLY_HOME%\standalone\deployments下的,然 ...