在ArcGlobe三维环境中进行数据查询(.net)
来源:互联网 发布:移动网络波动怎么解决 编辑:程序博客网 时间:2024/05/21 04:24
最近在研究ArcGlobe开发,写了个小程序,其中有一个功能是在ArcGlobe中进行数据查询,现在把主要代码贴出来。
/// <summary>
/// 查询功能
/// </summary>
/// <paramname=”sender”></param>
/// <paramname=”e”></param>
private void BtnOK_Click(objectsender, EventArgs e)
{
try
{
//图层名称
String LayerName = this.CbxLayer.Text;
//查询条件
String SearchText = this.TbxName.Text;
if (SearchText == String.Empty)
{
MessageBox.Show(“查询条件不允许为空!”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Error);
TbxName.Focus();
//清空数据列表
this.dg1.DataSource = null;
//跳出查询
return;
}
//当前视图
IScene scene = this.axGlobeControl1.Globe.GlobeDisplay.Scene;
//查询器
IQueryFilter pQueryFilter = new QueryFilterClass();
IActiveView pActiveView;
pActiveView = (IActiveView)scene;
//清空当前视图
scene.ClearSelection();
IFeatureLayer pFeatureLayer;
pFeatureLayer = (IFeatureLayer)scene.get_Layer(GetLayerId(LayerName, scene));
//判断要查询的图层
if (LayerName == “堤防”)
{
//查询条件
pQueryFilter.WhereClause = “XMMC like “%” + SearchText + “%”";
}
else if (LayerName == “险工险段”)
{
//查询条件
pQueryFilter.WhereClause = “BZ like “%” + SearchText + “%”";
}
……
IFeatureCursor pFeatureCursor;
//查询
pFeatureCursor = pFeatureLayer.FeatureClass.Search(pQueryFilter, false);
IFeature pFeature;
pFeature = pFeatureCursor.NextFeature();
IFields pFields = pFeatureCursor.Fields;
int fieldIndex = 0;
int fieldIndexName = 0;
if (LayerName == “堤防”)
{
fieldIndex = pFields.FindField(“NAME”);
fieldIndexName = pFields.FindField(“XMMC”);
}
else if (LayerName == “险工险段”)
{
fieldIndex = pFields.FindField(“NAME”);
fieldIndexName = pFields.FindField(“BZ”);
}
……
pfeat = pFeature;
if (pFeature == null)
{
MessageBox.Show(“您所查询的结果不存在!”);
TbxName.Select();
TbxName.Focus();
this.dg1.DataSource = null;
return;
}
//绑定DataTable
DataTable dt = new DataTable();
DataColumn dc1 = new DataColumn();
dc1.ColumnName = “工程代码”;
DataColumn dc2 = new DataColumn();
dc2.ColumnName = “工程名称”;
dt.Columns.Add(dc1);
dt.Columns.Add(dc2);
string Code = String.Empty;
string Name = String.Empty;
while (pFeature != null)
{
//scene.SelectFeature(pFeatureLayer, pFeature);
Code = pFeature.get_Value(fieldIndex) as string;
Name = pFeature.get_Value(fieldIndexName) as string;
DataRow dr = dt.NewRow();
dr[0] = Code;
dr[1] = Name;
dt.Rows.Add(dr);
pFeature = pFeatureCursor.NextFeature();
}
//绑定列表
this.dg1.DataSource = dt.DefaultView;
}
catch
{
MessageBox.Show(“异常!”, “错误”, MessageBoxButtons.OK, MessageBoxIcon.Error);
this.dg1.DataSource = null;
}
}
- 在ArcGlobe三维环境中进行数据查询(.net)
- 在ArcGlobe三维环境中进行数据查询(.net)
- 在ArcGlobe三维环境中进行数据查询2(模型定位显示)
- 在ArcGlobe三维环境中进行数据查询2(模型定位显示)
- 在DataTable中进行数据查询
- arcengine在arcglobe中实现缩放至图层
- arcglobe导入三维模型方法
- 如何在ArcGIS Engine的Globe中进行三维定位
- 在查询中进行统计
- 在大量数据中进行查询,有无索引查询的速度效果测试
- 在VB环境中操作三维模型的实现方法
- 在VB环境中操作三维模型的实现方法
- 在.NET中使用GDI+构建三维直方图
- ArcGlobe三维开发之八————由指定路径创建动画(接口)
- ArcGlobe三维开发之九————由指定路径创建动画(实现)
- ArcGIS三维分析之ArcGlobe简要说明
- ArcGIS三维分析之ArcGlobe简要说明
- 在 .NET环境下进行图片压缩
- Android 深入ViewPager补间动画,实现类京东商城首页广告Banner切换效果
- SQL2000数据库学习地图
- php pearmail 发送邮件(windows环境)
- Java数组(初学者必看)
- Ubuntu安装为知笔记
- 在ArcGlobe三维环境中进行数据查询(.net)
- dg主备库切换步骤
- ORB算法
- LongListSelector的Item里使用Image加载网络图片必须注意的问题
- 数据泵IMPDP 导入工具的使用
- 简单图形编程学习(2)
- google 最佳实践 - ListView优化 (Making ListView Scrolling Smooth)
- dwr设置同步
- 开博庆祝贴