L_NITFGetGraphicHeader

#include "ltntf.h"

L_LTNTF_API L_INT L_NITFGetGraphicHeader(hNitf, uIndex, pGraphicHeader)

Retrieves the graphic header information of a specific graphic segment.

Parameters

HNITF hNitf

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

L_UINT uIndex

A zero-based index of the graphic segment in the hNitf handle.

pGRAPHICHEADER pGraphicHeader

Pointer to a GRAPHICHEADER structure to be updated with the graphic header information of the specified graphic segment at the index uIndex.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

To retrieve the number of the graphic segments available in the hNitf handle, call the L_NITFGetGraphicHeaderCount function.

To change the graphic header information for a specific graphic segment, call the L_NITFSetGraphicHeader function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT NITFGetGraphicHeaderExample(L_VOID) 
{ 
   HNITF hNitf; 
   L_UINT uFlags = 0; 
   GRAPHICHEADER GraphicHeader; 
   L_UINT uCount; 
   L_UINT i = 0; 
   L_INT nRet; 
 
   memset(&GraphicHeader, 0, sizeof(GRAPHICHEADER)); 
 
   // 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 graphic header 
   uCount = L_NITFGetGraphicHeaderCount(hNitf); 
   for( i = 0; i < uCount; ++i) 
   { 
       memset(&GraphicHeader, 0, sizeof(GraphicHeader)); 
      nRet = L_NITFGetGraphicHeader(hNitf, i, &GraphicHeader) ; 
       if(nRet == SUCCESS) 
      { 
         GraphicHeader.nSBND1Row = 20; 
         GraphicHeader.nSBND1Col = 50; 
         GraphicHeader.nSBND2Row = 200; 
         GraphicHeader.nSBND2Col = 400; 
 
         nRet =L_NITFSetGraphicHeader(hNitf, i, &GraphicHeader); 
         if(nRet !=SUCCESS) 
            return nRet; 
 
         L_NITFFreeGraphicHeader(&GraphicHeader); 
      } 
       else 
          return nRet; 
   } 
 
   nRet =L_NITFDestroy(&hNitf); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.