#include "ltntf.h"
L_LTNTF_API pVECTORHANDLE L_NITFGetVectorHandle(hNitf, uIndex)
HNITF hNitf; |
handle to an existing NITF file |
L_UINT32 uIndex; |
index of the graphics data |
Gets the handle for the graphics data at a specified index in the graphic segment.
Parameter |
Description |
hNitf |
Handle to an existing NITF file, created by calling the L_NITFCreate function. |
uIndex |
A zero-based index of the graphic data in the hNitf handle. |
!NULL |
The function was successful and a vector handle will be returned. |
NULL |
An error occurred. |
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
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. |
Functions: |
|
Topics: |
|
|
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileNameL_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 filenRet =L_NITFCreate(&hNitf, MAKE_IMAGE_PATH(TEXT("test.ntf")));if(nRet !=SUCCESS)return nRet;// Check if the hNITF is empty or invaliduFlags = 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 filesuCount = 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;}