Vector groups can be used to group vector objects. A vector object is added to a group using object descriptor information. Therefore, once a vector object is added to a group. There is no relationship between the object in the group and the original object in the vector handle. The original object can be changed without affecting the corresponding object in the vector group, and vice versa.
Vector groups can also be cloned and added to a vector handle. However, if an object within a vector group is modified, all clones of that group will also be modified.
LEADTOOLS provides a number of functions for working with the vector groups within a vector handle. Several functions provide a means of obtaining information about vector groups, while other functions provide a means of actually modifying vector groups.
Getting Information about Vector Groups
A vector handle may contain multiple vector groups. The L_VecGetGroupCount returns the number of groups present in a vector handle. Once the number of groups present is known, each group can be obtained using L_VecGetGroupByIndex. If the name of a group is known, that group can be obtained using L_VecGetGroupByName. L_VecEnumGroups actually enumerates all the groups present in a vector handle. The VECTORENUMGROUPSPROC callback function used by L_VecEnumGroups lets you process each enumerated group.
Once a handle to a vector group is obtained, information about that vector group can be obtained using L_VecGetGroup. This vector group information can then be modified using L_VecSetGroup. L_VecGetGroup fills a VECTORGROUPDESC structure with the information about the specified vector group. The information within the VECTORGROUPDESC structure can then be modified and the vector group information updated using L_VecSetGroup. Once this VECTORGROUPDESC structure is no longer needed, it should be freed using L_VecFreeGroup.
Manipulating Vector Groups
LEADTOOLS provides a number of functions for manipulating vector groups. L_VecSetGroup lets you modify information about a specific vector group. For more information, refer to Getting Information About Vector Groups above, or the functions themselves.
L_VecEmptyGroup removes all vector objects from a vector group. L_VecDeleteGroup actually removes a vector group from a vector handle.
The contents of one group can be copied to another group using L_VecCopyGroup.
L_VecAddGroup lets you add a new group to a vector handle.
L_VecDeleteGroupClones lets you delete clones of the specified group, within a specific vector handle.
Vector groups can also be modified by modifying the objects within them. A new object can be added using the L_VecAddObjectToGroup function.
L_VecEnumObjectsInGroup lets you enumerate all the objects contained within a specified group. This function generates a call to the VECTORENUMOBJECTSPROC callback function for each object enumerated. This provides the means for processing each object within a group.