ArcObjects Library Reference

Add Globe Layer by Type Snippet

Add a globelayer as draped, floating or elevation type.

[C#]

///<summary>Add a globelayer as draped, floating or elevation type.</summary>
///      
///<param name="globe">An IGlobe interface</param>
///<param name="globeLayerType">An esriGlobeLayerType enum. Example: ESRI.ArcGIS.GlobeCore.esriGlobeLayerType.esriGlobeLayerTypeDraped</param>
///<param name="layer">An ILayer interface</param>
///      
///<remarks></remarks>
public void AddGlobeLayerByType(ESRI.ArcGIS.GlobeCore.IGlobe globe, ESRI.ArcGIS.GlobeCore.esriGlobeLayerType globeLayerType, ESRI.ArcGIS.Carto.ILayer layer)
{
  if (globe == null) return;

  if (globeLayerType == ESRI.ArcGIS.GlobeCore.esriGlobeLayerType.esriGlobeLayerTypeElevation)
  {
    if (layer is ESRI.ArcGIS.Carto.IRasterLayer || layer is ESRI.ArcGIS.Carto.ITinLayer || layer is ESRI.ArcGIS.Carto.ITerrainLayer)
    {
      globe.AddLayerType(layer, globeLayerType, true);
    }
    return;
  }
  // else if GlobeLayerType is esriGlobeLayerTypeDraped or esriGlobeLayerTypeFloating
  globe.AddLayerType(layer, globeLayerType, true);
}
[Visual Basic .NET]

'''<summary>Add a globelayer as draped, floating or elevation type.</summary>
'''      
'''<param name="globe">An IGlobe interface</param>
'''<param name="globeLayerType">An esriGlobeLayerType enum. Example: ESRI.ArcGIS.GlobeCore.esriGlobeLayerType.esriGlobeLayerTypeDraped</param>
'''<param name="layer">An ILayer interface</param>
'''      
'''<remarks></remarks>
Public Sub AddGlobeLayerByType(ByVal globe As ESRI.ArcGIS.GlobeCore.IGlobe, ByVal globeLayerType As ESRI.ArcGIS.GlobeCore.esriGlobeLayerType, ByVal layer As ESRI.ArcGIS.Carto.ILayer)

  If globe Is Nothing Then
    Return
  End If

  If globeLayerType = ESRI.ArcGIS.GlobeCore.esriGlobeLayerType.esriGlobeLayerTypeElevation Then

    If TypeOf layer Is ESRI.ArcGIS.Carto.IRasterLayer OrElse TypeOf layer Is ESRI.ArcGIS.Carto.ITinLayer OrElse TypeOf layer Is ESRI.ArcGIS.Carto.ITerrainLayer Then
      globe.AddLayerType(layer, globeLayerType, True)
    End If

    Return

  End If

  globe.AddLayerType(layer, globeLayerType, True)

End Sub


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Carto
  • ESRI.ArcGIS.GlobeCore