#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. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
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. |
#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;
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;
}