Sets the handle for the graphic data in the graphic segment in the NITF file at a specified index.
#include "ltntf.h"
L_LTNTF_API L_INT L_NITFSetVectorHandle(hNitf, uIndex, pVector)
Handle to an existing NITF file, created by calling the L_NITFCreate function.
A zero-based index of the graphic segment in the hNitf handle to be set with the vector handle pointed to by 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.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
To get the handle for the graphics data at specified index in the graphic segment, call L_NITFGetVectorHandle function.
L_INT NITFSetVectorHandleExample(L_VOID)
{
HNITF hNitf;
L_UINT uFlags = 0;
VECTORHANDLE VectorHandle;
L_INT nRet;
// Create hNitf handle and parse the NITF file
nRet =L_NITFCreate (&hNitf, MAKE_IMAGE_PATH(TEXT("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(MAKE_IMAGE_PATH(TEXT("city.cgm")), &VectorHandle, NULL, NULL) == SUCCESS)
{
nRet =L_NITFSetVectorHandle(hNitf, 0, &VectorHandle);
if(nRet !=SUCCESS)
return nRet;
}
nRet =L_NITFSaveFile(hNitf, MAKE_IMAGE_PATH(TEXT("test2.ntf")));
if(nRet !=SUCCESS)
return nRet;
nRet =L_NITFDestroy(&hNitf);
if(nRet !=SUCCESS)
return nRet;
return SUCCESS;
}