Returns the number of layers inside a vector handle.
#include "ltvkrn.h"
L_LVKRN_API L_INT L_VecGetLayerCount(pVector)
Pointer to the vector handle.
Number of layers.
After calling this function, L_VecGetLayerByIndex can be used to iterate through the layers in a vector handle.
This example will show the names of the all layers inside a vector handle, in a message box.
L_LTVKRNTEX_API L_INT VecGetLayerCountExample(pVECTORHANDLE pVector)
{
L_INT nRet;
L_INT nCount, i;
VECTORLAYER Layer;
VECTORLAYERDESC LayerDesc;
/* Get number of layers inside the vector handle */
nCount = L_VecGetLayerCount( pVector );
nRet = SUCCESS;
/* Iterate through the layers */
for( i = 0; i < nCount; i++ )
{
/* Get layer and its descriptor */
nRet = L_VecGetLayerByIndex( pVector, i, &Layer );
if(nRet != SUCCESS)
return nRet;
nRet = L_VecGetLayer( pVector, &Layer, &LayerDesc );
if(nRet != SUCCESS)
return nRet;
/* Show name in a message box */
MessageBox( NULL, LayerDesc.szName, TEXT("Layer Name"), MB_OK );
/* Free the layer descriptor because it's no longer needed */
nRet = L_VecFreeLayer( &LayerDesc );
}
return nRet;
}