SignpostGPFunctionFactory.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 System Imports System.Runtime.InteropServices Imports ESRI.ArcGIS.ADF.CATIDs ' for GPFunctionFactories.Register() Imports ESRI.ArcGIS.esriSystem Imports ESRI.ArcGIS.Geodatabase Imports ESRI.ArcGIS.Geoprocessing Namespace GPImportSignpostFunctions <Guid("6CB22E71-856E-459a-89FA-34CDE2A3DCC4")> _ <ClassInterface(ClassInterfaceType.None)> _ <ProgId("GPImportSignpostFunctions.SignpostGPFunctionFactory")> _ Public Class SignpostGPFunctionFactory Implements IGPFunctionFactory #Region "COM Registration Function(s)" <ComRegisterFunction()> _ <ComVisible(False)> _ Private Shared Sub RegisterFunction(ByVal registerType As Type) Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID) GPFunctionFactories.Register(regKey) End Sub <ComUnregisterFunction()> _ <ComVisible(False)> _ Private Shared Sub UnregisterFunction(ByVal registerType As Type) Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID) GPFunctionFactories.Unregister(regKey) End Sub #End Region Public Sub New() End Sub #Region "IGPFunctionFactory Members" Public Function GetFunction(ByVal name As String) As IGPFunction Implements IGPFunctionFactory.GetFunction Dim gpFunction As IGPFunction = Nothing Select Case name Case "ImportDynamapSigns" gpFunction = New ImportDynamapSignsFunction() Case "ImportNavStreetsSigns" gpFunction = New ImportNavStreetsSignsFunction() Case "ImportMultiNetSigns" gpFunction = New ImportMultiNetSignsFunction() End Select Return gpFunction End Function Public ReadOnly Property CLSID() As UID Implements IGPFunctionFactory.CLSID Get Dim pUID As UID pUID = New UID pUID.Value = "GPImportSignpostFunctions.SignpostGPFunctionFactory" Return pUID End Get End Property Public Function GetFunctionNames() As IEnumGPName Implements IGPFunctionFactory.GetFunctionNames Dim array As IArray = New EnumGPName array.Add(GetFunctionName("ImportDynamapSigns")) array.Add(GetFunctionName("ImportNavStreetsSigns")) array.Add(GetFunctionName("ImportMultiNetSigns")) Return CType(array, IEnumGPName) End Function Public ReadOnly Property Name() As String Implements IGPFunctionFactory.Name Get Return "Network Analyst Sample Tools" End Get End Property Public Function GetFunctionEnvironments() As IEnumGPEnvironment Implements IGPFunctionFactory.GetFunctionEnvironments Return Nothing End Function Public ReadOnly Property SignpostFactoryAlias() As String Implements IGPFunctionFactory.Alias Get Return "Network Analyst Sample Tools" End Get End Property Public Function GetFunctionName(ByVal Name As String) As IGPName Implements IGPFunctionFactory.GetFunctionName Dim functionFactory As IGPFunctionFactory = New SignpostGPFunctionFactory() Dim functionName As IGPFunctionName = New GPFunctionName Dim gpName As IGPName Select Case Name Case "ImportDynamapSigns" gpName = CType(functionName, IGPName) gpName.Name = Name gpName.Category = "Directions Data Setup" gpName.Description = "Create and populate Signpost Feature Class and Signpost Streets Table from Tele Atlas Dynamap data" gpName.DisplayName = "Import Dynamap Signs" gpName.Factory = functionFactory Return gpName Case "ImportNavStreetsSigns" gpName = CType(functionName, IGPName) gpName.Name = Name gpName.Category = "Directions Data Setup" gpName.Description = "Create and populate Signpost Feature Class and Signpost Streets Table from NAVTEQ NAVSTREETS data" gpName.DisplayName = "Import NAVSTREETS Signs" gpName.Factory = functionFactory Return gpName Case "ImportMultiNetSigns" gpName = CType(functionName, IGPName) gpName.Name = Name gpName.Category = "Directions Data Setup" gpName.Description = "Create and populate Signpost Feature Class and Signpost Streets Table from Tele Atlas MultiNet data" gpName.DisplayName = "Import MultiNet Signs" gpName.Factory = functionFactory Return gpName End Select Return Nothing End Function #End Region End Class End Namespace