ArcGIS AddIN Sample学习笔记
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学习笔记的更多相关文章
- arcgis for flex 学习笔记(一)
初步认识 地图由图层.要素.样式等组成.地图上有N个图层,图层上有N个要素,每个要素可以存放点.线.面等,每个要素可以设置样式,如果显示图片.或文字均可以先创建一个mxml组件,然后设置到要素上. 面 ...
- ArcGIS JS 学习笔记1 用ArcGIS JS 实现仿百度地图的距离量测和面积量测
一.开篇 在博客注册了三年,今天才决定写第一篇博客,警告自己不要懒!!! 二.关于ArcGIS JS 版本选择 在写这篇博客时ArcGIS JS 4.0正式版已经发布.它和3.x版本的不同是,Map不 ...
- ArcGIS API for JavaScript 4.2学习笔记[1] 显示地图
ArcGIS API for JavaScript 4.2直接从官网的Sample中学习,API Reference也是从官网翻译理解过来,鉴于网上截稿前还没有人发布过4.2的学习笔记,我就试试吧. ...
- box2dweb 学习笔记--sample讲解
前言: 之前博文"台球游戏的核心算法和AI(1)" 中, 提到过想用HTML5+Box2d来编写实现一个台球游戏. 以此来对比感慨一下游戏物理引擎的巨大威力. 做为H5+box2d ...
- ArcGIS API for Silverlight学习笔记
ArcGIS API for Silverlight学习笔记(一):为什么要用Silverlight API(转) 你用上3G手机了吗?你可能会说,我就是喜欢用nokia1100,ABCDEFG跟我都 ...
- ArcGIS API for JavaScript 4.2学习笔记[0] AJS4.2概述、新特性、未来产品线计划与AJS笔记目录
放着好好的成熟的AJS 3.19不学,为什么要去碰乳臭未干的AJS 4.2? 4.2全线基础学习请点击[直达] 4.3及更高版本的补充学习请关注我的博客. ArcGIS API for JavaScr ...
- ArcGIS API for JavaScript 4.2学习笔记[21] 对3D场景上的3D要素进行点击查询【Query类学习】
有人问我怎么这个系列没有写自己做的东西呢? 大哥大姐,这是"学习笔记"啊!当然主要以解读和笔记为主咯. 也有人找我要实例代码(不是示例),我表示AJS尚未成熟,现在数据编辑功能才简 ...
- 面图层拓扑检查和错误自动修改—ArcGIS案例学习笔记
面图层拓扑检查和错误自动修改-ArcGIS案例学习笔记 联系方式:谢老师,135_4855_4328,xiexiaokui#139.com 数据源: gis_ex10\ex01\parcel.shp, ...
- 计算平面面积和斜面面积-ArcGIS案例学习笔记
计算平面面积和斜面面积-ArcGIS案例学习笔记 联系方式:谢老师,135_4855_4328,xiexiaokui#139.com 数据:实验数据\Chp8\Ex5\demTif.tif 平面面积= ...
随机推荐
- Elasticsearch跨集群搜索(Cross Cluster Search)
1.简介 Elasticsearch在5.3版本中引入了Cross Cluster Search(CCS 跨集群搜索)功能,用来替换掉要被废弃的Tribe Node.类似Tribe Node,Cros ...
- 解决Everything1.4版本预览时不支持自定义后缀的问题
2017年6月Everything版本升级到了1.4.x 个人使用下来认为最主要的有以下几点 添加预览功能 搜索结果多选 点击目录列即打开文件所在目录(需要设置:常规->结果->双击路径列 ...
- docker中mysql数据库的数据导入和导出
导出数据 查看下 mysql 运行名称 docker ps 结果:  执行导出(备份)数据库命令: 由第一步的结果可知,我们的 mysql 运行在一个叫 mysql_server 的 docker ...
- IDEA使用笔记(十一)——好玩的类图结构
今天使用 IntelliJ IDEA 发现一个好玩的操作,尤其对于研究源码了解类的层级关系有非常大的帮助! 1:先看效果 1-1:HashSet的类图结构——继承什么类.实现什么接口一目了然 1-2: ...
- Linux Crontab及使用salt进行管理
一.引言: 最近无意之间看到salt有一个cron的模块,今天就在这里介绍linux crontab以及通过salt的cron对crontab的管理. 二.Linux crontab的介绍: cron ...
- 生产环境CPU过高问题定位
问题描述: 生产环境下的某台tomcat7服务器,在刚发布时的时候一切都很正常,在运行一段时间后就出现CPU占用很高的问题,基本上是负载一天比一天高. 解决过程: 1.根据top命令,发现 ...
- TensorFlow+Keras 03 TensorFlow 与 Keras 介绍
1 TensorFlow 架构图 1.1 处理器 TensorFlow 可以在CPU.GPU.TPU中执行 1.2 平台 TensorFlow 具备跨平台能力,Windows .Linux.Andro ...
- vue实现部分页面导入底部 vue配置公用头部、底部,可控制显示隐藏
vue实现部分页面导入底部 vue配置公用头部.底部,可控制显示隐藏 在app.vue文件里引入公共的header 和 footer header 和 footer 默认显示,例如某个页面不需要显示h ...
- CSS-2
day 39 学习链接:https://www.cnblogs.com/yuanchenqi/articles/5977825.html 4 文本属性 font-size: 10px; text-a ...
- jquery.cookie.js写入的值没有定义
这个是插件的基本语法,你写的没错,错就错在你肯定是在本地测试的,cookie是基于域名来储存的.意思您要放到测试服务器上或者本地localhost服务器上才会生效.cookie具有不同域名下储存不可共 ...