Creating a toolbar of globe tools
SpatialReference.vb
' Copyright 2010 ESRI
' 
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
' 
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
' 
' See the use restrictions.
' 

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

Namespace GlobeGraphicsToolbar
  Public Class SpatialReferenceFactory
    Private _spatialReference As ISpatialReference

    Public Sub New(ByVal xyCoordinateSystem As Integer)
      _spatialReference = GetSpatialReference(xyCoordinateSystem)
    End Sub

    Private Function GetSpatialReference(ByVal xyCoordinateSystem As Integer) As ISpatialReference
      Const IsHighPrecision As Boolean = True

      Dim spatialReference As ISpatialReference

      Dim spatialReferenceFactory As ISpatialReferenceFactory3 = New SpatialReferenceEnvironmentClass()
      spatialReference = spatialReferenceFactory.CreateSpatialReference(xyCoordinateSystem)

      Dim controlPrecision As IControlPrecision2 = TryCast(spatialReference, IControlPrecision2)
      controlPrecision.IsHighPrecision = IsHighPrecision

      Dim spatialReferenceResolution As ISpatialReferenceResolution = TryCast(spatialReference, ISpatialReferenceResolution)
      spatialReferenceResolution.ConstructFromHorizon()
      spatialReferenceResolution.SetDefaultXYResolution()
      spatialReferenceResolution.SetDefaultZResolution()
      spatialReferenceResolution.SetDefaultMResolution()

      Dim spatialReferenceTolerance As ISpatialReferenceTolerance = TryCast(spatialReference, ISpatialReferenceTolerance)
      spatialReferenceTolerance.SetDefaultXYTolerance()
      spatialReferenceTolerance.SetDefaultZTolerance()
      spatialReferenceTolerance.SetDefaultMTolerance()

      Return spatialReference
    End Function

    Public ReadOnly Property SpatialReference() As ISpatialReference
      Get
        Return _spatialReference
      End Get
    End Property

  End Class
End Namespace