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 ...
随机推荐
- PHP操作MongoDB简明教程(转)
转自:http://blog.sina.com.cn/s/blog_6324c2380100ux2m.html MongoDB是最近比较流行的NoSQL数据库,网络上关于PHP操作MongoDB的资料 ...
- Python-Day9 Paramiko模块/进程/线程/RabbitMQ队列
一.Paramiko模块 1.Paramiko安装 Python的目录下有个Scripts目录,cd到这个目录用这里面的pip命令(如果添加的环境变量可以在cmd直接输入命令):pip install ...
- Cisco IOS Basic CLI Configuration : Switch Port Command
Cisco IOS Basic CLI Configuration : Switch Port Command 1. Basic Switch>en Switch#conf t Enter c ...
- Oracle之存储过程
1.存储过程创建 oracle中创建存储过程的语法如下: CREATE [OR REPLACE] PROCEDURE PRO_NAME[(parameter1[,parameter2]...)]is| ...
- db2查看表空间
select substr(tbsp_name,1,20) as 表空间名称,substr(tbsp_content_type,1,10) as 表空间类型,sum(tbsp_total_size_k ...
- matlab实现高斯消去法、LU分解
朴素高斯消去法: function x = GauElim(n, A, b) if nargin < 2 for i = 1 : 1 : n for j = 1 : 1 : n A(i, j) ...
- ios检查版本更新
场景 在我们使用应用时,一打开应用,如果此应用有新的版本,常常能在应用中给出提示,是否要更新此应用.所以,我们就来看看,版本更新是如何实现的. 应用 苹果给了我们一个接口,能根据应用i ...
- C/C++中的可变参函数
可变参函数最好的实例:printf();参数可变 包含的头文件: C语言中:#include<stdarg.h> C++中的可变参的头文件:#include<cstdarg>, ...
- 10.31Daily Scrum
人员 任务分配完成情况 明天任务分配 王皓南 主网页的框架搭建,任务编号752 研究代码,学习相应语言,讨论设计思路 申开亮 学习数据库的操作,任务编号753 研究代码,学习相应语言,讨论设计思路 王 ...
- Careercup - Facebook面试题 - 5761467236220928
2014-05-02 07:06 题目链接 原题: Given an array of randomly sorted integers and an integer k, write a funct ...