LNITFFile::GetVector

#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.

Returns

! NULL

The function was successful and an LVectorBase class object will be returned.

NULL

An error occurred.

Comments

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.

See Also

Functions:

LNITFFile::Create, LNITFFile::Destroy, LNITFFile::GetStatus, LNITFFile::SaveFile, LNITFFile::AppendImageSegment, LNITFFile::AppendGraphicSegment, LNITFFile::AppendTextSegment, LNITFFile::SetVector, 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: Getting and Setting Graphic Data.

 

Programming with LEADTOOLS NITF Functions.

Example

L_INT LNITFFile_GetVectorExample()
{
   WRPUNLOCKSUPPORT();
   //parse the NITF file
   LNITFFile Nitf; 
   Nitf.Create (TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\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, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\GraphicSeg%d.cgm"), i+1); 
      Nitf.GetVector(i)->Save(szFile, FILE_CGM); 
   }
   Nitf.Destroy();
   return SUCCESS;
}