ArcObjects Library Reference  

PointGeometry

About the Creating a toolbar of globe tools Sample

[C#]

PointGeometry.cs

using ESRI.ArcGIS.Geometry;

namespace GlobeGraphicsToolbar
{
    public class PointGeometry
    {
        private IGeometry _geometry;

        public PointGeometry(double longitude, double latitude, double altitudeInKilometers, ISpatialReference spatialReference)
        {
            _geometry = GetGeometry(longitude, latitude, altitudeInKilometers, spatialReference);
        }

        private IGeometry GetGeometry(double longitude, double latitude, double altitudeInKilometers, ISpatialReference spatialReference)
        {
            IGeometry geometry;

            IPoint point = new PointClass();

            point.X = longitude;
            point.Y = latitude;
            point.Z = altitudeInKilometers;

            point.SpatialReference = spatialReference;

            geometry = point as IGeometry;

            MakeZAware(geometry);

            return geometry;
        }

        private void MakeZAware(IGeometry geometry)
        {
            IZAware zAware = geometry as IZAware;
            zAware.ZAware = true;
        }

        public IGeometry Geometry
        {
            get { return _geometry; }
        }
    }
}
[Visual Basic .NET]

PointGeometry.vb

Imports Microsoft.VisualBasic
Imports System
Imports ESRI.ArcGIS.Geometry

Namespace GlobeGraphicsToolbar
	Public Class PointGeometry
		Private _geometry As IGeometry

		Public Sub New(ByVal longitude As Double, ByVal latitude As Double, ByVal altitudeInKilometers As Double, ByVal spatialReference As ISpatialReference)
			_geometry = GetGeometry(longitude, latitude, altitudeInKilometers, spatialReference)
		End Sub

		Private Function GetGeometry(ByVal longitude As Double, ByVal latitude As Double, ByVal altitudeInKilometers As Double, ByVal spatialReference As ISpatialReference) As IGeometry
			Dim geometry As IGeometry

			Dim point As IPoint = New PointClass()

			point.X = longitude
			point.Y = latitude
			point.Z = altitudeInKilometers

			point.SpatialReference = spatialReference

			geometry = TryCast(point, IGeometry)

			MakeZAware(geometry)

			Return geometry
		End Function

		Private Sub MakeZAware(ByVal geometry As IGeometry)
			Dim zAware As IZAware = TryCast(geometry, IZAware)
			zAware.ZAware = True
		End Sub

		Public ReadOnly Property Geometry() As IGeometry
			Get
				Return _geometry
			End Get
		End Property
	End Class
End Namespace