Placed inside ArcGlobe's VBA, this routine will return an IEnumLayer interface containing pointers to all the layers in the globe.
How to use
- Paste the code into ArcGlobe's VB Editor.
- Run the function from a calling procedure which sets the return value of GetGlobeLayers to an IEnumLayerinterface variable.
Public Function GetGlobeLayers() As IEnumLayer
Dim pCurrentApp As IApplication
Dim pBasicMap As IBasicMap
Set pCurrentApp = Application
If TypeOf pCurrentApp Is IGMxApplication Then
Dim pGMxDoc As IGMxDocument
Set pGMxDoc = pCurrentApp.Document
Set pBasicMap = pGMxDoc.Scene
Else
Exit Function
End If
If pBasicMap.layerCount = 0 Then
Set GetGlobeLayers = Nothing
Else
Set GetGlobeLayers = pBasicMap.Layers
End If
End Function