L_LVKRN_API L_INT L_VecGetObject(pVector, pObject, nType, pObjectDesc)
Gets the object information of the specified vector object.
Pointer to a vector handle.
Pointer to a vector object.
Object type. Possible values are:
Value | Meaning |
---|---|
VECTOR_ARC | Arc. |
VECTOR_CHORD | Chord. |
VECTOR_CIRCLE | Circle. |
VECTOR_CLONE | Clone object of a vector group. |
VECTOR_ELLIPSE | Ellipse. |
VECTOR_ELLIPTICALARC | Elliptical arc. |
VECTOR_LINE | Line. |
VECTOR_PIE | Pie section. |
VECTOR_POLYBEZIER | Poly Bezier curve. |
VECTOR_POLYDRAW | Polydraw. |
VECTOR_POLYGON | Polygon. |
VECTOR_POLYLINE | Polyline. |
VECTOR_RASTER | Raster. |
VECTOR_RECTANGLE | Rectangle. |
VECTOR_TEXT | Text. |
VECTOR_VERTEX | 3D vertex in space. |
Pointer to a vector object structure to be updated with the object information of the specified object.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function is used to obtain information about a certain vector object.
If you set nType to VECTOR_OBJECT, the structure pointed to by pObjectDesc will be filled with the general VECTOROBJECT structure information common to all object types.
If you want specific information about an object, set the nType member to the requested object type and set pObjectDesc to the address of the appropriate vector object structure.
Once pObjectDesc is no longer needed, free any associated resources by calling L_VecFreeObject.
Required DLLs and Libraries
The first example will select the object under the current mouse cursor.
The second example gets and sets specific information about a VECTOR_RECTANGLE object.
The second example will check if the object under hit-test is a rectangle and then change its pen color to red.
L_LTVKRNTEX_API L_INT VecGetObjectExample1(
pVECTORHANDLE pVector,
const POINT* pptMouse)
{
VECTOROBJECT Object;
VECTOROBJECT ObjectDesc;
L_INT nRet;
/* Get the object under the mouse cursor */
nRet = L_VecHitTest( pVector, pptMouse, &Object );
if( nRet == SUCCESS )
{
/* Select this object */
nRet = L_VecGetObject( pVector, &Object, VECTOR_OBJECT, &ObjectDesc );
if(nRet != SUCCESS)
return nRet;
ObjectDesc.dwFlags |= VECTOR_OBJECT_SELECTED;
nRet = L_VecSetObject( pVector, &Object, VECTOR_OBJECT, &ObjectDesc );
if(nRet != SUCCESS)
return nRet;
/* Clean up */
nRet = L_VecFreeObject(VECTOR_OBJECT, &ObjectDesc );
}
return nRet;
}
L_LTVKRNTEX_API L_INT VecGetObjectExample2(
pVECTORHANDLE pVector,
const POINT* pptMouse)
{
VECTOROBJECT Object;
VECTORRECTANGLE Rectangle;
L_INT nRet;
/* get the object under ths mouse cursor */
nRet = L_VecHitTest( pVector, pptMouse, &Object );
/* make sure the object is a rectangle */
if( nRet == SUCCESS && Object.nType == VECTOR_RECTANGLE )
{
/* change its pen color to red */
nRet = L_VecGetObject( pVector, &Object, VECTOR_RECTANGLE, &Rectangle );
if(nRet != SUCCESS)
return nRet;
Rectangle.Pen.bExtPen = FALSE;
Rectangle.Pen.NewPen.LogPen.lopnColor = RGB( 0xFF, 0x00, 0x00 );
nRet = L_VecSetObject( pVector, &Object, VECTOR_RECTANGLE, &Rectangle );
if(nRet != SUCCESS)
return nRet;
/* clean up */
nRet = L_VecFreeObject( VECTOR_RECTANGLE, &Rectangle );
}
return nRet;
}