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

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
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; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS NITF C API Help