LVectorBase::AddGroup

#include "ltwrappr.h"

virtual L_INT LVectorBase::AddGroup(pVectorGroup, dwFlags = VECTOR_FLAGS_RENAME_DUPLICATES)

LVectorGroup *pVectorGroup;

/* pointer to a vector group object */

L_UINT32 dwFlags;

/* flags */

Adds a new empty group to a vector handle.

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

Parameter

Description

pVectorGroup

Pointer to the vector group object that specifies the group settings.

dwFlags

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

 

Value

Meaning

 

0

Don't rename duplicate group names, if found.

 

VECTOR_FLAGS_RENAME_DUPLICATES

Renames duplicate group names if found. The toolkit will add a suffix (0, 1, 2, etc) to the group 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 group, do the following:

1.

Declare an LVectorGroupobject.

2.

Call LVectorGroup::GetGroupDesc to retrieve the current group settings.

3.

Change the group settings.

4.

Call LVectorGroup::SetGroupDesc to set the changed group settings.

5.

Pass the address of the LVectorGroup object to LVectorBase::AddGroup.

Required DLLs and Libraries

LVKRN
LVDLG
LTFIL

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:

LVectorGroup::DeleteGroup, LVectorGroup::GetGroupDesc, LVectorGroup::SetGroupDesc, LVectorBase::GetGroupByName, LVectorBase::GetGroupByIndex, LVectorBase::CopyGroup, LVectorGroup::EmptyGroup, LVectorGroup::DeleteGroupClones

Topics:

Working with Vector Groups

Example

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

L_INT LVectorBase__AddGroupExample(HWND hWnd, LVectorBase *pVector)
{
   UNREFERENCED_PARAMETER(hWnd);
   L_INT             nRet;
   LVectorGroup      VectorGroup;
   VECTORGROUPDESC   GroupDesc;
   nRet = VectorGroup.GetGroupDesc(&GroupDesc);
   if(nRet != SUCCESS)
      return nRet;
   lstrcpy(GroupDesc.szName, TEXT("My New Group"));
   nRet = VectorGroup.SetGroupDesc(&GroupDesc);
   if(nRet != SUCCESS)
      return nRet;
   nRet = pVector->AddGroup(&VectorGroup, VECTOR_FLAGS_RENAME_DUPLICATES);
   if(nRet != SUCCESS)
   {
      MessageBox( NULL, TEXT("Could not add group!"), TEXT(""), MB_OK );
      return nRet;
   }
   //...LVectorGroup destructor called when VectorGroup goes out of scope
   return SUCCESS;
}