L_VecAddObjectToGroup

Summary

Adds a new object to a vector group. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.

Syntax

#include "ltvkrn.h"

L_LVKRN_API L_INT L_VecAddObjectToGroup(pVector, pGroup, nType, pObjectDesc, pNewObject)

Parameters

pVECTORHANDLE pVector

Pointer to the destination vector handle.

const pVECTORGROUP pGroup

Pointer to the destination vector group.

L_INT nType

Type of object to add. Possible values are:

Value Meaning
VECTOR_ARC Arc.
VECTOR_CHORD Chord.
VECTOR_CIRCLE Circle.
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.

const L_VOID * pObjectDesc

Pointer to a vector object that contains information about the object to add.

pVECTOROBJECT pNewObject

Pointer to a VECTOROBJECT structure that references the newly added object.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

If pNewObject is NULL, this pointer will not be updated with the address of the newly added object.

You may need to cast from your given object type (VECTORPOLYGON, VECTORTEXT, etc) when using this function. (See the example below.)

You cannot add a VECTOR_CLONE to a vector group.

Required DLLs and Libraries

See Also

Functions

Topics

Example

This example will create a new vector group with the given name that contains all currently selected objects inside a vector handle.

L_INT EXT_CALLBACK MyEnumObjectsProc( 
   pVECTORHANDLE pVector, 
   const pVECTOROBJECT pObject, 
   L_VOID* pUserData ) 
{ 
   L_INT nRet; 
   pVECTORGROUP pGroup; 
   L_TCHAR pBuffer[ VECTOR_OBJECT_BUFFER_SIZE ]; 
 
   /* Add all objects into this group */ 
   if( pObject->nType != VECTOR_CLONE )  /* should not be a VECTOR_CLONE */ 
   { 
      nRet = L_VecGetObject( pVector, pObject, pObject->nType, pBuffer ); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      pGroup = (pVECTORGROUP) pUserData; 
      nRet = L_VecAddObjectToGroup ( pVector, pGroup, pObject->nType, pBuffer, NULL ); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      nRet = L_VecFreeObject( pObject->nType, pBuffer ); 
      if(nRet != SUCCESS) 
         return nRet; 
   } 
   return SUCCESS; 
} 
 
L_LTVKRNTEX_API L_INT VecAddObjectToGroupCBExample( 
   pVECTORHANDLE pVector, 
   const L_TCHAR *pszName) 
{ 
   L_INT nRet; 
   VECTORGROUPDESC GroupDesc; 
   VECTORGROUP Group; 
 
   /* Add a new empty group */ 
   memset( &GroupDesc, 0, sizeof( GroupDesc ) ); 
   GroupDesc.nSize = sizeof( GroupDesc ); 
   lstrcpy( GroupDesc.szName, pszName ); 
   nRet = L_VecAddGroup( pVector, &GroupDesc, &Group, 0L ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Add all selected objects into this group */ 
   nRet = L_VecEnumObjects(pVector, MyEnumObjectsProc, &Group, VECTOR_FLAGS_SELECTED_ONLY); 
 
   return nRet; 
} 

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

LEADTOOLS Vector C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.