IFeatureIdentifyObj实现闪烁功能

GIS浩淼的天空看到的一篇用IFeatureIdentifyObj实现闪烁功能,不过这方法AE不支持。

Dim pEnvs As IEnvelope
pEnvs 
= AxMapControl1.TrackRectangle

Dim pLayer As IFeatureLayer
pLayer 
= pMainMap.Layer(0)
Dim pIdentify As IIdentify
pIdentify 
= pLayer
Dim pArr As IArray
pArr 
= pIdentify.Identify(pEnvs)

Dim pFtIdenObj As IFeatureIdentifyObj
Dim pIdenObj As IIdentifyObj
If Not pArr Is Nothing Then
Dim j As Integer
For j = 0 To pArr.Count - 1
        pFtIdenObj 
= pArr.Element(j)
        pIdenObj 
= pFtIdenObj
        pIdenObj.Flash(pMainAV.ScreenDisplay)
        pIdenObj 
= Nothing
        pFtIdenObj 
= Nothing
Next
End If

 

要在AE实现闪烁功能,一个方法是用IHookActions.DoActions()方法搭上esriHookActionsFlash作为动作。

IHookActions的定义如下  


[Visual Basic 
6.0]
Sub DoAction(    
    
ByVal pUnknown As Unknown, 
    
ByVal Action As esriHookActions  
)

[Visual Basic .NET]
Public Sub DoAction ( _
    
ByVal pUnknown As Object, _
    
ByVal Action As esriHookActions _
)

 

pUnknown必须是实现了IEnvelope, IPoint, IPolygon 或者 IPolyline 的geometry对象,

而且该geometry不应该为空。

Action方面有6个constant,可以根据需要选择.

Constant

Value

Description

esriHookActionsFlash

0

Flash the geometry.

esriHookActionsPan

1

Pan to the geometry.

esriHookActionsZoom

2

Zoom to the geometry.

esriHookActionsGraphic

3

Create a graphic for the geometry.

esriHookActionsLabel

4

Create a graphic and label for the geometry.

esriHookActionsCallout

5

Create a callout for the geometry.

 

 完成闪烁的代码如下:

Dim hookActions as IHookActions
hookActions.DoAction(feature.Shape, esriHookActions.esriHookActionsPan)

 Application.DoEvent();
hookActions.DoAction(feature.Shape,esriHookActions.esriHookActionsFlash)

 

posted on 2009-04-14 23:03  炜升  阅读(653)  评论(0编辑  收藏  举报