LNITFFile::SetVector

#include "ltwrappr.h"

L_INT LNITFFile::SetVector(uIndex, pVector)

L_UINT32 uIndex;

/* index of the graphic segment */

LVectorBase * pVector;

/* pointer to LVectorBase class object */

Changes the graphic data in the graphic segment in the NITF file at a specified index.

Parameter

Description

uIndex

A zero-based index of the graphic segment in the NITF file to be changed with the vector data pointed to by pVector.

pVector

Pointer LVectorBase class object references the new graphic data to set in the graphic segment in the NITF file at the specified index uIndex.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To retrieve the object for the graphics data at specified index in the graphic segment, call LNITFFile::GetVector function.

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::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: Getting and Setting Graphic Data

 

Programming with LEADTOOLS NITF Functions.

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LNITFFile_SetVectorExample()
{
   WRPUNLOCKSUPPORT();
   // Create hNitf handle and parse the NITF file
   LNITFFile Nitf; 
   Nitf.Create (MAKE_IMAGE_PATH(TEXT("test.ntf")));
   L_UINT uFlags = 0; 
   LVectorBase Vector; 
   // Check if the hNITF 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;
   }
   // Update the first graphic segment with new Graphic data
   if(Nitf.GetGraphicHeaderCount () > 0) 
   {
      if(Vector.Load (MAKE_IMAGE_PATH(TEXT("random.dxf"))))
      {
         Nitf.SetVector(0, &Vector); 
      }
   }
   Nitf.SaveFile (MAKE_IMAGE_PATH(TEXT("test2.ntf")));
   Nitf.Destroy ();
   return SUCCESS;
}