LPDISPATCH getLayerWithName(string layerName)

This method retrieves the LayerAPI object of the layer with name layerName.  .  A Permanent layer's name is given by its LayerName tag in the Spatial Agent File (SAF).  Special and transient layers have the names given in Overview of Data Layering.

The method is used as shown below.

In VC++, allocated on the heap (assuming mapAPI is a pointer to a MapAPI):

  1. ILayerAPI* layrAPI = new ILayerAPI;

  2. layrAPI->m_lpDispatch = mapAPI->getLayerWithName("Highways");

In VC++, on the stack (assuming mapAPI is a pointer to a MapAPI):

  1. ILayerAPI layrAPI;

  2. layr.m_lpDispatch = mapAPI->getLayerWithName("Highways");

In VB (assuming mapAPI is a MapAPI object):

In the declarations:

Public layrAPI As Object


Private layrAPI As Object

Where needed:

Set layrAPI = mapAPI.getLayerWithName("Highways")

The client receives an instance of this object shared by other clients, if any.