LEADTOOLS provides numerous functions for working with vector objects within vector layers. Several functions provide a means of obtaining information about vector objects, while other functions provide a means of actually modifying vector objects.
Getting Information About Vector Objects
A vector handle may contain multiple vector layers and each vector layer may contain many objects. LEADTOOLS provides a number of functions for obtaining information about one or more objects present in a vector handle or a vector layer. The information that can be obtained includes the number of objects present, the location of objects, the boundaries of one or more objects, etc.
L_VecEnumObjectsInLayer actually enumerates the vector objects within a specific vector layer. L_VecEnumObjects enumerates the objects present within an entire vector handle. Both L_VecEnumObjects and L_VecEnumObjectsInLayer use the VECTORENUMOBJECTSPROC callback function. This callback function lets you process each enumerated vector object.
Once a handle to a vector object is obtained, information about that vector object can be obtained using L_VecGetObject. This object information can then be modified using L_VecSetObject. L_VecGetObject fills a vector object structure with information about the specified vector object. The information within the structure can then be modified and the vector object information updated using L_VecSetObject. Once the information in the vector object structure is no longer needed, L_VecFreeObject should be called.
Object information can also be retrieved and set using L_VecGetObjectAttributes and L_VecSetObjectAttributes. These functions provide a means of getting and setting object information without having to get an object descriptor, inspect the object type, set new attributes and then free the object descriptor.
Several functions provide information on the location and boundaries of one or more vector objects. L_VecGetObjectParallelogram and L_VecGetObjectRect determine the bounding parallelogram and bounding rectangle for one or more vector objects in a vector handle. L_VecIsObjectInsideParallelogram and L_VecIsObjectInsideRect determine whether the specified object(s) is(are) within the specified parallelogram and rectangle. L_VecHitTest determines which object, if any, in a vector handle is present at a specified point. The options that control the hit test procedure can be obtained and modified using L_VecGetHitTest and L_VecSetHitTest.
L_VecIsObjectSelected determines whether or not an object is currently selected.
To determine whether or not a specific object is hidden, call L_VecIsObjectHidden.
Manipulating Vector Objects
LEADTOOLS provides many functions for manipulating vector objects. L_VecSetObject lets you modify vector object information. For more information, refer to Getting Information About Vector Objects above, or the L_VecSetObject function.
Vector objects can be modified by scaling, rotation and translation. LEADTOOLS provides L_VecGetRotation, L_VecGetScale and L_VecGetTranslation to obtain the current rotation, scaling and translation values. One or more vector objects may be modified by setting new values using L_VecSetRotation, L_VecSetScale and L_VecSetTranslation. Once the rotation, scale or translation values have been set, calling the L_VecApplyTransformation function will apply the current transformation to the vector image. The vector image objects will be changed.
Occasionally, vector objects will share vertices. When a vector object is modified, the object with which it shares one or more vertices may or may not be modified, depending on the "bind vertices mode" value. L_VecGetBindVerticesMode gets the current setting for the bind vertices mode. L_VecSetBindVerticesMode lets you change the "bind vertice mode" setting.
Some vector objects can be exploded into simpler vector objects using L_VecExplodeObject.
L_VecDeleteObject deletes the specified vector object(s).
L_VecSelectObject selects or unselects the specified vector object.
A vector object can be copied within the same layer, from one layer to another layer within the same vector handle, or from a layer in one vector handle to a layer in another vector handle using L_VecCopyObject.
An object can be hidden by calling the L_VecHideObject with the bHide parameter set to TRUE. A hidden object may be shown by calling the same function with bHide set to FALSE. To determine whether or not an object is hidden, use the L_VecIsObjectHidden function.
A vector object may contain a description string giving you some information about the object itself. To get the description for a vector object, call L_VecGetObjectDescription. To set or change the object description, use the L_VecSetObjectDescription function.
A vector object may also have a tool tip associated with it. For more information on tooltips, refer to Working with Tooltips.
In addition, vector objects may also be hyperlinked. For more information about hyperlinking vector objects, refer to Hyperlink Objects.
How an object is displayed may be affected by its view context. For more information on this, refer to Working with View Context.