This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > ID > IDynamicCacheLayerManager Interface > IDynamicCacheLayerManager.Connect Method (ArcObjects .NET 10.4 SDK) |
Try to connect the given layer to a cache.
[Visual Basic .NET] Public Sub Connect ( _ ByVal newFolderPath As String, _ ByVal newFolderName As String _ )
[C#] public void Connect ( string newFolderPath, string newFolderName );
[C++]
HRESULT Connect(
BSTR newFolderPath,
BSTR newFolderName
);
[C++]
Parameters newFolderPath [in] newFolderPath is a parameter of type BSTR newFolderName [in] newFolderName is a parameter of type BSTR
Please note that in order to connect to an existing cache, you must know the folder path which contains the cache information you will connect to. The folder-name is composed from the layer name together with a global unique identifier assigned by the dynamic display when it got generated.
To get the name of an existing cache you can use property IDynamicCacheLayerManager.FolderName.
In addition to verify that the destination cache exists, the method connect checks the following before actually connecting to the cache:
The following code shows how to connect a given layer to an existing cache. It assumes that you already have valid Map Control and the folder-name of the existing cache information. Please note that you must initialize the cache manager with the given map and layer in order to use any methods and properties on IDynamicCacheLayerManager interface.
// set folder path which contains cache information you will connect to
string sConnectFolderPath=@"C:\Connect";
IMap map=axMapControl1.Map;
IDynamicCacheLayerManager dynamicCacheLayerManager=new DynamicCacheLayerManagerClass();
ILayer layer=map.get_Layer(0);
if (layer is IDynamicLayer){ return ;}
dynamicCacheLayerManager.Init(map, layer);
string sCacheFolderName=dynamicCacheLayerManager.FolderName;
dynamicCacheLayerManager.Connect(sConnectFolderPath, sCacheFolderName);
The following code shows how to connect a given layer to an existing cache. It assumes that you already have valid Map Control and the folder-name of the existing cache information. Please note that you must initialize the cache manager with the given map and layer in order to use any methods and properties on IDynamicCacheLayerManager interface.
' set folder path which contains cache information you will connect to
Dim sConnectFolderPath As String="C:\Connect"
Dim map As IMap=axMapControl1.Map
Dim dynamicCacheLayerManager As IDynamicCacheLayerManager=New DynamicCacheLayerManagerClass()
Dim layer As ILayer= map.Layer(0)
If TypeOf layer Is IDynamicLayer Then
Return
End If
dynamicCacheLayerManager.Init (map, layer)
Dim sCacheFolderName As String=dynamicCacheLayerManager.FolderName
dynamicCacheLayerManager.Connect (sConnectFolderPath,sCacheFolderName)