L_VecGetObject

#include "ltvkrn.h"

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

Gets the object information of the specified vector object.

Parameters

const pVECTORHANDLE pVector

Pointer to a vector handle.

const pVECTOROBJECT pObject

Pointer to a vector object.

L_INT 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.

L_VOID * pObjectDesc

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

Returns

Value Meaning
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

See Also

Functions

Topics

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

Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C API Help