MapAPI.getDBLayerWithIndex

 

LPDISPATCH getDBLayerWithIndex(int dbLayerIndex)

This method retrieves the LayerAPI object of the layer, from among those layers associated with a database table, with zero-based index dbLayerIndex.  The argument dbLayerIndex must be between 0 and n, where n is the value returned by getNumDBLayers.

A database layer's index is determined by its relative position in the Spatial Agent File (SAF), with non-database layers eliminated from the counting procedure.

The method is used as shown below.

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

  1. ILayerAPI* layrAPI = new ILayerAPI;

  2. layrAPI->m_lpDispatch = mapAPI->getDBLayerWithIndex(2);

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

  1. ILayerAPI layrAPI;

  2. layr.m_lpDispatch = mapAPI->getDBLayerWithIndex(2);

In VB (assuming mapAPI is a MapAPI object):

In the declarations:

Public layrAPI As Object

or

Private layrAPI As Object

Where needed:

Set layrAPI = mapAPI.getDBLayerWithIndex(2)

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