LEADTOOLS Vector C++ Class Library Help > LEADTOOLS Vector Features > Vector Groups > Working with Vector Groups |
Vector groups can be used to group vector objects. 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 an LVectorBase object. 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
An LVectorBase object may contain multiple vector groups. The LVectorBase::GetGroupCount returns the number of groups present in the class object's associated vector handle. Once the number of groups present is known, each group can be obtained using LVectorBase::GetGroupByIndex. If the name of a group is known, that group can be obtained using LVectorBase::GetGroupByName. LVectorBase::EnumGroups actually enumerates all the groups present in a vector handle. The LVectorBase::EnumGroupsCallBack function, called by LVectorBase::EnumGroups, lets you process each enumerated group.
Information about that vector group can be obtained using LVectorGroup::GetGroupDesc. This vector group information can then be modified using LVectorGroup::SetGroupDesc. LVectorGroup::GetGroupDesc fills a VECTORGROUPDESCstructure with the information about the class object's vector group. The information within the VECTORGROUPDESC structure can then be modified and the vector group information updated using LVectorGroup::SetGroupDesc.
A vector group may contain numerous vector objects. To enumerate the objects within a vector group, use the LVectorGroup::EnumObjects function. This function calls the LVectorGroup::EnumObjectsCallBack function for each object enumerated
Manipulating Vector Groups
LEADTOOLS provides a number of functions for manipulating vector groups. LVectorGroup::SetGroupDesc let you modify information about a specific vector group. For more information, refer to "Getting Information About Vector Groups" above, or the functions themselves.
LVectorGroup::EmptyGroup removes all vector objects from a vector group. LVectorGroup::DeleteGroup actually removes a vector group from a vector handle. LVectorGroup::DeleteGroupClones deletes all of the clones of the LVectorGroup object.
The contents of one group can be copied to another group using LVectorBase::CopyGroup.
LVectorBase::AddGroup lets you add a new group to a vector handle. In addition, LEADTOOLS provides several functions for bringing up dialogs for adding or editing groups. These functions are LVectorDialog::DoModalVectorEditAllGroups, LVectorDialog::DoModalVectorEditGroup and LVectorDialog::DoModalVectorNewGroup.
To add an object to a vector group use the LVectorGroup::AddObject function.