LPDISPATCH getLayerWithIndex(int layerIndex)
This method retrieves the LayerAPI object of the layer with zero-based index layerIndex. The argument layerIndex must be between 0 and n, where n is the value returned by getNumLayers.
A permanent layer's index is determined by its relative position in the Spatial Agent File (SAF). The permanent layers are followed by special layers if any. The transient layers follow any other layers in the order 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):
ILayerAPI* layrAPI = new ILayerAPI;
layrAPI->m_lpDispatch = mapAPI->getLayerWithIndex(2);
In VC++, on the stack (assuming mapAPI is a pointer to a MapAPI):
layr.m_lpDispatch = mapAPI->getLayerWithIndex(2);
In VB (assuming mapAPI is a MapAPI object):
In the declarations:
Public layrAPI As Object
Private layrAPI As Object
Set layrAPI = mapAPI.getLayerWithIndex(2)
The client receives an instance of this object shared by other clients, if any.