#1 Tue 18 May 2010 15:57
- zaynabe
- Participant occasionnel
- Date d'inscription: 13 May 2010
- Messages: 12
[ArcGIS 9.x] Faire clignoter une entité sélectionnée
bonjour tout le monde
je vais enchainer sur mon sujet que j'ai publié avant sur "la récupération des identifiants de quelques unités sélectionnées dans un listbox"!
voilà, j'ai récupéré les identifiants dans la listbox, ce que je cherche à faire, c'est pouvoir ;en cliquant sur un identifiant dans la listbox; voir clignoter l'entitée correspondante à cet identifiant, bien sur , toute en gardant les entitées sélectionnées!!!
j'ai pensé à la methode "flash", et j'ai trouvé un bout de code qui peut me servir, mais je n'arrive pas à le faire fonctionner
voici le code que j'essais de faire fonctionner
Code:
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim pMxDoc As IMxDocument
Dim pPoint As IPoint
Dim pFeature As IFeature
Set pMxDoc = ThisDocument
Set pPoint =pMxDoc.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y)
If (pFeature Is Nothing) Then Exit Sub
' now we must highlight the selected feature by flashing its geometry
FlashFeature pFeature, pMxDoc
Exit Sub
end suben plus , il ya le code suivant:
Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Sub FlashFeature(pGeom As IGeometry, pMxDoc As IMxDocument)
' Start Drawing on screen
pMxDoc.ActiveView.ScreenDisplay.StartDrawing 0, esriNoScreenCache
' Switch functions based on Geomtry type
Select Case pGeom.GeometryType
Case esriGeometryPolyline
FlashLine pMxDoc.ActiveView.ScreenDisplay, pGeom
Case esriGeometryPolygon
FlashPolygon pMxDoc.ActiveView.ScreenDisplay, pGeom
Case esriGeometryPoint
FlashPoint pMxDoc.ActiveView.ScreenDisplay, pGeom
End Select
' Finish drawing on screen
pMxDoc.ActiveView.ScreenDisplay.FinishDrawing
End Sub
Public Sub FlashLine(pDisplay As IScreenDisplay, pGeometry As IGeometry)
Dim pLineSymbol As ISimpleLineSymbol
Dim pSymbol As ISymbol
Dim pRgbColor As IRgbColor
Set pLineSymbol = New SimpleLineSymbol
pLineSymbol.Width = 4
Set pRgbColor = New RgbColor
pRgbColor.Green = 128
Set pSymbol = pLineSymbol
pSymbol.ROP2 = esriROPNotXOrPen
pDisplay.SetSymbol pLineSymbol
pDisplay.DrawPolyline pGeometry
Sleep 300
pDisplay.DrawPolyline pGeometry
End Subvoilà, je cherche à adapter ces codes à mes besoins, et j'ai besoin de l'aide
merci d'avance
NB:: j'ai posté le meme sujet sur cette page de forumsig http://www.forumsig.org/showthread.php?t=27101 , mais j'ai pas encore eu de réponse
Hors ligne
#2 Tue 18 May 2010 16:18
Re: [ArcGIS 9.x] Faire clignoter une entité sélectionnée
Le code que tu cites ne risque pas de fonctionner tout seul. Il faut donner les bons paramètres aux fonctions !
Le premier m'a l'air très bien, sauf qu'entre "Dim pFeature As IFeature" et "FlashFeature pFeature, pMxDoc" il faudrait un petit "set pFeature = ..." où ... est l'objet sélectionné !
Jérôme Cuinet
L'avantage de la Chine, c'est que le soleil se couche plus tard !
Hors ligne


