#include "ltwrappr.h"
LVectorBase * LNITFFile::GetVector(uIndex)
L_UINT32 uIndex; |
index of the graphics data |
Retrieves an LVectorBase class object as the for the graphics data at a specified index in the graphic segment.
Parameter |
Description |
uIndex |
A zero-based index of the graphic data in the NITF file. |
! NULL |
The function was successful and an LVectorBase class object will be returned. |
NULL |
An error occurred. |
To change the graphic data in the graphic segment in the NITF file at specified index, call the LNITFFile::SetVector function.
When the returned LVectorBase class object is no longer needed, it should be freed by calling LVectorBase::Free function.
For every successful call to LNITFFile::GetVector, there must be a call to LVectorBase::Free to free this returned LVectorBase class object.
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_GetVectorExample()
{
//parse the NITF file
LNITFFile Nitf;
Nitf.Create (MAKE_IMAGE_PATH(TEXT("test.ntf")));
L_UINT uFlags = 0;
L_UINT uCount;
L_UINT i = 0;
L_TCHAR szFile[MAX_PATH];
// 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;
}
// Save all the graphic segments into separated files
uCount = Nitf.GetGraphicHeaderCount();
for( i = 0; i < uCount; ++i)
{
_stprintf_s(szFile, MAKE_IMAGE_PATH(TEXT("GraphicSeg%d.cgm")), i+1);
Nitf.GetVector(i)->Save(szFile, FILE_CGM);
}
Nitf.Destroy();
return SUCCESS;
}