AE二次开发中几个功能速成归纳(符号设计器、创建要素、图形编辑、属性表编辑、缓冲区分析)
/*
* 实习课上讲进阶功能所用文档,因为赶时间从网上抄抄改改,凑合能用,记录一下以备个人后用。
*
* -------------------------------------------------------------------
*
* 使用前提:已搭建好AE的GIS基本框架,包括TOC、mapcontrol、toolbar拖控件,mxd、shp文件载入显示,查看图层属性表等
*
* -------------------------------------------------------------------
*/
/* Form1中的using */ using System; using System.Windows.Forms; using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Controls; using ESRI.ArcGIS.Display; using ESRI.ArcGIS.Geometry; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.SystemUI; using ESRI.ArcGIS.esriSystem; using System.Drawing; using System.Runtime.InteropServices; using ESRI.ArcGIS.DataSourcesFile; using System.Collections; /*
* 一、符号设计
*
* 在TOC的doubleclick事件中写入:
*/ esriTOCControlItem toccItem = esriTOCControlItem.esriTOCControlItemNone; ILayer iLayer = null; IBasicMap iBasicMap = null; object unk = null; object data = null; axTOCControl1.HitTest( e.x, e.y, ref toccItem, ref iBasicMap, ref iLayer, ref unk, ref data ); /* 获取所点击图例及其图层 */ if ( e.button == ) {
if ( toccItem == esriTOCControlItem.esriTOCControlItemLegendClass ) {
ILegendClass pLC = new LegendClassClass(); pLC = ( (ILegendGroup) unk).get_Class( (int) data ); /* 获取图例 */ ISymbol pSym = pLC.Symbol; /* 获取图例的符号 */ ESRI.ArcGIS.DisplayUI.ISymbolSelector pSS = new ESRI.ArcGIS.DisplayUI.SymbolSelectorClass(); /* 创建符号选择器 */ bool a = false; pSS.AddSymbol( pSym ); a = pSS.SelectSymbol( ); /* 打开符号选择器 */ if ( a ) {
pLC.Symbol = pSS.GetSymbolAt( );
} this.axMapControl1.ActiveView.Refresh(); this.axTOCControl1.Refresh();
}
} /*
* 二、创建要素
*
* 1.创建并添加shp新图层
*/ /* 点shp的创建并添加 */ private void 点ToolStripMenuItem_Click( object sender, EventArgs e ) {
string pointshppath = ""; SaveFileDialog spointdlg = new SaveFileDialog(); /* 打开保存文件对话框,设置保存路径和shp文件名 */ if ( spointdlg.ShowDialog() == DialogResult.OK ) {
pointshppath = spointdlg.FileName;
}else {
return;
} /* 准备好要素类空对象 */ IFeatureClass m_pointfeatureclass = null; /* 从文件路径中分解出文件夹路径和文件名称 */ int count = pointshppath.LastIndexOf ("\"); string folder = pointshppath.Substring(, count); string name = pointshppath.Substring(count + , pointshppath.Length - count - ); //根据文件夹路径创建工作空间工厂和工作空间 IWorkspace ipws; IWorkspaceFactory ipwsf = new ShapefileWorkspaceFactoryClass(); ipws = ipwsf.OpenFromFile(folder, ); //转为要素工作空间 IFeatureWorkspace ifeatws; ifeatws = ipws as IFeatureWorkspace; //对shp文件的一些必要设置,除了红字部分外都不用改 IFields pFields = new FieldsClass(); IField pField = new FieldClass(); IFieldsEdit pFieldsEdit = pFields as IFieldsEdit; IFieldEdit pFieldEdit = pField as IFieldEdit; IGeometryDef ipGeodef = new GeometryDefClass(); IGeometryDefEdit ipGeodefEdit = ipGeodef as IGeometryDefEdit; ISpatialReference ipSpatialRef; IUnknownCoordinateSystem iunknowncoord = new UnknownCoordinateSystemClass(); ipSpatialRef = iunknowncoord; ipGeodefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;//确定你要生成的shp的几何类型(点线面) ipSpatialRef.SetMDomain(-, ); ipGeodefEdit.HasM_2 = false; ipGeodefEdit.HasZ_2 = false; ipGeodefEdit.SpatialReference_2 = ipSpatialRef; pFieldEdit.Name_2 = "Shape "; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry; pFieldEdit.GeometryDef_2 = ipGeodef; pFieldsEdit.AddField(pField); ////////////////////////////////////////// //创建要素类并导出shp文件于预设文件路径 m_pointfeatureclass = ifeatws.CreateFeatureClass(name, pFields, null, null, esriFeatureType.esriFTSimple, "Shape ", " "); //加载新创建的shp文件并调到图层显示顺序的最顶层 axMapControl1.AddShapeFile(folder,name); axMapControl1.MoveLayerTo(, axMapControl1.LayerCount - ); return; } //线shp的创建并添加 private void 线ToolStripMenuItem_Click(object sender, EventArgs e) { string lineshppath = " "; SaveFileDialog slinedlg = new SaveFileDialog();//打开保存文件对话框,设置保存路径和shp文件名 if (slinedlg.ShowDialog() == DialogResult.OK) { lineshppath = slinedlg.FileName; } else { return; } //准备好要素类空对象 IFeatureClass m_linefeatureclass = null; //从文件路径中分解出文件夹路径和文件名称 int count = lineshppath.LastIndexOf(" \ "); string folder = lineshppath.Substring(, count); string name = lineshppath.Substring(count + , lineshppath.Length - count - ); //根据文件夹路径创建工作空间工厂和工作空间 IWorkspace ipws; IWorkspaceFactory ipwsf = new ShapefileWorkspaceFactoryClass(); ipws = ipwsf.OpenFromFile(folder, ); //转为要素工作空间 IFeatureWorkspace ifeatws; ifeatws = ipws as IFeatureWorkspace; //对shp文件的一些必要设置,除了红字部分外都不用改 IFields pFields = new FieldsClass(); IField pField = new FieldClass(); IFieldsEdit pFieldsEdit = pFields as IFieldsEdit; IFieldEdit pFieldEdit = pField as IFieldEdit; IGeometryDef ipGeodef = new GeometryDefClass(); IGeometryDefEdit ipGeodefEdit = ipGeodef as IGeometryDefEdit; ISpatialReference ipSpatialRef; IUnknownCoordinateSystem iunknowncoord = new UnknownCoordinateSystemClass(); ipSpatialRef = iunknowncoord; ipGeodefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolyline;//确定你要生成的shp的几何类型(点线面) ipSpatialRef.SetMDomain(-, ); ipGeodefEdit.HasM_2 = false; ipGeodefEdit.HasZ_2 = false; ipGeodefEdit.SpatialReference_2 = ipSpatialRef; pFieldEdit.Name_2 = "Shape "; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry; pFieldEdit.GeometryDef_2 = ipGeodef; pFieldsEdit.AddField(pField); ////////////////////////////////////////// //创建要素类并导出shp文件于预设文件路径 m_linefeatureclass = ifeatws.CreateFeatureClass(name, pFields, null, null, esriFeatureType.esriFTSimple, "Shape ", " "); //加载新创建的shp文件并调到图层显示顺序的最顶层 axMapControl1.AddShapeFile(folder,name); axMapControl1.MoveLayerTo(, axMapControl1.LayerCount - ); return; } //面shp的创建并添加 private void 面ToolStripMenuItem_Click(object sender, EventArgs e) { string polygonshppath = " "; SaveFileDialog spolygondlg = new SaveFileDialog();//打开保存文件对话框,设置保存路径和shp文件名 if (spolygondlg.ShowDialog() == DialogResult.OK) { polygonshppath = spolygondlg.FileName; } else { return; } //准备好要素类空对象 IFeatureClass m_polygonfeatureclass = null; //从文件路径中分解出文件夹路径和文件名称 int count = polygonshppath.LastIndexOf(" \ "); string folder = polygonshppath.Substring(, count); string name = polygonshppath.Substring(count + , polygonshppath.Length - count - ); //根据文件夹路径创建工作空间工厂和工作空间 IWorkspace ipws; IWorkspaceFactory ipwsf = new ShapefileWorkspaceFactoryClass(); ipws = ipwsf.OpenFromFile(folder, ); //转为要素工作空间 IFeatureWorkspace ifeatws; ifeatws = ipws as IFeatureWorkspace; //对shp文件的一些必要设置,除了红字部分外都不用改 IFields pFields = new FieldsClass(); IField pField = new FieldClass(); IFieldsEdit pFieldsEdit = pFields as IFieldsEdit; IFieldEdit pFieldEdit = pField as IFieldEdit; IGeometryDef ipGeodef = new GeometryDefClass(); IGeometryDefEdit ipGeodefEdit = ipGeodef as IGeometryDefEdit; ISpatialReference ipSpatialRef; IUnknownCoordinateSystem iunknowncoord = new UnknownCoordinateSystemClass(); ipSpatialRef = iunknowncoord; ipGeodefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolygon;//确定你要生成的shp的几何类型(点线面) ipSpatialRef.SetMDomain(-, ); ipGeodefEdit.HasM_2 = false; ipGeodefEdit.HasZ_2 = false; ipGeodefEdit.SpatialReference_2 = ipSpatialRef; pFieldEdit.Name_2 = "Shape "; pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry; pFieldEdit.GeometryDef_2 = ipGeodef; pFieldsEdit.AddField(pField); ////////////////////////////////////////// //创建要素类并导出shp文件于预设文件路径 m_polygonfeatureclass = ifeatws.CreateFeatureClass(name, pFields, null, null, esriFeatureType.esriFTSimple, "Shape ", " "); //加载新创建的shp文件并调到图层显示顺序的最顶层 axMapControl1.AddShapeFile(folder,name); axMapControl1.MoveLayerTo(, axMapControl1.LayerCount - ); return; } /*
2.在shp中绘制点线面要素并储存 课上只提到调用Toolbar里的工具: 使用流程: 开始编辑——>选择目标图层——>开启草图工具——>绘制新图形——>保存并停止编辑 而写代码方式的主要思路如下(没做撤销和双缓冲):
*/
//获取MapControl中的全部图层名称,并加入ComboBox //图层 toolStripComboBox1.Visible = true; ILayer pLayer; //图层名称 string strLayerName; for (int i = ; i < this.axMapControl1.LayerCount; i++) { pLayer = this.axMapControl1.get_Layer(i); strLayerName = pLayer.Name; //图层名称加入ComboBox this.toolStripComboBox1.Items.Add(strLayerName); } //默认显示第一个选项 this.toolStripComboBox1.SelectedIndex = ; //用三个int成员变量drawpoint、drawline、drawregion指示添加的是点、线还是面 //用三个IFeatureClass成员变量startpointshp、startlineshp、startpolygonshp来取出所选图层的要素类 //用一个点集数列IPointArray pts存储画线、面时连续产生的节点 //当combobox中选项变化时判断所选图层的要素类的几何类型并取出 IFeatureLayer layer = axMapControl1.get_Layer(this.toolStripComboBox1.SelectedIndex) as IFeatureLayer; if (layer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint) { startpointshp = layer.FeatureClass; drawpoint = ; drawline = ; drawregion = ; } if (layer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline) { startlineshp = layer.FeatureClass; drawpoint = ; drawline = ; drawregion = ; } if (layer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon) { startpolygonshp = layer.FeatureClass; drawpoint = ; drawline = ; drawregion = ; }
//在onmousedown(onmouseup也行)中进行判断并创建新要素图形
if (e.button == &&drawline == &&drawpoint== && drawregion==) { m_menuMap.PopupMenu(e.x, e.y, m_mapControl.hWnd);//没开启添加要素功能,则正常弹菜单项 } if (e.button == && drawpoint == ) { IPoint pt; pt = axMapControl1.ToMapPoint(e.x, e.y); IFeature pFeature = startpointshp.CreateFeature(); pFeature.Shape = pt; pFeature.Store(); this.axMapControl1.ActiveView.Refresh(); return; } if (e.button == && drawline == )//左键创建线的节点 { IPoint pt; pt = axMapControl1.ToMapPoint(e.x, e.y); pts.Add(pt); return; } if (e.button == && drawline == )//右键根据节点创建线 { ESRI.ArcGIS.Geometry.IPolyline ipPolyline = new PolylineClass(); ESRI.ArcGIS.Geometry.IPointCollection ipPointCol = (IPointCollection)ipPolyline; object missing = Type.Missing; for (int i = ; i < pts.Count; i++) { object t = pts.get_Element(i); ESRI.ArcGIS.Geometry.Point p = (ESRI.ArcGIS.Geometry.Point)t; if (p != null) { ipPointCol.AddPoint(p, ref missing, ref missing); } } IPolyline polyline = ipPolyline; IFeature pFeature = startlineshp.CreateFeature(); pFeature.Shape = polyline; pFeature.Store(); this.axMapControl1.ActiveView.Refresh(); pts.RemoveAll(); return; } if (e.button == && drawregion == )//左键创建面的节点 { IPoint pt; pt = axMapControl1.ToMapPoint(e.x, e.y); pts.Add(pt); return; } if (e.button == && drawregion == )//右键根据节点创建面 { ESRI.ArcGIS.Geometry.IPolygon ipPolyGon = new PolygonClass(); ESRI.ArcGIS.Geometry.IPointCollection ipPointCol = (IPointCollection)ipPolyGon; object missing = Type.Missing; for (int i = ; i < pts.Count; i++) { object t = pts.get_Element(i); ESRI.ArcGIS.Geometry.Point p = (ESRI.ArcGIS.Geometry.Point)t; if (p != null) { ipPointCol.AddPoint(p, ref missing, ref missing); } } ipPointCol.AddPoint(pts.get_Element(), ref missing, ref missing);//面的坐标串首尾坐标应一致(如P1-P2-P3-P4-P1) IPolygon polygon = ipPolyGon; IFeature pFeature = startpolygonshp.CreateFeature(); pFeature.Shape = polygon; pFeature.Store(); this.axMapControl1.ActiveView.Refresh(); pts.RemoveAll(); return; } //结束创建时执行清理、重置 drawpoint = ; drawline = ; drawregion = ; pts.RemoveAll(); startpointshp = null; startlineshp = null; startpolygonshp = null; this.toolStripComboBox1.Visible = false; this.toolStripComboBox1.Items.Clear(); /* 3.shp中点线面要素的图形编辑 使用Toolbar 使用流程: 开始编辑——>选择目标图层——>开启编辑工具——>图形编辑——>保存并停止编辑 三、属性表编辑 1.在属性表窗体设计中加一个按钮用于更新数据 2.属性表类中至少应有如下成员对象,在表开启后这些值应都已经赋值或初始化
* */ public DataTable attributeTable;//你的表 string tableName;//你的表的名字 public List array = new List();//你用来记录哪些行的数据被改变了的数列 public ILayer currentlayer;//你用来获取当前图层的对象其中,比如,attributeTable和tableName可在Load函数中赋值,currentlayer可在构造函数中赋值 /*
3.添加如下函数
*/ //在按钮的点击事件中添加如下代码 private void button1_Click(object sender, EventArgs e) { if (array.Count < )//没有记录到任何数据可能改变的行 { MessageBox.Show(" 未 修改任何数据 ! "); return; } array.Sort(); ILayer player = this.currentlayer; UpdateFTOnDV(player, attributeTable, array.ToArray()); dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;//dataGridView1是你属性表中显示数据的视图 dataGridView1.Refresh(); } //在表的CellValueChanged事件中添加如下代码 private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { array.Add(e.RowIndex);//将有值改变的那个行的行号记录下来 } //在属性表类中添加如下函数 public void UpdateFTOnDV(ILayer player, DataTable pdatatable, int[] array) { IFeatureLayer pFTClass = player as IFeatureLayer; ITable pTable = pFTClass as ITable; IRow pRow; ICursor pCursor = pTable.GetRows(array, false); for (int i = ; i < array.Length; i++) { pRow = pCursor.NextRow(); int k = array[i]; for (int j = ; j < pdatatable.Columns.Count; j++) { object pgridview = pdatatable.Rows[k][j]; object prow = pRow.get_Value(j); if (prow.ToString() != pgridview.ToString())//当表格中值与shp文件属性表中值不同时发生替换 { if (pgridview == System.DBNull.Value) { string skipinfo = "第 " + (k+).ToString() + "行第 " + (j+).ToString() + " 列 的数据 可 为 空 自动跳过修改 "; MessageBox.Show(skipinfo); continue; } pRow.set_Value(j, pgridview); pRow.Store(); } } } MessageBox.Show("数据保存 成 功 ! "); } /*
四、空间分析 以缓冲区分析为例,实现对某类地物周边一定范围内其他地物的统计与显示。
*/ //buffer类中的using using System; using System.Windows.Forms; using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Controls; using ESRI.ArcGIS.Geoprocessing; using ESRI.ArcGIS.Geoprocessor; using ESRI.ArcGIS.Geodatabase; using ESRI.ArcGIS.AnalysisTools; using System.Collections;
/* 1.创建一个windows窗体类buffer.cs 2.对窗体进行设计 目标地物(上面的)下拉框的Name设为comboBox2 被统计地物(下面的)下拉框Name设为comboBox3 分析距离textBox的Name设为textBox1 按钮Name设为button1 3.添加相关代码
*/
//1>Buffer类中添加三个成员 private static int counter = ;//用来对生成图层的计数 private AxMapControl axMapControl1;//用来获取主框架传进来的AxMapControl private ArrayList flyr = new ArrayList();//用来存储生成的图层,便于结束分析后删除 //2>修改构造函数为 public buffer(AxMapControl mapControl) { InitializeComponent(); this.axMapControl1 = mapControl; } //3>在窗体设计布局中,双击Buffer的对话框,进入buffer_Load函数,添加以下代码 //MapControl中没有图层时返回 if (axMapControl1.LayerCount <= ) return; ILayer pLayer;//图层 string strLayerName;//图层名称 //获取MapControl中的全部图层名称,并加入ComboBox for (int i = ; i < axMapControl1.LayerCount; i++) { pLayer = axMapControl1.get_Layer(i); strLayerName = pLayer.Name; comboBox2.Items.Add(strLayerName); comboBox3.Items.Add(strLayerName); } //默认显示第一个选项 comboBox2.SelectedIndex = ; comboBox3.SelectedIndex = ; //3>在窗体设计布局中,双击按钮,进入click事件,添加以下代码 //获取所设置的缓冲区距离 string distance = this.textBox1.Text.ToString(); //给距离加上单位,默认为米 string para = distance + " Meters "; //根据所选图层确定其数据源位置,即shp文件所在的文件夹路径 IDataLayer combo2 = (IDataLayer)axMapControl1.get_Layer(comboBox2.SelectedIndex); IWorkspaceName ws = ((IDatasetName)(combo2.DataSourceName)).WorkspaceName; string featurefolder = ws.PathName; //使用gp处理工具 Geoprocessor gp = new Geoprocessor(); //允许覆盖同名文件 gp.OverwriteOutput = true; //调用缓冲区工具 ESRI.ArcGIS.AnalysisTools.Buffer buffertool = new ESRI.ArcGIS.AnalysisTools.Buffer(); //设置输入图层路径和输出图层路径 buffertool.in_features = featurefolder+ " \ " + comboBox2.SelectedItem + ".shp "; buffertool.out_feature_class = featurefolder + " \ " + comboBox2.SelectedItem + "_buffer " + counter.ToString() + ".shp "; //设置缓冲区相关参数 buffertool.buffer_distance_or_field = para; buffertool.dissolve_option = "ALL "; //执行 try { gp.Execute(buffertool, null); } catch (Exception ex) { MessageBox.Show("ERROR "); return; } //对生成图层的计数 counter++; //用生成的缓冲区与被统计地物进行叠置分析求交集 Intersect pIntersect = new Intersect(); int chooselayer = counter - ; Geoprocessor gp2 = new Geoprocessor(); gp2.OverwriteOutput = true; //允许覆盖同名文件 FeatureLayer pFeatureLayer = new FeatureLayerClass(); //设置相关参数 object obj = gp2.GetEnvironmentValue("Extent "); gp2.SetEnvironmentValue("Extent ", "MAXOF "); obj = gp2.GetEnvironmentValue("OutputZFlag "); gp2.SetEnvironmentValue("OutputZFlag ", "DEFAULT "); obj = gp2.GetEnvironmentValue("OutputMFlag "); gp2.SetEnvironmentValue("OutputMFlag ", "DEFAULT "); obj = gp2.GetEnvironmentValue("QualifiedFieldNames "); gp2.SetEnvironmentValue("QualifiedFieldNames ", "QUALIFIED "); //把要求交的两个要素放到一个IGpValueTableObject中作为参数 IGpValueTableObject pObject = new GpValueTableObjectClass(); pObject.SetColumns(); object inputfeature = featurefolder + " \ " + comboBox3.SelectedItem + ".shp "; pObject.AddRow(ref inputfeature); object inputfeature2 = featurefolder + " \ " + comboBox2.SelectedItem + "_buffer " + chooselayer.ToString() + ".shp "; pObject.AddRow(ref inputfeature2); //设置输入图层路径和输出图层路径 pIntersect.in_features = pObject; pIntersect.out_feature_class = featurefolder + " \ " + comboBox2.SelectedItem + "_insert " + chooselayer.ToString() + ".shp "; pIntersect.join_attributes = "All "; //执行 IGeoProcessorResult pResult = (IGeoProcessorResult)gp2.Execute(pIntersect, null); //从求交的结果中提取Feature并做相关统计 IGPUtilities pGPUtil = new GPUtilitiesClass(); IFeatureClass pFC; IQueryFilter pQF; pGPUtil.DecodeFeatureLayer(pResult.GetOutput(), out pFC, out pQF); int count = pFC.FeatureCount(null); IFeatureCursor pCursor = pFC.Insert(true); pFeatureLayer.FeatureClass = pFC; //将缓冲区载入地图中显示 axMapControl1.AddShapeFile(featurefolder + " \ ", comboBox2.SelectedItem + "_buffer " + chooselayer.ToString() + ".shp "); axMapControl1.MoveLayerTo(, axMapControl1.LayerCount - ); //获取生成的缓冲区对象 FeatureLayer bufferlayer = axMapControl1.get_Layer(axMapControl1.LayerCount - ) as FeatureLayer; //将求交得到的对象载入地图中显示 pFeatureLayer.Name = comboBox2.SelectedItem + " 周边 " + textBox1.Text + "米内的 " + comboBox3.SelectedItem; axMapControl1.Map.AddLayer(pFeatureLayer); //将生成的缓冲区和求交对象放到一个图层数组中,在关闭缓冲区分析工具后统一移出系统 flyr.Add(bufferlayer); flyr.Add(pFeatureLayer); //将缓冲区分析的结果放到属性表中并显示 ILayer layer = pFeatureLayer as ILayer; FrmAttribute attributeTable = new FrmAttribute(layer, axMapControl1); attributeTable.Show(); //4>在窗体的FormClosing事件中,添加以下代码 //删除所有生成的缓冲区和求交对象 foreach (FeatureLayer pFeatureLayer in flyr) { IDataLayer2 OnOff = pFeatureLayer as IDataLayer2; OnOff.Disconnect(); axMapControl1.Map.DeleteLayer(pFeatureLayer); }
/*
4.在主窗体中调用此模块 首先在菜单栏中新建一个选项如“周边设施分析” 之后双击该选项,添加如下代码
*/
buffer b = new buffer(axMapControl1); b.Show();
/*
五、esriAddIn扩展项在ArcEngine中的添加 对原代码中接口适当修改,使其可用于ArcEngine二次开发工程中 1.在服务中引用“AE开发用”文件夹中的MappingTools.dll 2.菜单栏中创建对应菜单,在单击事件中加入调用代码,并在Form1类的顶端填写using MappingTools;
*/ //调用创建直方图时,是在mapcontrol1的onmousedown事件中触发创建直方图的函数 //首先到onmousedown中加入如下代码 if (zhifangtu == && e.button==)//开启了直方图功能且在地图上单击了鼠标左键时 { Createzft (e.x,e.y); } //之后在Form1主类中加入如下函数 Public void Createzft(int x,int y) { MappingTools.CreateGraph a = new MappingTools.CreateGraph(); frmGraph frm = new frmGraph(this.axMapControl1); frm.BasePoint = axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y); DialogResult re = frm.ShowDialog(); }
AE二次开发中几个功能速成归纳(符号设计器、创建要素、图形编辑、属性表编辑、缓冲区分析)的更多相关文章
- 在AE二次开发中出“正试图在 OS 加载程序锁内执行托管代码。不要尝试在 DllMain 或映像初始化函数内运行托管代码,这样做会导致应用程序挂起。”异常解决方案
今天的一个项目总用到了AE的开发组件,也就是ESRI公司提供的一系列的开发包(组件)都是以dll(动态链接库的形式)然后今天在调试的时候却出现了“正试图在 OS 加载程序锁内执行托管代码.不要尝试在 ...
- AE二次开发中,过滤后的图层,实现缩放至图层效果
//featureClass是自己获取的featureClass,也可是sde中获取的. public void FilterAndZoomToLayer(IFeatureClass featureC ...
- CAD二次开发中浮动面板不浮动的问题
CAD二次开发中创建了一个浮动面板,想让它创建出来后以浮动状态显示, 但是DockSides.None设置完后,面板还是不浮动.搞了很久,最后原来是 需要先设置Visible,再设置DockSides ...
- EBS OAF开发中怎样实现功能页签(Global Tab)
EBS OAF开发中怎样实现功能页签(Global Tab) (版权声明.本人原创或者翻译的文章如需转载.如转载用于个人学习,请注明出处.否则请与本人联系,违者必究) 功能页签的实现不须要不论什么编码 ...
- ActiveReports 9 新功能:可视化查询设计器(VQD)介绍
在最新发布的ActiveReports 9报表控件中添加了多项新功能,以帮助你在更短的时间里创建外观绚丽.功能强大的报表系统,本文将重点介绍可视化数据查询设计器,无需手动编写任何SQL语句,主要内容如 ...
- C#基础系列:开发自己的窗体设计器(PropertyGrid显示中文属性名)
既然是一个窗体设计器,那就应该能够设置控件的属性,设置属性最好的当然是PropertyGrid了,我们仅仅需要使用一个PropertyGrid.SelectedObject = Control就可以搞 ...
- 深入理解iOS开发中的BitCode功能
前言 做iOS开发的朋友们都知道,目前最新的Xcode7,新建项目默认就打开了bitcode设置.而且大部分开发者都被这个突如其来的bitcode功能给坑过导致项目编译失败,而这些因为bitcode而 ...
- 23 Pro/E二次开发中的问题记录
0 引言 由于项目中涉及到Pro/E的二次开发技术,因此在边用边学的情况下,解决了不少问题,也积攒了不少问题.其中有些问题可能不是调个函数就能搞定的,得了解CAD底层的东西. 1 问题描述 (1)CA ...
- iOS开发中WiFi相关功能总结
http://www.cocoachina.com/ios/20160715/17022.html 投稿文章,作者:Haley_Wong(简书) 查漏补缺集是自己曾经做过相关的功能,但是重做相关功能或 ...
随机推荐
- NTFS权限和共享权限的区别
共享权限 共享权限有三种:完全控制.更改.读取 共持本地安全性.换句话说,他在同一台计算机上以不同用户名登录,对硬盘上同一文件夹可以有不同的访问权限. 注意:NTFS权限对从网络访问和本机登录的用户都 ...
- 数据库【mongodb篇】练习操作
本文的目标是通过大量的示例,来更好的理解如果在Mongodb中进行数据操作: 初入客户端刚利用 mongod命令进入客户端环境,此时对数据库一无所知: 举目四望,想知道现在有哪些数据库, show ...
- php类注释生成接口文档
参考地址:https://github.com/itxq/api-doc-php
- Hybrid App—Hybrid App开发模式介绍和各种开发模式对比
什么是Hybrid App 最开的App开发只有原生开发这个概念,但自从H5广泛流行后,一种效率更高的开发模式Hybrid应运而生,它就是"Hybrid模式".Hybrid APP ...
- python接口自动化-传 json 参数
一.post请求有两种方法传json参数: 1.传json参数(自动转 json ) 2.传data参数(需 json 转换) 代码参考: payload = { "Jodie": ...
- zoj 3602
链接 [https://vjudge.net/contest/293343#problem/C] 题意 给你两棵树.为有多少对子树是同构的 分析 就是简单的哈希吧.对于不同结构的树对应不同的哈希值 先 ...
- 证明与计算(2): 离散对数问题(Discrete logarithm Problem, DLP)
离散对数问题,英文是Discrete logarithm Problem,有时候简写为Discrete log,该问题是十几个开放数学问题(Open Problems in Mathematics, ...
- MyBatis 3源码解析(三)
三.getMapper获取接口的代理对象 1.先调用DefaultSqlSession的getMapper方法.代码如下: @Override public <T> T getMapper ...
- Python视频人脸检测识别
案例 这里我们还是使用 opencv 中自带了 haar人脸特征分类器,通过读取一段视频来识别其中的人脸. 代码实现: 动图有点花,讲究着看吧: 如果是捕捉摄像头,只需要改变以下代码即可: c ...
- rockchip 3128 平台USB接口鼠标U盘功能调试日记
2019-04-12 关键词: rk3128 OTG.rk3128外接鼠标U盘.RK外接鼠标U盘 本篇文章是笔者根据自己当前所掌握知识对 rk3128 平台 USB 接口接鼠标实现输入功能调试的一个记 ...