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. 为Ubuntu新创建用户创建默认.bashrc并自动加载

    首先,su – 到新创建的用户 拷贝默认的.bashrc过来   1 cp /etc/skel/.bashrc ~/ 然后创建.profile文件   1 vi ~/.profile 粘贴下面的内容 ...

  2. golang使用chan注意事项

    背景 最近老代码中遇到的一个问题,表现为: goroutine数量在高峰期上涨,上涨后平峰期将不下来.也就是goroutine泄露 使用pprof看,进程堵塞在chan chan的使用经验 在使用ch ...

  3. Glide4 用法总结 MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  4. Activity class {com.../com....MainActivity} does not exist.

    报错信息如上图所示,解决步骤: 1. 首先是检查这个MainActivity.java是不是真的存在,且包名和路径无误: 2. 如果文件存在,且包名和路径没有问题,那么就打开你项目所在的/androi ...

  5. Win10系统的SurfacePro4无法修改启动顺序怎么办

    必须要把底部的开关关闭,否则启动顺序无法修改      

  6. 使用Guava的RateLimiter完成简单的大流量限流

    限流的一般思路: 1.随机丢弃一定规则的用户(迅速过滤掉90%的用户): 2.MQ削峰(比如设一个MQ可以容纳的最大消息量,达到这个量后MQ给予reject): 3.业务逻辑层使用RateLimite ...

  7. sed 替换多个空格为一个

    sed -i 's/[ ][ ]*/ /g'  file.txt

  8. Docker在windows下的使用【一】

    1.windows按照docker的基本要求 (1)64为操作系统,win7或者更高 (2)支持“ Hardware Virtualization Technology”,并且,“virtualiza ...

  9. [转]tensorflow中的gather

    原文链接 tensorflow中取下标的函数包括:tf.gather , tf.gather_nd 和 tf.batch_gather. 1.tf.gather(params,indices,vali ...

  10. Android jks 签名文件 生成

    Android Win7 上使用cmd生成Jks cmd 命令 C:\Program Files\Java\jre1.8.0_111\bin>keytool -genkeypair -alias ...