ArcObjects Library Reference  

Layer

About the Creating a toolbar of globe tools Sample

[C#]

Layer.cs

using ESRI.ArcGIS.Analyst3D;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.GlobeCore;

namespace GlobeGraphicsToolbar
{
    public class Layer
    {
        private ILayer _layer;

        public Layer(ILayer layer)
        {
            _layer = layer;
        }

        public void AddElement(IElement element, IGlobeGraphicsElementProperties elementProperties)
        {
            int elementIndex;

            IGlobeGraphicsLayer globeGraphicsLayer = _layer as IGlobeGraphicsLayer;
            globeGraphicsLayer.AddElement(element, elementProperties, out elementIndex);
        }

        public void RemoveElement(int index)
        {
            IGraphicsContainer3D graphicsContainer3D = _layer as IGraphicsContainer3D;
            graphicsContainer3D.DeleteElement(this[index]);
        }

        public IElement this[int i]
        {
            get
            {
                IGraphicsContainer3D graphicsContainer3D = _layer as IGraphicsContainer3D;
                return graphicsContainer3D.get_Element(i);
            }
        }

        public int ElementCount
        {
            get
            {
                IGraphicsContainer3D graphicsContainer3D = _layer as IGraphicsContainer3D;
                return graphicsContainer3D.ElementCount;
            }
        }
    }
}
[Visual Basic .NET]

Layer.vb

Imports Microsoft.VisualBasic
Imports System
Imports ESRI.ArcGIS.Analyst3D
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.GlobeCore

Namespace GlobeGraphicsToolbar
	Public Class Layer
		Private _layer As ILayer

		Public Sub New(ByVal layer As ILayer)
			_layer = layer
		End Sub

		Public Sub AddElement(ByVal element As IElement, ByVal elementProperties As IGlobeGraphicsElementProperties)
			Dim elementIndex As Integer

			Dim globeGraphicsLayer As IGlobeGraphicsLayer = TryCast(_layer, IGlobeGraphicsLayer)
			globeGraphicsLayer.AddElement(element, elementProperties, elementIndex)
		End Sub

		Public Sub RemoveElement(ByVal index As Integer)
			Dim graphicsContainer3D As IGraphicsContainer3D = TryCast(_layer, IGraphicsContainer3D)
			graphicsContainer3D.DeleteElement(Me(index))
		End Sub

		Default Public ReadOnly Property Item(ByVal i As Integer) As IElement
			Get
				Dim graphicsContainer3D As IGraphicsContainer3D = TryCast(_layer, IGraphicsContainer3D)
				Return graphicsContainer3D.Element(i)
			End Get
		End Property

		Public ReadOnly Property ElementCount() As Integer
			Get
				Dim graphicsContainer3D As IGraphicsContainer3D = TryCast(_layer, IGraphicsContainer3D)
				Return graphicsContainer3D.ElementCount
			End Get
		End Property
	End Class
End Namespace