设计界面

创建类

代码如下

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using ESRI.ArcGIS.Controls;

using System.Data;

using ESRI.ArcGIS.Carto;

using ESRI.ArcGIS.Geodatabase;

using ESRI.ArcGIS.Geometry;



namespace test

{

public class DataHelper

{

#region 读取mapControl属性表

public static DataTable GetAttribute(AxMapControl axMapControl)

{

int layerCount = axMapControl.Map.LayerCount;



// IFeature pFeature;

string fieldName=string.Empty;

int fieldCount;

bool firstThroght=true;

DataTable dataTable = new DataTable();

//循环图层得到每一层的数据

for (int l = 0; l < layerCount; l++)

{

IFeatureLayer pFeatureLayer = axMapControl.Map.get_Layer(l) as IFeatureLayer;

IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;

fieldCount = pFeatureClass.Fields.FieldCount;

int featureCount = pFeatureClass.FeatureCount(new QueryFilterClass());

if (firstThroght)

{

for (int i = 0; i < fieldCount; i++)

{

string fieldHeadName = pFeatureClass.Fields.get_Field(i).AliasName;

dataTable.Columns.Add(fieldHeadName);



}

firstThroght = false;

}

//判断feature的类型

int indexofShape = pFeatureClass.FindField("Shape");

ESRI.ArcGIS.Geometry.esriGeometryType pFeatureClassShapeType = pFeatureClass.ShapeType;

for (int i = 0; i < featureCount; i++)

{

DataRow dataRow = dataTable.NewRow();

for (int j = 0; j < fieldCount; j++)

{

if (j == indexofShape)

{

//Geometroy.shapetype转换

switch (pFeatureClassShapeType)

{

case esriGeometryType.esriGeometryPoint:

fieldName = "Point";

break;

case esriGeometryType.esriGeometryPolyline:

fieldName = "Polyline";

break;

case esriGeometryType.esriGeometryPolygon:

fieldName = "Polygon";

break;

default:

break;

}

// fieldName = pFeatureClass.GetFeature(i).get_Value(j).ToString();

//dataTable.Columns.Add(fieldName);



dataRow[j] = fieldName;

}

else

{

//添加非shape字段到表中

fieldName = pFeatureClass.GetFeature(i).get_Value(j).ToString();

//dataTable.Columns.Add(fieldName);



dataRow[j] = fieldName;

}



//dataTable[i][j] = fieldName;

}

dataTable.Rows.Add(dataRow);



}

}

return dataTable;

}

#endregion

}

}

Arc Engiene读取文档的属性的更多相关文章

  1. 基本控件文档-UILabel属性

    CHENYILONG Blog 基本控件文档-UILabel属性 Fullscreen UILabel属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博http ...

  2. 基本控件文档-UITextField属性

    CHENYILONG Blog 基本控件文档-UITextField属性 Fullscreen   UITextField属性技术博客http://www.cnblogs.com/ChenYilong ...

  3. 基本控件文档-UIButton属性

    CHENYILONG Blog 基本控件文档-UIButton属性 Fullscreen UIButton属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博ht ...

  4. 基本控件文档-UISlider属性

    CHENYILONG Blog 基本控件文档-UISlider属性 Fullscreen     UISlide属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪微 ...

  5. 基本控件文档-UISegment属性

    CHENYILONG Blog 基本控件文档-UISegment属性 Fullscreen   UISegment属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪 ...

  6. 基本控件文档-UISwitch属性

    CHENYILONG Blog 基本控件文档-UISwitch属性 Fullscreen     UISwitch属性 技术博客http://www.cnblogs.com/ChenYilong/ 新 ...

  7. 基本控件文档-UIView属性

    CHENYILONG Blog 基本控件文档-UIView属性 Fullscreen   UIView属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博http ...

  8. 解决Spring的java项目打包后执行出现“无法读取方案文档...“、“原因为 1) 无法找到文档; 2) 无法读取文档; 3) 文档的根元素不是...”问题

    问题 一个用Spring建的java项目,在Eclipse或idea中运行正常,为什么打包后运行出现如下错误呢? 2019/07/10/19:04:07 WARN [main] org.springf ...

  9. golang mongodb (mgo)插入或读取文档的字段值为空(nil)问题解决

    问题描述 当使用mgo操作mongodb时,遇到数据插入正常,但是在数据库查看时只能看到objectid被插入了:读取的时候,可以查询到记录,但是读入对象时,却所有的值均为0或者空的情况. mongo ...

随机推荐

  1. 通过百度地图API实现搜索地址--第三方开源--百度地图(三)

    搜索地址功能是建立在能够通过百度地图API获取位置的基础上 通过百度地图定位获取位置详情:http://www.cnblogs.com/zzw1994/p/5008134.html package c ...

  2. as 和is的区别

    is 1,检查对象的兼容性,并返回true或false 2,不会抛出异常 3,null永远返回false as 1,检查对象的兼容性,并返回 true或false 2,不会抛出异常 3,null将抛出 ...

  3. js实现复制到剪切板

    // <![CDATA[ function copy_clip(copy) { if (window.clipboardData) { window.clipboardData.setData( ...

  4. Spark菜鸟学习营Day3 RDD编程进阶

    Spark菜鸟学习营Day3 RDD编程进阶 RDD代码简化 对于昨天练习的代码,我们可以从几个方面来简化: 使用fluent风格写法,可以减少对于中间变量的定义. 使用lambda表示式来替换对象写 ...

  5. Eclipse 下 opennms 开发环境搭建

    1.eclipse3.5或更高版本,并且使用纯净的java版.下载地址:Eclipse for Java Developers. 2.安装需要的插件.通过Help/Install New Softwa ...

  6. [SQL_Server_Question]Msg 1105无法为数据库 'tempdb' 中的对象分配空间,因为 'PRIMARY' 文件组已满

    错误消息: Msg 1105, Level 17, State 2, Line 266Could not allocate space for object 'dbo.Large Object Sto ...

  7. Python GUI编程实践

    看完了<python编程实践>对Python的基本语法有了一定的了解,加上认识到python在图形用户界面和数据库支持方面快捷,遂决定动手实践一番. 因为是刚接触Python,对于基本的数 ...

  8. python之库组织

    python可重用代码库的组织依赖二个概念: 1. 模块 module 2. 函数 function 没有Java哪么灵活的包概念, 比较偏近C++的namespace.

  9. Install mcrypt for php on Mac OSX 10.10 Yosemite for a Development Server

    mcrypt is a file encryption method using secure techniques to exchange data. It is required for some ...

  10. ASP.NET 运行机制

    原本今天打算继续写ASP.NET MVC第四天的.但是由于里面涉及到asp.net运行机制的原理,如果不分析一下这里,mvc想说清楚还是挺困难的.既然要提到asp.net运行机制,所以打算还是说详细一 ...