Creates an empty NITF file or parses an existing NITF file.
#include "ltwrappr.h"
L_INT LNITFFile::Create(pszFileName)
L_INT LNITFFile::Create()
Character string that contains the name of the NITF file to be parsed.
Value | Meaning |
---|---|
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.
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;
}