C#调用ArcEngine定位三维点

 1.根据鼠标移动,获取地图上的三维点坐标

定义鼠标移动事件:其中axSceneControl是三维的AxSceneControl对象。

this.axSceneControl.OnMouseMove += new AxESRI.ArcGIS.Controls.ISceneControlEvents_OnMouseMoveEventHandler(this.axSceneControl_OnMouseMove);

2. 定义鼠标移动事件对应执行的方法    

   private void axSceneControl_OnMouseMove(object sender, AxESRI.ArcGIS.Controls.ISceneControlEvents_OnMouseMoveEvent e)
{

           //方法1

            IPoint po;
            object owner, obj;
            axMapFull.SceneGraph.Locate(axSceneControl.SceneViewer, e.x, e.y, esriScenePickMode.esriScenePickGeography, true, out po, out owner, out obj);//po就是得到的点

           //方法2
            IHit3DSet pHit3dSet = null;
            axSceneControl.SceneGraph.LocateMultiple(axSceneControl.SceneGraph.ActiveViewer, e.x, e.y, esriScenePickMode.esriScenePickAll, true, out pHit3dSet);

           po=pHit3D.Point;//po就是得到的点    

           //如果想得到某图层元素,可以看看下面代码

           int index=2;
           if (pHit3dSet == null)
                return;
            IHit3D pHit3D = (IHit3D)pHit3dSet.Hits.get_Element(0);
            IFeature pFeature = (IFeature)pHit3D.Object;
            if (pFeature == null)
                return;
            string siteName = pFeature.get_Value(index).ToString();   

}

 

转载于:https://www.cnblogs.com/liujp/archive/2012/07/09/2582690.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值