L_VecAddObjectToGroup

#include "lvkrn.h"

L_INT EXT_FUNCTION 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 L_FAR * 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_STOCK

Stock object from a stock library.

 

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 )
{
   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 */
   {
      L_VecGetObject( pVector, pObject, pObject->nType, pBuffer );
      pGroup = (pVECTORGROUP) pUserData;
      L_VecAddObjectToGroup ( pVector, pGroup, pObject->nType, pBuffer, NULL );
      L_VecFreeObject( pObject->nType, pBuffer );
   }

   return SUCCESS;
}

L_VOID CreateGroup( pVECTORHANDLE pVector, const L_TCHAR *pszName )
{
   VECTORGROUPDESC GroupDesc;
   VECTORGROUP Group;

   /* Add a new empty group */
   memset( &GroupDesc, 0, sizeof( GroupDesc ) );
   GroupDesc.nSize = sizeof( GroupDesc );
   lstrcpy( GroupDesc.szName, pszName );
   L_VecAddGroup( pVector, &GroupDesc, &Group, 0L );

   /* Add all selected objects into this group */
   L_VecEnumObjects(pVector, MyEnumObjectsProc, &Group, VECTOR_FLAGS_SELECTED_ONLY);
}