This document is archived and information here might be outdated.  Recommended version.


IDynamicCacheLayerManager.Connect Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Carto)  

IDynamicCacheLayerManager.Connect Method

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

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

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:

  1. The cache structure matches the input layer.
  2. Spatial reference of the target cache matches the one of the map.
  3. The compression format of the cache matches the one set for the layer.
  4. Should the input layer have a reference scale, that matches the one set to the cache.
  5. Renderers and labels are identical.
[C#]

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);

[Visual Basic .NET]

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)  

     
    
 

  
  

See Also

IDynamicCacheLayerManager Interface

.NET Related Topics

Persisting cache information for use in dynamic display