Common_CustomTasks_VBNet\FindNearTask_VBNet\InputParameters.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 System.Collections.Generic Imports System.Text Namespace FindNearTask_VBNet ' Manages task input parameters Friend Class InputParameters ' Array to store input geometries. Used when the user wants to combine geometries. Private _userInputGeometries As ESRI.ArcGIS.ADF.Web.Geometry.Geometry() = Nothing ' Name of the map resource containing the layer to search Public SearchResource As String = Nothing ' Name of the layer to search Public SearchLayer As String = Nothing ' Search distance Public SearchDistance As Single = 1000 ' Search units Public Units As String = Nothing ' Search geometry. This is the user input geometries buffered by the search distance. Public BufferGeometry As ESRI.ArcGIS.ADF.Web.Geometry.Geometry = Nothing ' Whether or not to combine new input geometries with those previously defined Public AddToInputGeometry As Boolean = True ' Provides read access to the geometries to search near, as defined by the user Public ReadOnly Property UserInputGeometries() As ESRI.ArcGIS.ADF.Web.Geometry.Geometry() Get Return _userInputGeometries End Get End Property ' Defines the geometries to search near. If AddToInputGeometry is true, the passed-in geometries ' are combined with those already defined. Otherwise, the defined input geometries are overwritten. Public Sub SetUserInputGeometries(ByVal inputGeometries As ESRI.ArcGIS.ADF.Web.Geometry.Geometry()) ' Check whether to combine the passed-in geometries with those already defined If Me.AddToInputGeometry AndAlso Not _userInputGeometries Is Nothing Then ' Create a new geometry array that's large enough to hold both the defined geometries and those ' passed-in Dim combinedGeometries As ESRI.ArcGIS.ADF.Web.Geometry.Geometry() = New ESRI.ArcGIS.ADF.Web.Geometry.Geometry(inputGeometries.Length + _userInputGeometries.Length - 1){} ' Copy the previously defined geometries to the new array _userInputGeometries.CopyTo(combinedGeometries, 0) ' Add the passed-in geometries to the end of the new array Dim i As Integer = _userInputGeometries.Length Do While i < combinedGeometries.Length combinedGeometries(i) = inputGeometries(i - _userInputGeometries.Length) i += 1 Loop ' Overwrite the previous geometry array with the combined array _userInputGeometries = combinedGeometries Else ' Overwrite the previous geometry array or initialize it with the passed-in array _userInputGeometries = inputGeometries End If End Sub End Class End Namespace