LVectorBase::AddLayer

#include "ltwrappr.h"

virtual L_INT LVectorBase::AddLayer(pVectorLayer, dwFlags=VECTOR_FLAGS_RENAME_DUPLICATE_LAYERS);

LVectorLayer * pVectorLayer;

/* pointer to a vector layer object */

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

pVectorLayer

Pointer to an LVectorLayer object that specifies the layer settings.

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

To add a new vector layer, do the following:

1.

Declare an LVectorLayer object.

2.

Call LVectorLayer::GetLayerDesc to retrieve the current layer settings.

3.

Change the layer settings.

4.

Call LVectorLayer::SetLayerDesc to set the changed layer settings.

5.

Pass the address of the LVectorLayer object to LVectorBase::AddLayer.

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:

LVectorLayer::DeleteLayer, LVectorBase::GetLayerByName, LVectorBase::GetLayerByIndex, LVectorBase::CopyLayer, LVectorLayer::EmptyLayer, LVectorBase::SetActiveLayer, LVectorBase::GetActiveLayer

Topics:

Working with Vector Layers

Example

// This example will add a new layer to a vector handle. 
L_VOID Example68(HWND hWnd, LVectorBase *pVector)
{
   LVectorLayer VectorLayer;
   VECTORLAYERDESC LayerDesc;
   
   VectorLayer.GetLayerDesc(&LayerDesc);
   lstrcpy(LayerDesc.szName, TEXT("Terry's New Layer"));
   VectorLayer.SetLayerDesc(&LayerDesc);
   
   if (SUCCESS != pVector->AddLayer(&VectorLayer, VECTOR_FLAGS_RENAME_DUPLICATES))
   {
      MessageBox( NULL, TEXT("Could not add layer!"), TEXT(""), MB_OK );
   }

   //...LVectorLayer destructor called when VectorLayer goes out of scope
}