LNITFFile::GetGraphicHeader

#include "ltwrappr.h"

L_INT LNITFFile::GetGraphicHeader(uIndex, pGraphicHeader)

L_UINT uIndex;

/* index of the graphics data */

pGRAPHICHEADER pGraphicHeader;

/* pointer to a GRAPHICHEADER structure */

Retrieves the graphic header information of a specific graphic segment. This function is available in the Document Toolkit.

Parameter

Description

uIndex

A zero-based index of the graphic segment in the NITF file.

pGraphicHeader

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

Returns

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 NITF file, call the LNITFFile::GetGraphicHeaderCount function.

To change the graphic header information for a specific graphic segment, call the LNITFFile::SetGraphicHeader 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:

LNITFFile::Create, LNITFFile::Destroy, LNITFFile::GetStatus, LNITFFile::SaveFile, LNITFFile::AppendImageSegment, LNITFFile::AppendGraphicSegment, LNITFFile::AppendTextSegment, LNITFFile::SetVector, LNITFFile::GetVector, LNITFFile::GetNITFHeader, LNITFFile::SetNITFHeader, LNITFFile::GetGraphicHeaderCount, LNITFFile::SetGraphicHeader, LNITFFile::GetImageHeaderCount, LNITFFile::GetImageHeader, LNITFFile::SetImageHeader, LNITFFile::GetTextHeaderCount, LNITFFile::GetTextHeader, LNITFFile::SetTextHeader.

Topics:

NITF Functions: Getting and Setting Header Information.

 

Programming with LEADTOOLS NITF Functions.

Example

L_INT LNITFFile_GetGraphicHeaderExample()
{
   WRPUNLOCKSUPPORT();
   // Create hNitf handle and parse the NITF file
   LNITFFile Nitf; 
   Nitf.Create (TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\test.ntf"));
   L_UINT uFlags = 0; 
   GRAPHICHEADER GraphicHeader; 
   L_UINT uCount; 
   L_UINT i = 0; 
   memset(&GraphicHeader, 0, sizeof(GRAPHICHEADER)); 
   // Check if the NITF file is empty or invalid
   uFlags = Nitf.GetStatus ();
   if((uFlags & NITF_FILE_EMPTY) == NITF_FILE_EMPTY) 
   {
      MessageBox(NULL, TEXT("NITF file is empty"), 0, 0);
      return SUCCESS; 
   }
   if((uFlags & NITF_FILE_VALID) != NITF_FILE_VALID) 
   {
      MessageBox(NULL, TEXT("NITF file is invalid"), 0, 0);
      return SUCCESS; 
   }
   // Update the graphic header
   uCount = Nitf.GetGraphicHeaderCount ();
   for( i = 0; i < uCount; ++i) 
   {
      if(Nitf.GetGraphicHeader(i, &GraphicHeader) == SUCCESS) 
      {
         GraphicHeader.nSBND1Row = 20; 
         GraphicHeader.nSBND1Col = 50; 
         GraphicHeader.nSBND2Row = 200; 
         GraphicHeader.nSBND2Col = 400; 
         Nitf.SetGraphicHeader (i, &GraphicHeader); 
         Nitf.FreeGraphicHeader(&GraphicHeader);
      }
    }
   Nitf.SaveFile (TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\test1.ntf"));
   Nitf.Destroy ();
   return SUCCESS;
}