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 平面面积= ...
随机推荐
- Mockito-简单使用使用
参考案例:(本位使用markdown编写) git.oschina实例:https://gitee.com/lhhTestTool/LhhMockito # LhhMockitomock 单元测试 M ...
- CentOS安装mariadb做为mysql的替代品
mariadb做为mysql的替代品 现在centos的新版本yum包已换成mariadb 安装一些库 yum install gcc gcc-c++ wget net-tools 复制代码 查看SE ...
- TensorFlow迭代速度变慢的问题
最近用TensorFlow实现遗传算法(Genetic Algorithms),发现迭代速度越来越慢,用time.time()观察以后,发现每次迭代都要比上一次慢0.5秒左右,但是每次迭代的计算量是差 ...
- [Oracle] “表中有数据,但select count(*)的结果为0”问题的解决办法
一.问题 今天遇到了一个神奇的问题--表中有数据,但select count(*)的结果为0. 这个问题最初的表现形式是"查询报表没有分页". 最开始还以为是java端的问题.后来 ...
- Git 将代码回到指定版本
将代码回到hash为1fbcb7ea3b43df60c639875d2bb68e20b451059e的版本 git checkout 1fbcb7ea3b43df60c639875d2bb68e20b ...
- mysql5.6 sql_mode设置为宽松模式
最近遇到一个很奇怪的事情 由于数据人员的需求,现在需要修改mysql的sql_mode sql_mode默认是sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_ ...
- H+ 编辑tab页 保存后 刷新列表tab页 并关闭自已。tabA页调用tabB页的方法
//注:在contabs.js文件中 $(function () { }); 方法外 加入 //注: data-name="' + menuName + '" 这句是加入的自定义属 ...
- LeeCX - 开源后台管理系统简单介绍
我们在github上开源了一个后台管理系统,使用了前端css框架并且简单的封装了一下,技术的将会不间断更新,详细可以点击原文链接.具体介绍如下: LeeCX 开源后台管理系统,前端基于bootstra ...
- Atitit 数据库排除某一列 字段 显示
Atitit 数据库排除某一列 字段 显示 GROUP_CONCAT 行列转换 mysql利用group_concat()合并多行数据到一行_Mysql_脚本之家 sELECT GROUP_CO ...
- MySQL 4 种隔离级别的区别
## 测试环境 mysql> select version(); +------------+ | version() | +------------+ -log | +------------ ...