L_VecCopyLayer

#include "lvkrn.h"

L_LVKRN_API L_INT L_VecCopyLayer(pVectorDst, pLayerDst, pVectorSrc, pLayerSrc, dwFlags)

pVECTORHANDLE pVectorDst;

/* pointer to a vector handle */

const pVECTORLAYER pLayerDst;

/* pointer to a layer */

const pVECTORHANDLE pVectorSrc;

/* pointer to a vector handle */

const pVECTORLAYER pLayerSrc;

/* pointer to a vector layer */

L_UINT32 dwFlags;

/* copy flags */

Copies the contents of one layer to another. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.

Parameter

Description

pVectorDst

Pointer to the destination vector handle.

pLayerDst

Pointer to a VECTORLAYER structure that references the destination layer.

pVectorSrc

Pointer to the source vector handle.

pLayerSrc

Pointer to a VECTORLAYER structure that references the source layer.

dwFlags

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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The destination layer can be in the same vector handle as the source layer, or it can be in a different 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_VecAddLayer, L_VecGetLayer, L_VecGetLayerByName, L_VecGetLayerByIndex

Topics:

Working with Vector Layers

Example

This example will copy the layer with the given name from the source vector to the destination vector.

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