L_VecAddObjectToGroup

#include "lvkrn.h"

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

pVECTORHANDLE pVector;

pointer to a vector handle

const pVECTORGROUP pGroup;

pointer to a vector group

L_INT nType;

object type

const L_VOID * pObjectDesc;

pointer to a vector object

pVECTOROBJECT pNewObject;

pointer to the new vector object

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

Parameter Description
pVector Pointer to the destination vector handle.
pGroup Pointer to the destination vector group.
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.
pObjectDesc Pointer to a vector object that contains information about the object to add.
pNewObject Pointer to a VECTOROBJECT structure that references the newly added object..

Returns

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

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_VecInitObject, L_VecAddObject

Topics:

Working with Vector Objects

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_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 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Vector C API Help