ArcObjects Library Reference  

PolylineElement

About the Creating a toolbar of globe tools Sample

[C#]

PolylineElement.cs

using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Analyst3D;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.GlobeCore;

namespace GlobeGraphicsToolbar
{
    public class PolylineElement
    {
        private IElement _element;
        private IGlobeGraphicsElementProperties _elementProperties;

        public PolylineElement(IGeometry geometry, double width, esriSimpleLineStyle simpleLineStyle)
        {
            _element = GetElement(geometry, width, simpleLineStyle);
            _elementProperties = GetElementProperties();
        }

        private IElement GetElement(IGeometry geometry, double width, esriSimpleLineStyle simpleLineStyle)
        {
            IElement element;

            ILineElement lineElement = new LineElementClass();
            element = lineElement as IElement;

            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
            simpleLineSymbol.Style = simpleLineStyle;
            simpleLineSymbol.Color = ColorSelection.GetColor();
            simpleLineSymbol.Width = width;

            element.Geometry = geometry;

            ILineSymbol lineSymbol = simpleLineSymbol as ILineSymbol;

            lineElement.Symbol = lineSymbol;

            return element;
        }

        private IGlobeGraphicsElementProperties GetElementProperties()
        {
            IGlobeGraphicsElementProperties elementProperties = new GlobeGraphicsElementPropertiesClass();
            elementProperties.Rasterize = true;

            return elementProperties;
        }

        public IElement Element
        {
            get
            {
                return _element;
            }
        }

        public IGlobeGraphicsElementProperties ElementProperties
        {
            get
            {
                return _elementProperties;
            }
        }
    }
}
[Visual Basic .NET]

PolylineElement.vb

Imports Microsoft.VisualBasic
Imports System
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.Analyst3D
Imports ESRI.ArcGIS.Display
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.GlobeCore

Namespace GlobeGraphicsToolbar
	Public Class PolylineElement
		Private _element As IElement
		Private _elementProperties As IGlobeGraphicsElementProperties

        Public Sub New(ByVal geometry As IGeometry, ByVal width As Double, ByVal simpleLineStyle As ESRI.ArcGIS.Display.esriSimpleLineStyle)
            _element = GetElement(geometry, width, simpleLineStyle)
            _elementProperties = GetElementProperties()
        End Sub

        Private Function GetElement(ByVal geometry As IGeometry, ByVal width As Double, ByVal simpleLineStyle As ESRI.ArcGIS.Display.esriSimpleLineStyle) As IElement
            Dim element As IElement

            Dim lineElement As ILineElement = New LineElementClass()
            element = TryCast(lineElement, IElement)

            Dim simpleLineSymbol As ISimpleLineSymbol = New SimpleLineSymbolClass()
            simpleLineSymbol.Style = simpleLineStyle
            simpleLineSymbol.Color = ColorSelection.GetColor()
            simpleLineSymbol.Width = width

            element.Geometry = geometry

            Dim lineSymbol As ILineSymbol = TryCast(simpleLineSymbol, ILineSymbol)

            lineElement.Symbol = lineSymbol

            Return element
        End Function

		Private Function GetElementProperties() As IGlobeGraphicsElementProperties
			Dim elementProperties As IGlobeGraphicsElementProperties = New GlobeGraphicsElementPropertiesClass()
			elementProperties.Rasterize = True

			Return elementProperties
		End Function

		Public ReadOnly Property Element() As IElement
			Get
				Return _element
			End Get
		End Property

		Public ReadOnly Property ElementProperties() As IGlobeGraphicsElementProperties
			Get
				Return _elementProperties
			End Get
		End Property
	End Class
End Namespace