L_VecGetObject

#include "lvkrn.h"

L_INT EXT_FUNCTION L_VecGetObject(pVector, pObject, nType, pObjectDesc)

const pVECTORHANDLE pVector;

/* pointer to a vector handle */

const pVECTOROBJECT pObject;

/* pointer to a vector object */

L_INT nType;

/* object type to get */

L_VOID L_FAR * pObjectDesc;

/* pointer to a vector object structure */

Gets the object information of the specified vector object.

Parameter

Description

pVector

Pointer to a vector handle.

pObject

Pointer to a vector object.

nType

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_STOCK

Stock object from a stock library.

 

VECTOR_TEXT

Text.

 

VECTOR_VERTEX

3D vertex in space.

pObjectDesc

Pointer to a vector object structure to be updated with the object information of the specified object.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

LVKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_VecSetObject

Topics:

Working with Vector Objects

Example

/* This example will select the object under the current mouse cursor */

L_VOID SelectMyObject( 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 */
      L_VecGetObject( pVector, &Object, VECTOR_OBJECT, &ObjectDesc );
      ObjectDesc.dwFlags |= VECTOR_OBJECT_SELECTED;
      L_VecSetObject( pVector, &Object, VECTOR_OBJECT, &ObjectDesc );
      
      /* Clean up */
      L_VecFreeObject(VECTOR_OBJECT, &ObjectDesc );
   }
}

/* The following example gets and sets specific information about a VECTOR_RECTANGLE object. */
/* this example will check if the object under hit-test is a rectangle and then change its pen color to red */
L_VOID ChangeRectPen( 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 */
      L_VecGetObject( pVector, &Object, VECTOR_RECTANGLE, &Rectangle );
      Rectangle.Pen.bExtPen = FALSE;
      Rectangle.Pen.NewPen.LogPen.lopnColor = RGB( 0xFF, 0x00, 0x00 );
      L_VecSetObject( pVector, &Object, VECTOR_RECTANGLE, &Rectangle );

      /* clean up */
      L_VecFreeObject( VECTOR_RECTANGLE, &Rectangle );
   }
}