Arc Engiene读取文档的属性

设计界面
创建类
代码如下
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读取文档的属性的更多相关文章
- 基本控件文档-UILabel属性
CHENYILONG Blog 基本控件文档-UILabel属性 Fullscreen UILabel属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博http ...
- 基本控件文档-UITextField属性
CHENYILONG Blog 基本控件文档-UITextField属性 Fullscreen UITextField属性技术博客http://www.cnblogs.com/ChenYilong ...
- 基本控件文档-UIButton属性
CHENYILONG Blog 基本控件文档-UIButton属性 Fullscreen UIButton属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博ht ...
- 基本控件文档-UISlider属性
CHENYILONG Blog 基本控件文档-UISlider属性 Fullscreen UISlide属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪微 ...
- 基本控件文档-UISegment属性
CHENYILONG Blog 基本控件文档-UISegment属性 Fullscreen UISegment属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪 ...
- 基本控件文档-UISwitch属性
CHENYILONG Blog 基本控件文档-UISwitch属性 Fullscreen UISwitch属性 技术博客http://www.cnblogs.com/ChenYilong/ 新 ...
- 基本控件文档-UIView属性
CHENYILONG Blog 基本控件文档-UIView属性 Fullscreen UIView属性技术博客http://www.cnblogs.com/ChenYilong/ 新浪微博http ...
- 解决Spring的java项目打包后执行出现“无法读取方案文档...“、“原因为 1) 无法找到文档; 2) 无法读取文档; 3) 文档的根元素不是...”问题
问题 一个用Spring建的java项目,在Eclipse或idea中运行正常,为什么打包后运行出现如下错误呢? 2019/07/10/19:04:07 WARN [main] org.springf ...
- golang mongodb (mgo)插入或读取文档的字段值为空(nil)问题解决
问题描述 当使用mgo操作mongodb时,遇到数据插入正常,但是在数据库查看时只能看到objectid被插入了:读取的时候,可以查询到记录,但是读入对象时,却所有的值均为0或者空的情况. mongo ...
随机推荐
- Z-BlogPHP 安装出现 (8) Undefined offset: 6 解决方法
有些cp面板的空间会在每个网页头部和页脚增加两个调用的文件,导致zblogPHP安装出错:(8) Undefined offset: 6 主要国外的主机中PHP配置文件两个选项auto_prepend ...
- C#中Delegate
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Winfrom 抓取web页面内容代码
WebRequest request = WebRequest.Create("http://1.bjapp.sinaapp.com/play.php?a=" + PageUrl) ...
- How to use the SQLIOSim utility to simulate SQL Server activity on a disk subsystem
SQLIOSim是模拟SQLServer的行为来测试IO性能,也可以对损坏磁盘进行一定校验 这是一个SQL Server 2012 安装完后自带的工具 一般在C:\Program Files\Micr ...
- 【转载】 使用Anemometer基于pt-query-digest将MySQL慢查询可视化
原文地址:使用Anemometer基于pt-query-digest将MySQL慢查询可视化 作者:84223932 本文主要介绍使用Anemometer基于pt-query-digest将MySQL ...
- unity项目实现“再按一次退出程序”提示功能
unity项目,再按一次退出程序,按第一次做提示,再按一次,程序退出. float _waitTime = 2f;//前后两次按退出间隔时间 void OnGUI() { ) { GUI.Label( ...
- github pages
http://zyip.github.io/facemaker/index echo "hello world" >>hello.htm git init git ad ...
- 华为章宇:如何学习开源项目及Ceph的浅析
转自http://www.csdn.net/article/2014-04-10/2819247-how-to-learn-opensouce-project-&-ceph 摘要:开源技术的学 ...
- 《C++Primer》复习——with C++11 [2]
1.数组引用形参,C++允许将变量定义成数组的引用,给予同样的道理,形参也可以是数组的引用,此时引用形参绑定到对应的实参上,也就是绑定到数组上 ]) { for (auto elem : arr) c ...
- sqlserver insert into select
Insert into [fenxi].[dbo].[analysisresult]( [dayofweek] ,[quarter] ,[reporttime] ,[type] ,[value]) s ...

