LNITFFile::Create

#include "ltwrappr.h"

L_INT LNITFFile::Create(pszFileName)

L_INT LNITFFile::Create()

L_TCHAR * pszFileName;

/* file name */

Creates an empty NITF file or parses an existing NITF file.

Parameter

Description

pszFileName

Character string that contains the name of the NITF file to be parsed.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The LNITFFile::Create must be called before calling any other LNITFFile::XXX functions.

To create an empty NITF file, pass the pszFileName parameter as NULL.

To parse an existing NITF file, pass a valid file name to the pszFileName parameter.

To save the created NITF file, call the LNITFFile::SaveFile function.

When the class object is no longer needed, call the LNITFFile::Destroy function. For every call to LNITFFile::Create there must be a call to LNITFFile::Destroy.

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::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::GetTextHeader, LNITFFile::SetTextHeader.

Topics:

NITF Functions: General Functionality.

 

Programming with LEADTOOLS NITF Functions.

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LNITFFile_CreateExample()
{
// This example will create an empty NITF file and add image, graphic and text segments
   LVectorBase Vector; 
   LBitmapBase Bitmap; 
   LNITFFile Nitf; 
   WRPUNLOCKSUPPORT();
   Nitf.Create();
   // Load and append Image segment
   if(Bitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP"))) == SUCCESS) 
      Nitf.AppendImageSegment (&Bitmap, FILE_JPEG, 24, 2); 
   // Load and append graphic segment
   RECT rcViewPort;
   SetRect(&rcViewPort, 0, 0, 640, 480);
   if(Vector.Load(MAKE_IMAGE_PATH(TEXT("random.dxf"))) == SUCCESS) 
      Nitf.AppendGraphicSegment (&Vector, &rcViewPort);
   // Append Text segment
   Nitf.AppendTextSegment (MAKE_IMAGE_PATH(TEXT("test.txt")));
   // Saving hNitf Handle
   Nitf.SaveFile (MAKE_IMAGE_PATH(TEXT("test.ntf")));
   Nitf.Destroy ();
   return SUCCESS;
}