L_VecGetObject

#include "lvkrn.h"

L_LVKRN_API L_INT 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 * 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_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

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_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_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; 
} 

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