在mapControl控件上添加feature要素

ArcGIS Engine没有提供在MapControl中点击查询的命令,只是提供了ReaderControl中的使用的点击查询的命令,下面的代码就是实现点击查询并闪烁的代码。

过程描述

Private Sub MapControl1_OnMouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long, ByVal mapX As Double, ByVal mapY As Double)
Dim pMap As IMap

Dim i As Integer
Dim pPoint As IPoint
Set pMap = MapControl1.Map
Set pPoint = MapControl1.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)

Dim pIdentify As IIdentify

Dim pIDArray As IArray
Dim pFeatIdObj As IFeatureIdentifyObj
Dim pIdObj As IIdentifyObj
Set pIdentify = pMap.Layer(1)

Dim pEnv As IEnvelope
Set pEnv = New Envelope
Set pEnv = MapControl1.ActiveView.Extent
pEnv.Height = 100
pEnv.Width = 100
pEnv.CenterAt pPoint

Set pIDArray = pIdentify.Identify(pEnv)

If Not pIDArray Is Nothing Then
Set pFeatIdObj = pIDArray.Element(0)
Set pIdObj = pFeatIdObj
pIdObj.Flash MapControl1.ActiveView.ScreenDisplay
'消息显示查询目标的信息
MsgBox "Layer:" & pIdObj.Layer.Name & vbNewLine & "Feature:" & pIdObj.Name
Else
MsgBox "No feature identified."
End If
End Sub

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值