L_NITFGetVectorHandle

Summary

Gets the handle for the graphics data at a specified index in the graphic segment.

Syntax

#include "ltntf.h"

L_LTNTF_API pVECTORHANDLE L_NITFGetVectorHandle(hNitf, uIndex)

Parameters

HNITF hNitf

Handle to an existing NITF file, created by calling the L_NITFCreate function.

L_UINT32 uIndex

A zero-based index of the graphic data in the hNitf handle.

Returns

Value Meaning
!NULL The function was successful and a vector handle will be returned.
NULL An error occurred.

Comments

To set the handle for the graphic data in the graphic segment in the NITF file at specified index, call the L_NITFSetVectorHandle function.

When the returned graphics data handle is no longer needed, it should be freed by calling L_VecFree function.

For every successful call to L_NITFGetVectorHandle that returns a valid graphics data handle, there must be a call to L_VecFree to free this returned handle.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT NITFGetVectorHandleExample(L_VOID) 
{ 
   L_INT nRet; 
   HNITF hNitf; 
   L_UINT uFlags = 0; 
   pVECTORHANDLE pVectorHandle = NULL; 
   L_UINT uCount; 
   L_UINT i = 0; 
   L_TCHAR pszFile[MAX_PATH]; 
 
   // Create hNitf handle and parse the NITF file 
   nRet =L_NITFCreate(&hNitf, MAKE_IMAGE_PATH(TEXT("test.ntf"))); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   // Check if the hNITF is empty or invalid 
   uFlags = L_NITFGetStatus(hNitf); 
 
   if((uFlags & NITF_FILE_EMPTY) == NITF_FILE_EMPTY) 
   { 
      MessageBox(NULL ,TEXT("NITF file is empty"),NULL,MB_OK); 
      return FAILURE; 
   } 
 
   if((uFlags & NITF_FILE_VALID) != NITF_FILE_VALID) 
   { 
      MessageBox(NULL,TEXT("NITF file is invalid"),NULL,MB_OK); 
      return FAILURE; 
   } 
 
   // Save all the graphic segments into separated files 
   uCount = L_NITFGetGraphicHeaderCount(hNitf); 
   for( i = 0; i < uCount; ++i) 
   { 
      pVectorHandle = L_NITFGetVectorHandle(hNitf, i); 
      if(pVectorHandle == NULL) 
         return FAILURE; 
 
      memset(pszFile, 0, sizeof(pszFile)); 
      wsprintf(pszFile, MAKE_IMAGE_PATH(TEXT("GraphicSeg%d.cgm")), i+1); 
 
      nRet =L_VecSaveFile(pszFile, pVectorHandle, FILE_CGM, NULL); 
      if(nRet !=SUCCESS) 
         return nRet; 
 
      nRet =L_VecFree(pVectorHandle); 
      if(nRet !=SUCCESS) 
         return nRet; 
   } 
 
   nRet =L_NITFDestroy(&hNitf); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.