设计界面

创建类

代码如下

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. 解决DataSnap支持的Tcp长连接数受限的两种方法

    如何解决DataSnap支持的Tcp长连接数受限的问题? 方案一: 采用代理服务器方式,基本流程为: 1.客户先连接代理服务器:2.获取可用的服务器IP和端口:3.关闭与代理服务器之间的连接:4.建立 ...

  2. 关于一道简单的Java 基础面试题的剖析: short s1=1;s1 = s1 +1会报错吗?

    package common; public class ShortTypeTest { /* * @param args */ public static void main(String[] ar ...

  3. Windows Phone中的几种集合控件

    前言 Windows Phone开发过程中不可避免的就是和集合数据打交道,如果之前做过WP App的开发的话,相信你已经看过了各种集合控件的使用.扩展和自定义.这些个内容在这篇博客里都没有,那么我们今 ...

  4. Android开发笔记一(hello world)

    UI: <Button android:layout_width="wrap_content" android:layout_height="wrap_conten ...

  5. Linq to XML 之XElement的Descendants方法的新发现

    C#操作XML的方法有很多,但个人认为最方便的莫过于Linq to XML了,特别是XElement的Descendants方法是我最常用的一个方法. 这个方法可以根据节点名(Name)找到当前调用的 ...

  6. Pomodairo,番茄工作法-解刨篇

    处于“信息大爆炸”的 e 时代的我们每天必定要处理很多的事情,不管是工作.学习.生活......面对这么多的纷杂的事物我们将如何应对?如何做到有条不紊的进行?高效.轻松.愉快的完成它呢?这时一款精致的 ...

  7. UML类图总结

    前言 类图和序列图是UML中最常用的两种Diagram.我将做详细的总结.在许多书中,或者网站中,在介绍一个系统的子系统的设计时,很多时候,都是给出简单的类图来简述构成子系统的类之间的关系.这足以说明 ...

  8. Qt postEvent

    Qt3中可以直接向线程发送消息 QThread::postEventQ4中已不支持为了模拟向线程发送消息,可以通过QObject::moveToThread后,然后再向这个QObject发送消息 ob ...

  9. CADisplayLink

    什么是CADisplayLink CADisplayLink是一个能让我们以和屏幕刷新率相同的频率将内容画到屏幕上的定时器.我们在应用中创建一个新的 CADisplayLink 对象,把它添加到一个r ...

  10. CGI与Servlet的区别和联系

    1. 定义: CGI(Common Gateway Interface 公共网关接口)是HTTP服务器与你的或其它机器上的程序进行“交谈”的一种工具,其程序须运行在网络服务器上. 2. 功能: 绝大多 ...