Common_CustomControls_VBNet\ADFCompositeControl\MapIdentify.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 ''' <summary> ''' Custom tool for identifying features on the map ''' </summary> Friend Class MapIdentify Implements ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools.IMapServerToolAction #Region "IMapServerToolAction Members" Private Sub ServerAction(ByVal toolEventArgs As ESRI.ArcGIS.ADF.Web.UI.WebControls.ToolEventArgs) Implements ESRI.ArcGIS.ADF.Web.UI.WebControls.Tools.IMapServerToolAction.ServerAction ' Get the Map control that was clicked Dim adfMap As ESRI.ArcGIS.ADF.Web.UI.WebControls.Map = TryCast(toolEventArgs.Control, ESRI.ArcGIS.ADF.Web.UI.WebControls.Map) ' Get the point clicked Dim mapPointEventArgs As ESRI.ArcGIS.ADF.Web.UI.WebControls.MapPointEventArgs = CType(toolEventArgs, ESRI.ArcGIS.ADF.Web.UI.WebControls.MapPointEventArgs) Dim adfPoint As ESRI.ArcGIS.ADF.Web.Geometry.Point = mapPointEventArgs.MapPoint ' Identify each functionality (i.e. resource) in the map For Each gisFunctionality As ESRI.ArcGIS.ADF.Web.DataSources.IGISFunctionality In adfMap.GetFunctionalities() ' Get a reference to the current resource and check whether it supports querying Dim gisResource As ESRI.ArcGIS.ADF.Web.DataSources.IGISResource = gisFunctionality.Resource Dim supportsQueryFunctionality As Boolean = gisResource.SupportsFunctionality(GetType(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality)) If supportsQueryFunctionality Then ' Create a query functionality object to use in performing the identify operation Dim queryFunctionality As ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality = CType(gisResource.CreateFunctionality(GetType(ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality), Nothing), ESRI.ArcGIS.ADF.Web.DataSources.IQueryFunctionality) ' Get the names and IDs of the current resource's queryable layers Dim layerIDs As String() = Nothing Dim layerNames As String() = Nothing queryFunctionality.GetQueryableLayers(Nothing, layerIDs, layerNames) Dim pixelTolerance As Integer = 3 ' Execute the identify operation Dim identifyResultsDataTableArray As System.Data.DataTable() = queryFunctionality.Identify(gisFunctionality.Name, adfPoint, pixelTolerance, ESRI.ArcGIS.ADF.Web.IdentifyOption.AllLayers, layerIDs) ' Put code here for manipulating the results tables for display End If Next gisFunctionality End Sub #End Region End Class