GPPointFileInfo\OutputHasZs.vb
Creating a non-trival custom GP tool - inputs, outputs, and responding to environment settings
GPPointFileInfo\OutputHasZs.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

Namespace GPPointFileInfo
  Public Class OutputHasZ
        Implements GPPointFileInfo.IOutputHasZ
    Private _hasZ As Boolean

    Public Sub New(ByVal gpOutputGeometryDimensions As IGPOutputGeometryDimensions, ByVal esOutputZFlag As IESOutputZFlag)
      _hasZ = GetHasZ(gpOutputGeometryDimensions, esOutputZFlag)
    End Sub

        Public ReadOnly Property HasZ() As Boolean Implements IOutputHasZ.HasZ
            Get
                Return _hasZ
            End Get
        End Property

    Private Function GetHasZ(ByVal gpOutputGeometryDimensions As IGPOutputGeometryDimensions, ByVal esOutputZFlag As IESOutputZFlag) As Boolean
      Dim hasZ As Boolean

      If ((gpOutputGeometryDimensions.GeometryDimensions = "2D") AndAlso (esOutputZFlag.Value = "Enabled")) OrElse ((gpOutputGeometryDimensions.GeometryDimensions = "3D") AndAlso (esOutputZFlag.Value = "Disabled")) Then
        Throw New GPException(GPExceptionSeverity.Error, "Conflicting Input Settings." & ObjectToString.GetNewline() & "gpOutputGeometryDimensions.GeometryDimensions: " & ObjectToString.GetToString(gpOutputGeometryDimensions.GeometryDimensions) & "esOutputZFlag: " & ObjectToString.GetToString(esOutputZFlag))
      Else
        hasZ = (gpOutputGeometryDimensions.GeometryDimensions = "3D")
      End If

      Return hasZ
    End Function
  End Class
End Namespace