L_VecGetLayerCount

#include "lvkrn.h"

L_LVKRN_API L_INT L_VecGetLayerCount(pVector)

const pVECTORHANDLE pVector;

/* pointer to a vector handle */

Returns the number of layers inside a vector handle.

Parameter

Description

pVector

Pointer to the vector handle.

Returns

Number of layers.

Comments

After calling this function, L_VecGetLayerByIndex can be used to iterate through the layers in a vector handle.

Required DLLs and Libraries

LVKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_VecGetLayerByName, L_VecGetLayerByIndex, L_VecGetLayer.

Topics:

Working with Vector Layers

Example

This example will show the names of the all layers inside a vector handle, in a message box.

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