L_VecAddLayer

#include "lvkrn.h"

L_LVKRN_API L_INT L_VecAddLayer(pVector, pLayerDesc, pLayer, dwFlags)

pVECTORHANDLE pVector;

/* pointer to a vector handle */

const pVECTORLAYERDESC pLayerDesc;

/* pointer to a structure */

pVECTORLAYER pLayer;

/* pointer to a vector layer */

L_UINT32 dwFlags;

/* flags */

Adds a new empty layer to a vector handle.

This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.

Parameter

Description

pVector

Pointer to the vector handle.

pLayerDesc

Pointer to a VECTORLAYERDESC structure that contains the new layer settings.

pLayer

Pointer to a VECTORLAYER structure to be updated with the handle of the new layer.

dwFlags

Flag that indicates whether or not to rename duplicate layer names. Possible values are:

 

Value

Meaning

 

0

Don't rename duplicate layer names, if found.

 

VECTOR_FLAGS_RENAME_DUPLICATES

Renames duplicate layer names if found. The toolkit will add a suffix (0, 1, 2, etc) to the layer name if duplicated. Checking will be aborted when the suffix value reaches 999 and no unique name can be created.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

For more information on the layer settings, refer to the VECTORLAYERDESC structure.

To change layer settings, get the current layer settings by calling L_VecGetLayer, set the new settings in the VECTORLAYERDESC structure pointed to by pLayerDesc and then set the new layer settings by calling L_VecSetLayer.

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_VecDeleteLayer, L_VecGetLayer, L_VecSetLayer, L_VecGetLayerByName, L_VecGetLayerByIndex, L_VecCopyLayer, L_VecEmptyLayer, L_VecSetActiveLayer, L_VecGetActiveLayer, L_VecEmptyLayer, L_VecFreeLayer

Topics:

Working with Vector Layers

Example

This example will add a new layer to a vector handle.

L_INT VecAddLayerExample(pVECTORHANDLE pVector)
{
   L_INT nRet;
   VECTORLAYERDESC LayerDesc;
   VECTORLAYER Layer;

   LayerDesc.nSize = sizeof( VECTORLAYERDESC );
   lstrcpy( LayerDesc.szName, TEXT("My Layer"));
   LayerDesc.bVisible   = TRUE;
   LayerDesc.bLocked    = FALSE;
   LayerDesc.dwTag      = 0L;

   nRet = L_VecAddLayer( pVector, &LayerDesc, &Layer, VECTOR_FLAGS_RENAME_DUPLICATES );
   if( nRet != SUCCESS)
      MessageBox( NULL, TEXT("Could not add layer!"), NULL, MB_OK );

   return nRet;
}