您的位置:首页 > 其它

利用 IIdentifyDialog 模拟ArcMap工具里面 Identify功能进行要素查询

2008-05-31 14:43 621 查看
利用AE提供的IIdentifyDialog,创建class identifyTool 。然后在程序里面就可以在鼠标点击按钮功能下,模拟实现ArcMap工具里面 Identify功能。

类生成代码如下:

1 public sealed class identifyTool : BaseTool

2 {

3 IHookHelper pHookHelper = new HookHelperClass();

4 public identifyTool()

5 {

6 m_cursor = new System.Windows.Forms.Cursor(@"..\..\Resources\Identify_md.cur");

7

8 }

9

10 public override void OnCreate(object hook)

11 {

12 pHookHelper.Hook = hook;

13 }

14 public override void OnMouseDown(int Button, int Shift, int X, int Y)

15 {

16

17 IActiveView pActiveView;

18 IIdentifyDialog pIdentifyDialog;

19 IIdentifyDialogProps pIdentifyDialogProps;

20 IEnumLayer pEnumLayer;

21 ILayer pLayer;

22

23 pActiveView = pHookHelper.ActiveView;

24

25 pIdentifyDialog = new IdentifyDialogClass();

26 pIdentifyDialogProps = pIdentifyDialog as IIdentifyDialogProps;

27 pIdentifyDialog.Map = pHookHelper.ActiveView.FocusMap;

28 pIdentifyDialog.Display = pActiveView.ScreenDisplay;

29

30 pIdentifyDialog.ClearLayers();

31

32 pEnumLayer = pIdentifyDialogProps.Layers;

33 pEnumLayer.Reset();

34 pLayer = pEnumLayer.Next();

35 while (pLayer != null)

36 {

37 pIdentifyDialog.AddLayerIdentifyPoint(pLayer, X, Y);

38 pLayer = pEnumLayer.Next();

39 }

40 pIdentifyDialog.Show();

41 }

42 }

其中m_cursor用来设置鼠标样式。

IIdentifyDialog要设置其Map和Display属性。

(参考ESRI中国社区)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐