Common CustomDataSourceCommon_CustomDataSource_VBNet\CustomDataSource_VBNet\TiledMapDataSource_VBNet\MapTocFunctionality.vb
' Copyright 2007 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
Imports ESRI.ArcGIS.ADF.Web.DataSources
Imports ESRI.ArcGIS.ADF.Web
Namespace TiledMapDataSource_VBNet
Public Class MapTocFunctionality
Implements IMapTocFunctionality
Private _tileCacheInfo As TileCacheInfo = Nothing
Public Sub New(ByVal name_Renamed As String, ByVal resource_Renamed As MapResource, ByVal tileCacheInfo As TileCacheInfo)
Me.name_Renamed = name_Renamed
Me.resource_Renamed = resource_Renamed
_tileCacheInfo = tileCacheInfo
End Sub
#Region "private member variables"
Private name_Renamed As String = String.Empty
Private resource_Renamed As IGISResource = Nothing
Private initialized_Renamed As Boolean = False
#End Region
#Region "IMapTocFunctionality implementation"
Public Sub SetLayerVisibility(ByVal mapFunctionalityName As String, ByVal layerID As Object, ByVal visible As Boolean)
Dim mapFunc As MapFunctionality = GetMapFunctionality(mapFunctionalityName)
If mapFunc Is Nothing Then
Throw New ArgumentException("mapFunctionalityName")
End If
mapFunc.SetLayerVisibility(layerID.ToString(), visible)
End Sub
Public Function GetMapContents(ByVal mapFunctionalityName As String, ByVal format As ESRI.ArcGIS.ADF.Web.WebImageFormat, ByVal useMimeData As Boolean, ByVal showAllDataFrames As Boolean) As ESRI.ArcGIS.ADF.Web.TocDataFrame() Implements IMapTocFunctionality.GetMapContents
Dim tocDataFrames As TocDataFrame() = New TocDataFrame(0) {}
tocDataFrames(0) = New TocDataFrame(resource_Renamed.Name)
If Not _tileCacheInfo.Layers Is Nothing Then
For Each kvp As KeyValuePair(Of String, String) In _tileCacheInfo.Layers
Dim layer As TocLayer = New TocLayer()
layer.LayerName = kvp.Value
layer.ID = kvp.Key
layer.Name = kvp.Key
layer.Visible = True
tocDataFrames(0).Add(layer)
Next kvp
End If
Return tocDataFrames
End Function
#End Region
#Region "IGISFunctionality implementation"
Private _webControl As System.Web.UI.WebControls.WebControl
Public Property WebControl() As System.Web.UI.WebControls.WebControl Implements IMapTocFunctionality.WebControl
Get
Return _webControl
End Get
Set
_webControl = Value
End Set
End Property
Public Property Name() As String Implements IMapTocFunctionality.Name
Get
Return name_Renamed
End Get
Set
name_Renamed = Value
End Set
End Property
Public Property Resource() As IGISResource Implements IMapTocFunctionality.Resource
Get
Return resource_Renamed
End Get
Set
resource_Renamed = Value
End Set
End Property
Public ReadOnly Property Initialized() As Boolean Implements IMapTocFunctionality.Initialized
Get
Return initialized_Renamed
End Get
End Property
Public Sub LoadState() Implements IMapTocFunctionality.LoadState
End Sub
Public Sub Initialize() Implements IMapTocFunctionality.Initialize
initialized_Renamed = True
End Sub
Public Sub SaveState() Implements IMapTocFunctionality.SaveState
End Sub
Public Sub Dispose() Implements IMapTocFunctionality.Dispose
initialized_Renamed = False
End Sub
Public Function Supports(ByVal operation As String) As Boolean Implements IMapTocFunctionality.Supports
Return True
End Function
#End Region
#Region "private methods"
Private Function GetMapFunctionality(ByVal name_Renamed As String) As MapFunctionality
Dim mapFunctionality As MapFunctionality = TryCast(resource_Renamed.Functionalities.Find(name_Renamed), MapFunctionality)
Return mapFunctionality
End Function
#End Region
End Class
End Namespace