L_NITFSetVectorHandle

#include "ltntf.h"

L_LTNTF_API L_INT L_NITFSetVectorHandle(hNitf, uIndex, pVector)

HNITF hNitf;

/* handle to an existing NITF file */

L_UINT32 uIndex;

/* index of the graphic segment */

 pVECTORHANDLE pVector;

/* pointer to a vector handle */

Sets the handle for the graphic data in the graphic segment in the NITF file at a specified index.

Parameter

Description

hNitf

Handle to an existing NITF file, created by calling the L_NITFCreate function.

uIndex

A zero-based index of the graphic segment in the hNitf handle to be set with the vector handle pointed to by pVector.

pVector

Pointer to a vector handle references the graphic data to set in the graphic segment in the NITF file at the specified index uIndex.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To get the handle for the graphics data at specified index in the graphic segment, call L_NITFGetVectorHandle function.

Required DLLs and Libraries

LTNTF

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_NITFCreate, L_NITFGetVectorHandle

Topics:

NITF Functions: Getting and Setting Graphic Data

 

Programming with LEADTOOLS NITF Functions

Example

L_LTNTFTEX_API L_INT NITFSetVectorHandleExample(L_VOID)
{
   HNITF hNitf;
   L_UINT uFlags = 0;
   VECTORHANDLE VectorHandle;
   L_INT nRet;
    
   L_UnlockSupport(L_SUPPORT_VECTOR, L_KEY_VECTOR);
   // Create hNitf handle and parse the NITF file
   nRet =L_NITFCreate (&hNitf, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\test.ntf"));
   if(nRet !=SUCCESS)
      return nRet;
   // Check if the hNITF is empty or invalid
   uFlags = L_NITFGetStatus(hNitf);
   if((uFlags & NITF_FILE_EMPTY) == NITF_FILE_EMPTY)
   {
      MessageBox(NULL,TEXT("NITF File is Empty"),NULL,MB_OK);
      return FAILURE;
   }
   if((uFlags & NITF_FILE_VALID) != NITF_FILE_VALID)
   {
      MessageBox(NULL,TEXT("NITF File is Invalid"),NULL,MB_OK);
      return FAILURE;
   }
   // Update the first graphic segment with new Graphic data
   if(L_NITFGetGraphicHeaderCount(hNitf) > 0)
      if(L_VecLoadFile(TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\city.cgm"), &VectorHandle, NULL, NULL) == SUCCESS)
      {   
         nRet =L_NITFSetVectorHandle(hNitf, 0, &VectorHandle);
         if(nRet !=SUCCESS)
            return nRet;
      }
   nRet =L_NITFSaveFile(hNitf, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\test2.ntf"));
   if(nRet !=SUCCESS)
      return nRet;
   nRet =L_NITFDestroy(&hNitf);
   if(nRet !=SUCCESS)
      return nRet;
   
   return SUCCESS;
}