I查询实现
来源:互联网 发布:seo 代码优化 编辑:程序博客网 时间:2024/06/07 12:27
在实现中,主要的是OnMouseDown事件的实现。OnMouseMove与OnMouseUp事件在identify工具中不用实现。
OnMouseDown事件实现了identify元素(用户自己添加的图标等)和要素(sde数据库中的地图要素)。
/// <summary>
/// 鼠标按下事件
/// </summary>
/// <param name="button">button按钮</param>
/// <param name="shift">shift键</param>
/// <param name="x">屏幕X坐标</param>
/// <param name="y">屏幕Y坐标</param>
public void OnMouseDown(int button, int shift, int x, int y)
{
m_isMouseDown = true;
//未选中图标
pointId = -1;
// 获取焦点地图的IActiveView对象
IActiveView pActiveView = m_pHookHelper.ActiveView.FocusMap as IActiveView;
//IDisplay 对象
IDisplay pDisplay = pActiveView.ScreenDisplay;
//IGraphicsContainer对象,图形容器
IGraphicsContainer pGraphicsContainer;
pGraphicsContainer = pActiveView.GraphicsContainer;
//Create a point
IPoint pPoint = new PointClass();
pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);
//元素
IElement pElement;
//元素枚举
IEnumElement pEnumElement;
pEnumElement = pGraphicsContainer.LocateElements(pPoint,5);
if (pEnumElement != null)//i查询element
{
pElement = pEnumElement.Next();
while (pElement != null)
{
if (pElement.Geometry.GeometryType.Equals(esriGeometryType.esriGeometryPoint))
{
m_element = pElement;
//点
IPoint mPoint = new PointClass();
mPoint = pElement.Geometry as IPoint;
//类的属性PointId 设置
pointId = mPoint.ID;
}
pElement = pEnumElement.Next();
}
}
else//i查询要素
{
//实现要素的查询
IdentifyFeature(pPoint);
}
}
/// <summary>
/// 查找要素
/// </summary>
/// <param name="pPoint">点</param>
private void IdentifyFeature(IPoint pPoint)
{
//清空以前查询的数据
m_identifyObj = null;
m_feature = null;
//查询对象,用于查询要素
IIdentify pIdentify;
//查询,用于控制一个图层的要素查询控制
IIdentifyObj pIdentifyObj;
//要素查询对象
IFeatureIdentifyObj pFeatureIdentifyObj;
//要素行查询对象
IRowIdentifyObject pRowIdentifyObj;
//查询的要素
IFeature pFeature;
//数组,存放要素查询对象
IArray pIdArray;
//地图
IMap pMap;
pMap = m_pHookHelper.FocusMap;
// 获取焦点地图的IActiveView对象
IActiveView pActiveView = m_pHookHelper.ActiveView.FocusMap as IActiveView;
//显示对象
IScreenDisplay pScreenDisplay = pActiveView.ScreenDisplay;
//显示转换对象
IDisplayTransformation pDisplayTrnsformation;
pDisplayTrnsformation = pScreenDisplay.DisplayTransformation;
//范围
IEnvelope pEnvlope = new EnvelopeClass();
pEnvlope = pPoint.Envelope;
pEnvlope.Expand(pDisplayTrnsformation.VisibleBounds.Width / 100,
pDisplayTrnsformation.VisibleBounds.Height / 100,
false);
//图层组
IGroupLayer pGroupLayer = new GroupLayerClass();
for (int i = 0; i < pMap.LayerCount; i++)
{
pGroupLayer.Add(pMap.get_Layer(i));
}
pIdentify = pGroupLayer as IIdentify;
pIdArray = pIdentify.Identify(pEnvlope as IGeometry);
//get the FeatureIdentifyObject
if ((pIdArray != null) && (pIdArray.Count > 0))
{
pFeatureIdentifyObj = pIdArray.get_Element(0) as IFeatureIdentifyObj;
pIdentifyObj = pFeatureIdentifyObj as IIdentifyObj;
pRowIdentifyObj = pFeatureIdentifyObj as IRowIdentifyObject;
pFeature = pRowIdentifyObj.Row as IFeature;
m_feature = pFeature;
m_identifyObj = pIdentifyObj;
pIdentifyObj.Flash(pScreenDisplay);
}
}//end of IdentifyFeature
- I查询实现
- ArcGIS Flex Viewer 实现i查询
- 树形查询新特性CONNECT_BY_ISLEAF的9i实现方式
- 使用oracle 9i 里的层级查询(Hierarchical Queries)实现树状表结构的递归数据查询
- 10g树形查询新特性CONNECT_BY_ISLEAF的9i实现方式
- 数据库查询的实现:B树与磁盘I/O算法设计
- 简单的i++ ++i实现
- i++与++i的汇编级实现
- ++i和i++ 以及其底层实现
- i++和++i的内部实现
- 写有效率的SQL查询(I)
- 写有效率的SQL查询(I)
- 有效率的SQL查询(I)
- 高效SQL查询之索引(I)
- 高效SQL查询之索引(I)
- 写有效率的SQL查询(I)
- 写有效率的SQL查询(I)
- 高效SQL查询之索引(I)
- 中国著名大学校训中英文对照
- NUnit详细使用方法
- 精通cobol--9.6 直接查找方式
- 网络入门(七)ODBC与ADO对象2
- 精通cobol--9.6.1 如何定义用于直接查找的表
- I查询实现
- symbian积累--Task
- 网络入门(七)ODBC与ADO对象1
- 去除DropDownList遮挡层的效果
- NUnit 快速入门
- 精通cobol--9.6.2 如何进行直接查找
- 精通cobol--9.6.3 对查找数据的处理
- 网络入门(六)SQLServer数据库及其基本操作
- 精通cobol--9.6.4 直接查找方式的适用范围