GPPointFileInfo\ESExtent.vb
Creating a non-trival custom GP tool - inputs, outputs, and responding to environment settings
GPPointFileInfo\ESExtent.vb
' Copyright 2008 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 use restrictions at <your ArcGIS install location>/developerkit/userestrictions.txt.
' 

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

Namespace GPPointFileInfo
  Public Class ESExtent
        Implements GPPointFileInfo.IESExtent
    Private Const _EnvironmentName As String = "extent"
    Private _envelope As IEnvelope

    Public Sub New(ByVal gpEnvironmentManager As IGPEnvironmentManager)
      Dim gpValue As IGPValue = gpEnvironmentManager.GetGPValue(_EnvironmentName)

      _envelope = GetEnvelope(gpValue)
    End Sub

        Public ReadOnly Property Envelope() As IEnvelope Implements IESExtent.Envelope
            Get
                Return _envelope
            End Get
        End Property

    Private Function GetEnvelope(ByVal gpValue As IGPValue) As IEnvelope
      Dim envelope As IEnvelope

      Dim gpExtent As IGPExtent = TryCast(gpValue, IGPExtent)

      Dim extentType As esriGPExtentEnum

      envelope = gpExtent.GetExtent(extentType)

      Return envelope
    End Function
  End Class
End Namespace