LNITFFile::GetTextHeader

#include "ltwrappr.h"

L_INT LNITFFile::GetTextHeader(uIndex, pTxtHeader)

L_UINT uIndex;

/* index of the text segment */

pTXTHEADER pTxtHeader;

/* pointer to a TXTHEADER structure */

Retrieves the text header information of a specific text segment.

Parameter

Description

uIndex

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

pTxtHeader

Pointer to a TXTHEADER structure to be updated with the text header information of the specified text 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 text segments available in the NITF file, call the LNITFFile::GetTextHeaderCount function.

To change the text header information for a specific text segment, call the LNITFFile::SetTextHeader 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::GetGraphicHeader, LNITFFile::SetGraphicHeader, LNITFFile::GetImageHeaderCount, LNITFFile::GetImageHeader, LNITFFile::SetImageHeader, LNITFFile::GetTextHeaderCount, LNITFFile::SetTextHeader.

Topics:

NITF Functions: Getting and Setting Header Information.

 

Programming with LEADTOOLS NITF Functions.

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LNITFFile_GetTextHeaderExample()
{
   WRPUNLOCKSUPPORT();
   //Parse the NITF file
   LNITFFile Nitf; 
   Nitf.Create (MAKE_IMAGE_PATH(TEXT("test.ntf")));
   L_UINT uFlags = 0; 
   TXTHEADER TextHeader; 
   L_UINT uCount; 
   L_UINT i = 0; 
   memset(&TextHeader, 0, sizeof(TXTHEADER)); 
   // Check if the NITF 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.GetTextHeaderCount ();
   for( i = 0; i < uCount; ++i) 
   {
      if(Nitf.GetTextHeader(i, &TextHeader) == SUCCESS) 
      {
         TextHeader.pTXTITL = "LEAD Technologies, Inc";
         Nitf.SetTextHeader (i, &TextHeader); 
         Nitf.FreeTextHeader(&TextHeader);
      }
   }
   Nitf.SaveFile (MAKE_IMAGE_PATH(TEXT("test1.ntf")));
   Nitf.Destroy ();
   return SUCCESS;
}