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 平面面积= ...
随机推荐
- PLC是嵌入式系统吗?【转】
PLC是嵌入式系统吗? 一.PLC即Programmable Logic Controller,可编程逻辑控制器 单片机又名MCU即microprocessor control unit,微处理机控制 ...
- jsp中添加过滤器,实现校验用户身份
我现在需要实现一个功能,就是用户登录前不允许访问系统,我使用的是jsp的过滤器来实现的. 先把filter过滤器的代码粘出来: package com.day8.filter; import java ...
- [Python设计模式] 第12章 基金理财更省事——外观模式
github地址:https://github.com/cheesezh/python_design_patterns 题目1 用程序模拟股民直接炒股的代码,比如股民投资了股票1,股票2,股票3,国债 ...
- java logAspect
@Around("execution(* com.iotx.cep.biz.rpc.impl.*.*(..)) " + "&& !execution(* ...
- Laravel: 基础篇
一.安装 1)采用一键安装包 http://laravelacademy.org/resources-download 2)Mac 上安装 ----------在Mac上安装composer----- ...
- [转]numpy 100道练习题
100 numpy exercise 翻译:YingJoy 网址: https://www.yingjoy.cn/ 来源:https://github.com/rougier/numpy-100 Nu ...
- stackoverflow愚人节彩蛋效果
效果如图所示: index.js /*! * Fairy Dust Cursor.js * - 90's cursors collection * -- https://github.com/thol ...
- Android开发导出apk报错:Unable to build: the file dx.jar was not loaded from the SDK folder
问题背景 此问题一般出现在,同时使用了Eclipse和Android Studio,eclipse是不会去下载最新的Android的相关tools,但是studio有时候会自动更新最新的build-t ...
- VPS、虚拟主机、云主机的区别
引用知乎网友通俗的例子解释: 1. 小王是深圳的一拆迁户,有钱任性:自己租了一块地皮[带宽],盖了一栋10000平方的房子[服务器],计划租给别人赚钱.2. 但是10000平方的房子太大,能租起的人太 ...
- zabbix之微信告警(python版):微信个人报警,微信企业号告警脚本
微信个人告警脚本 微信个人告警:使用个人微信,发送到微信群组,微信好友 两个脚本执行: 1)能连接网络2)先执行server.py,扫描登录微信,登录之后没有报错,打开新终端查看端口是否起来了3)在z ...