Copies the contents of one layer to another. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.
#include "ltvkrn.h"
L_LVKRN_API L_INT L_VecCopyLayer(pVectorDst, pLayerDst, pVectorSrc, pLayerSrc, dwFlags)
Pointer to the destination vector handle.
Pointer to a VECTORLAYER structure that references the destination layer.
Pointer to the source vector handle.
Pointer to a VECTORLAYER structure that references the source layer.
Flag that indicates whether or not to empty the destination layer before copying. Possible values are:
Value | Meaning |
---|---|
0 | Do not empty the destination layer before copying. |
VECTOR_FLAGS_REPLACE | Empty the destination layer before copying. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
The destination layer can be in the same vector handle as the source layer, or it can be in a different vector handle.
This example will copy the layer with the given name from the source vector to the destination vector.
L_LTVKRNTEX_API L_INT VecCopyLayerExample(
pVECTORHANDLE pVectorDst,
pVECTORHANDLE pVectorSrc,
L_TCHAR* pszName)
{
VECTORLAYER LayerSrc, LayerDst;
VECTORLAYERDESC LayerDesc;
L_INT nRet;
/* Get the layer with the given name */
nRet = L_VecGetLayerByName( pVectorSrc, pszName, &LayerSrc );
if( nRet == SUCCESS )
{
/* get the layer properties */
nRet = L_VecGetLayer( pVectorSrc, &LayerSrc, &LayerDesc );
if(nRet != SUCCESS)
return nRet;
/* add to the destination vector */
nRet = L_VecAddLayer( pVectorDst, &LayerDesc, &LayerDst, VECTOR_FLAGS_RENAME_DUPLICATES);
if(nRet != SUCCESS)
return nRet;
/* no need for the layer properties anymore */
nRet = L_VecFreeLayer( &LayerDesc );
if(nRet != SUCCESS)
return nRet;
/* copy content of source layer into destination */
nRet = L_VecCopyLayer( pVectorDst, &LayerDst, pVectorSrc, &LayerSrc, 0L );
}
return nRet;
}