本文整理汇总了C++中HFAEntry::GetIntField方法的典型用法代码示例。如果您正苦于以下问题:C++ HFAEntry::GetIntField方法的具体用法?C++ HFAEntry::GetIntField怎么用?C++ HFAEntry::GetIntField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HFAEntry
的用法示例。
在下文中一共展示了HFAEntry::GetIntField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPCT
CPLErr HFABand::GetPCT( int * pnColors,
double **ppadfRed,
double **ppadfGreen,
double **ppadfBlue )
{
*pnColors = 0;
*ppadfRed = NULL;
*ppadfGreen = NULL;
*ppadfBlue = NULL;
/* -------------------------------------------------------------------- */
/* If we haven't already tried to load the colors, do so now. */
/* -------------------------------------------------------------------- */
if( nPCTColors == -1 )
{
HFAEntry *poColumnEntry;
int i, iColumn;
nPCTColors = 0;
poColumnEntry = poNode->GetNamedChild("Descriptor_Table.Red");
if( poColumnEntry == NULL )
return( CE_Failure );
nPCTColors = poColumnEntry->GetIntField( "numRows" );
for( iColumn = 0; iColumn < 3; iColumn++ )
{
apadfPCT[iColumn] = (double *)CPLMalloc(sizeof(double)*nPCTColors);
if( iColumn == 0 )
poColumnEntry = poNode->GetNamedChild("Descriptor_Table.Red");
else if( iColumn == 1 )
poColumnEntry= poNode->GetNamedChild("Descriptor_Table.Green");
else if( iColumn == 2 )
poColumnEntry = poNode->GetNamedChild("Descriptor_Table.Blue");
VSIFSeek( psInfo->fp, poColumnEntry->GetIntField("columnDataPtr"),
SEEK_SET );
VSIFRead( apadfPCT[iColumn], sizeof(double), nPCTColors,
psInfo->fp);
for( i = 0; i < nPCTColors; i++ )
HFAStandard( 8, apadfPCT[iColumn] + i );
}
}
/* -------------------------------------------------------------------- */
/* Return the values. */
/* -------------------------------------------------------------------- */
if( nPCTColors == 0 )
return( CE_Failure );
*pnColors = nPCTColors;
*ppadfRed = apadfPCT[0];
*ppadfGreen = apadfPCT[1];
*ppadfBlue = apadfPCT[2];
return( CE_None );
}
示例2: return
const Eprj_ProParameters *HFAGetProParameters( HFAHandle hHFA )
{
HFAEntry *poMIEntry;
Eprj_ProParameters *psProParms;
int i;
if( hHFA->nBands < 1 )
return NULL;
/* -------------------------------------------------------------------- */
/* Do we already have it? */
/* -------------------------------------------------------------------- */
if( hHFA->pProParameters != NULL )
return( (Eprj_ProParameters *) hHFA->pProParameters );
/* -------------------------------------------------------------------- */
/* Get the HFA node. */
/* -------------------------------------------------------------------- */
poMIEntry = hHFA->papoBand[0]->poNode->GetNamedChild( "Projection" );
if( poMIEntry == NULL )
return NULL;
/* -------------------------------------------------------------------- */
/* Allocate the structure. */
/* -------------------------------------------------------------------- */
psProParms = (Eprj_ProParameters *)CPLCalloc(sizeof(Eprj_ProParameters),1);
/* -------------------------------------------------------------------- */
/* Fetch the fields. */
/* -------------------------------------------------------------------- */
psProParms->proType = (Eprj_ProType) poMIEntry->GetIntField("proType");
psProParms->proNumber = poMIEntry->GetIntField("proNumber");
psProParms->proExeName =CPLStrdup(poMIEntry->GetStringField("proExeName"));
psProParms->proName = CPLStrdup(poMIEntry->GetStringField("proName"));
psProParms->proZone = poMIEntry->GetIntField("proZone");
for( i = 0; i < 15; i++ )
{
char szFieldName[30];
sprintf( szFieldName, "proParams[%d]", i );
psProParms->proParams[i] = poMIEntry->GetDoubleField(szFieldName);
}
psProParms->proSpheroid.sphereName =
CPLStrdup(poMIEntry->GetStringField("proSpheroid.sphereName"));
psProParms->proSpheroid.a = poMIEntry->GetDoubleField("proSpheroid.a");
psProParms->proSpheroid.b = poMIEntry->GetDoubleField("proSpheroid.b");
psProParms->proSpheroid.eSquared =
poMIEntry->GetDoubleField("proSpheroid.eSquared");
psProParms->proSpheroid.radius =
poMIEntry->GetDoubleField("proSpheroid.radius");
hHFA->pProParameters = (void *) psProParms;
return psProParms;
}
示例3: return
CPLErr HFABand::LoadBlockInfo()
{
int iBlock;
HFAEntry *poDMS;
if( panBlockStart != NULL )
return( CE_None );
poDMS = poNode->GetNamedChild( "RasterDMS" );
if( poDMS == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't find RasterDMS field in Eimg_Layer with block list.\n");
return CE_Failure;
}
panBlockStart = (int *) CPLMalloc(sizeof(int) * nBlocks);
panBlockSize = (int *) CPLMalloc(sizeof(int) * nBlocks);
panBlockFlag = (int *) CPLMalloc(sizeof(int) * nBlocks);
for( iBlock = 0; iBlock < nBlocks; iBlock++ )
{
char szVarName[64];
int nLogvalid, nCompressType;
sprintf( szVarName, "blockinfo[%d].offset", iBlock );
panBlockStart[iBlock] = poDMS->GetIntField( szVarName );
sprintf( szVarName, "blockinfo[%d].size", iBlock );
panBlockSize[iBlock] = poDMS->GetIntField( szVarName );
sprintf( szVarName, "blockinfo[%d].logvalid", iBlock );
nLogvalid = poDMS->GetIntField( szVarName );
sprintf( szVarName, "blockinfo[%d].compressionType", iBlock );
nCompressType = poDMS->GetIntField( szVarName );
panBlockFlag[iBlock] = 0;
if( nLogvalid )
panBlockFlag[iBlock] |= BFLG_VALID;
if( nCompressType != 0 )
panBlockFlag[iBlock] |= BFLG_COMPRESSED;
}
return( CE_None );
}
示例4: HFAOpen
//.........这里部分代码省略.........
return NULL;
}
/* -------------------------------------------------------------------- */
/* Read and verify the header. */
/* -------------------------------------------------------------------- */
if( VSIFRead( szHeader, 16, 1, fp ) < 1 )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Attempt to read 16 byte header failed for\n%s.",
pszFilename );
return NULL;
}
if( !EQUALN(szHeader,"EHFA_HEADER_TAG",15) )
{
CPLError( CE_Failure, CPLE_AppDefined,
"File %s is not an Imagine HFA file ... header wrong.",
pszFilename );
return NULL;
}
/* -------------------------------------------------------------------- */
/* Create the HFAInfo_t */
/* -------------------------------------------------------------------- */
psInfo = (HFAInfo_t *) CPLCalloc(sizeof(HFAInfo_t),1);
psInfo->fp = fp;
/* -------------------------------------------------------------------- */
/* Where is the header? */
/* -------------------------------------------------------------------- */
VSIFRead( &nHeaderPos, sizeof(GInt32), 1, fp );
HFAStandard( 4, &nHeaderPos );
/* -------------------------------------------------------------------- */
/* Read the header. */
/* -------------------------------------------------------------------- */
VSIFSeek( fp, nHeaderPos, SEEK_SET );
VSIFRead( &(psInfo->nVersion), sizeof(GInt32), 1, fp );
HFAStandard( 4, &(psInfo->nVersion) );
VSIFRead( szHeader, 4, 1, fp ); /* skip freeList */
VSIFRead( &(psInfo->nRootPos), sizeof(GInt32), 1, fp );
HFAStandard( 4, &(psInfo->nRootPos) );
VSIFRead( &(psInfo->nEntryHeaderLength), sizeof(GInt16), 1, fp );
HFAStandard( 2, &(psInfo->nEntryHeaderLength) );
VSIFRead( &(psInfo->nDictionaryPos), sizeof(GInt32), 1, fp );
HFAStandard( 4, &(psInfo->nDictionaryPos) );
/* -------------------------------------------------------------------- */
/* Instantiate the root entry. */
/* -------------------------------------------------------------------- */
psInfo->poRoot = new HFAEntry( psInfo, psInfo->nRootPos, NULL, NULL );
/* -------------------------------------------------------------------- */
/* Read the dictionary */
/* -------------------------------------------------------------------- */
psInfo->pszDictionary = HFAGetDictionary( psInfo );
psInfo->poDictionary = new HFADictionary( psInfo->pszDictionary );
/* -------------------------------------------------------------------- */
/* Find the first band node. */
/* -------------------------------------------------------------------- */
psInfo->nBands = 0;
poNode = psInfo->poRoot->GetChild();
while( poNode != NULL )
{
if( EQUAL(poNode->GetType(),"Eimg_Layer") )
{
if( psInfo->nBands == 0 )
{
psInfo->nXSize = poNode->GetIntField("width");
psInfo->nYSize = poNode->GetIntField("height");
}
else if( poNode->GetIntField("width") != psInfo->nXSize
|| poNode->GetIntField("height") != psInfo->nYSize )
{
CPLAssert( FALSE );
continue;
}
psInfo->papoBand = (HFABand **)
CPLRealloc(psInfo->papoBand,
sizeof(HFABand *) * (psInfo->nBands+1));
psInfo->papoBand[psInfo->nBands] = new HFABand( psInfo, poNode );
psInfo->nBands++;
}
poNode = poNode->GetNext();
}
return psInfo;
}