ArcEngine打开属性表如何实现分页的功能?
ArcEngine已经实现打开属性表功能,但是如果记录达到上万条的话,就非常慢,影响用户体验。
arcmap里面在下拉滚动条时应该是分页了的,现在也想模仿arcmap里的这种功能,该如何实现呢?
在一个帖子下面有提到使用IQueryFilterDefinition3.SetPaginationClause进行分页,但是不知道怎么用啊。。。
打开属性表的基本思路就是获取到dataTable,然后赋给datagridview.DataSource,不知道这个IQueryFilterDefinition3接口怎么使用。。。。
arcmap里面在下拉滚动条时应该是分页了的,现在也想模仿arcmap里的这种功能,该如何实现呢?
在一个帖子下面有提到使用IQueryFilterDefinition3.SetPaginationClause进行分页,但是不知道怎么用啊。。。
打开属性表的基本思路就是获取到dataTable,然后赋给datagridview.DataSource,不知道这个IQueryFilterDefinition3接口怎么使用。。。。
//创建空DataTable
DataTable dataTable = CreateDataTabeByLayer(layer, tablename);
//取得图层类型
string shapeType = getShapeType(layer);
//创建DataTable的行对象
DataRow dataRow = null;
ITable table = layer as ITable;
ICursor cursor = table.Search(null, false);
//取得ITable中的行信息
IRow row = cursor.NextRow();
int n = 0;
while (row != null)
{
//新建DataTable的行对象
dataRow = dataTable.NewRow();
for (int i = 0; i < row.Fields.FieldCount; i++)
{
//如果字段类型为esriFieldTypeGeometry,则根据图层类型设置字段
if (row.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)
{
dataRow[i] = shapeType;
}
//当图层类型为Anotation时,要素类中会有esriFieldTypeBlob类型的数据
//其存储的是标注内容,如此情况需将对应的字段值设置为Element
else if (row.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeBlob)
{
dataRow[i] = "Element";
}
else
{
dataRow[i] = row.get_Value(i);
}
}
//添加DataRow到DataTable
dataTable.Rows.Add(dataRow);
dataRow = null;
n++;
//为保证效率,一次只装载2000条记录
//if (n == 2000)
//{
// row = null;
//}
//else
//{
row = cursor.NextRow();
// }
}
return dataTable;
}
3 个回复
朱新颖
赞同来自: 柚子
int count = FeatureLayer.FeatureClass.FeatureCount(queryFilter);
int offset;
int rowcount;
queryFilterDef.PostfixClause = "order by OBJECTID asc"; //这里自己设置的,也可以不写
queryFilterDef.SetPaginationClause(0, 200);
然后下次第一个参数设置201,以此类推
cannel
赞同来自:
例如第一次先加载100条数据,且加载完成后cursor保存起来(例如放在类变量),当滚轮事件触发且滚动到最后一行,就继续记载下100条数据,如此类推
ae的Search方法没提供数据库查询必备的分页功能,我估计是因为ae要兼容多种数据源,不同数据源的分页方式不一致
刘佩
赞同来自:
DBMS does NOT support this function [JNGHCG.JSYDXZ][STATE_ID = 272]esriDataSourcesGDB.SdeWorkspace.1 在 ESRI.ArcGIS.Geodatabase.IFeatureClass.Search(IQueryFilter filter, Boolean Recycling)\r\n 在位置 XX:行号 285ESRI.ArcGIS.Geodatabase.IFeatureCursor Search(ESRI.ArcGIS.Geodatabase.IQueryFilter, Boolean)esri_csGeoDatabase.hlp-2147215862
要回复问题请先登录或注册
发起人
ArcGIS/WebAPI
相关问题
问题状态