Working with Vector Objects

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.

LVectorLayer::EnumObjects actually enumerates the vector objects within the LVectorLayer class object's vector layer. LVectorBase::EnumObjects enumerates the objects present within an entire vector handle. The LVectorBase::EnumObjects function uses the LVectorBase::EnumObjectsCallBack function and LVectorLayer::EnumObjects uses the LVectorLayer::EnumObjectsCallBack function. These callback functions let you process each enumerated vector object.

Once a handle to a vector object is obtained, information about that vector object can be obtained using LVectorObject::LockObject. This object information can then be modified using LVectorObject::UnlockObject. LVectorObject::LockObject 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 LVectorObject::UnlockObject.

LVectorBase::EnumVertices enumerates the vertices of objects within a vector handle. The LVectorBase::EnumVerticesCallBack function lets you process each enumerated vertex.

Several functions provide information on the location and boundaries of one or more vector objects. LVectorObject::GetObjectParallelogram and LVectorObject::GetObjectRect determine the bounding parallelogram and bounding rectangle for class object's vector object. LVectorBase::IsObjectInsideParallelogram and LVectorBase::IsObjectInsideRect determine whether the specified object(s) is(are) within the specified parallelogram and rectangle. LVectorObject::IsObjectInsideParallelogram and LVectorObject::IsObjectInsideRect determine whether the class object's vector object is within the specified parallelogram or rectangle. LVectorBase::HitTest 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 LVectorBase::GetHitTest and LVectorBase::SetHitTest.

LVectorObject::IsObjectSelected determines whether or not an object is currently selected. To select a class object's vector object, use LVectorObject::SelectObject.

To determine whether or not a specific object is hidden, call LVectorObject::IsObjectHidden

Manipulating Vector Objects

LEADTOOLS provides many functions for manipulating vector objects. LVectorObject::UnlockObject lets you modify vector object information. For more information, refer to Getting Information About Vector Objects above, or the LVectorObject::UnlockObject function.

Vector objects can be modified by scaling, rotation and translation. To accomplish this, LEADTOOLS provides LVectorObject::SetRotation, LVectorObject::SetScale and LVectorObject::SetTranslation.

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. LVectorBase::GetBindVerticesMode gets the current setting for the bind vertices mode. LVectorBase::SetBindVerticesMode lets you change the "bind vertices mode" setting.

To get and set certain attributes associated with vector objects, such as pen style, pen color, brush color, brush hatch, etc., use LVectorObject::GetObjectAttributes, LVectorObject::SetObjectAttributes and LVectorBase::SetObjectAttributes.

LEADTOOLS provides several vector object classes that are derived from the LVectorObject class. Each of these classes, supports constructors, destructors and both lock and unlock functions for getting and setting object information. These derived classes include:

LVectorArc

LVectorLine

LVectorRaster

LVectorChord

LVectorPie

LVectorRectangle

LVectorCircle

LVectorPolyBezier

LVectorText

LVectorClone

LVectorPolyDraw

LVectorVertex

LVectorEllipse

LVectorPolygon

LVectorSpline

LVectorEllipticalArc

LVectorPolyLine

LVectorHPolyBezier

Some vector objects can be exploded into simpler vector objects using LVectorObject::ExplodeObject. LVectorBase::ExplodeObject can be used to explode all or part of a vector image.

To determine whether an LVectorObject class object is valid, call LVectorObject::IsValid.

LVectorObject::DeleteObject , LVectorBase::DeleteObject let you delete vector objects.

To determine the type of an LVectorObject class object, call LVectorObject::GetType.

LVectorObject::SelectObject selects or unselects the class object's 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 LVectorBase::CopyObject.

An object can be hidden by calling the LVectorObject::HideObject 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 LVectorObject::IsObjectHidden function.

LVectorLayer::AddObject lets you add a new vector object to a vector layer.

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 LVectorObject::GetDescription. To set or change the object description, use the LVectorObject::SetDescription 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.

Create your own objects using the LVectorStock class object.

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Vector C++ Class Library Help