使用ArcGIS Engine来实现地图的点击查询并闪烁
?????????????????????????????????? 使用ArcGIS Engine來實現(xiàn)地圖的點擊查詢并閃爍
ArcGIS Engine沒有提供在MapControl中點擊查詢的命令,只是提供了ReaderControl中的使用的點擊查詢的命令,下面的代碼就是實現(xiàn)點擊查詢并閃爍的代碼。
過程描述
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
?
總結(jié)
以上是生活随笔為你收集整理的使用ArcGIS Engine来实现地图的点击查询并闪烁的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HTML DOM教程 47-JavaSc
- 下一篇: error HLP: Help comp