本文整理汇总了C++中DDFRecord::FindField方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFRecord::FindField方法的具体用法?C++ DDFRecord::FindField怎么用?C++ DDFRecord::FindField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFRecord
的用法示例。
在下文中一共展示了DDFRecord::FindField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetBlock
int SDTSRasterReader::GetBlock( int nXOffset, int nYOffset, void * pData )
{
DDFRecord *poRecord = NULL;
int nBytesPerValue;
int iTry;
CPLAssert( nXOffset == 0 );
/* -------------------------------------------------------------------- */
/* Analyse the datatype. */
/* -------------------------------------------------------------------- */
CPLAssert( EQUAL(szFMT,"BI16") || EQUAL(szFMT,"BFP32") );
if( EQUAL(szFMT,"BI16") )
nBytesPerValue = 2;
else
nBytesPerValue = 4;
for(iTry=0;iTry<2;iTry++)
{
/* -------------------------------------------------------------------- */
/* Read through till we find the desired record. */
/* -------------------------------------------------------------------- */
CPLErrorReset();
while( (poRecord = oDDFModule.ReadRecord()) != NULL )
{
if( poRecord->GetIntSubfield( "CELL", 0, "ROWI", 0 )
== nYOffset + nYStart )
{
break;
}
}
if( CPLGetLastErrorType() == CE_Failure )
return FALSE;
/* -------------------------------------------------------------------- */
/* If we didn't get what we needed just start over. */
/* -------------------------------------------------------------------- */
if( poRecord == NULL )
{
if (iTry == 0)
oDDFModule.Rewind();
else
{
CPLError( CE_Failure, CPLE_AppDefined,
"Cannot read scanline %d. Raster access failed.\n",
nYOffset );
return FALSE;
}
}
else
{
break;
}
}
/* -------------------------------------------------------------------- */
/* Validate the records size. Does it represent exactly one */
/* scanline? */
/* -------------------------------------------------------------------- */
DDFField *poCVLS;
poCVLS = poRecord->FindField( "CVLS" );
if( poCVLS == NULL )
return FALSE;
if( poCVLS->GetRepeatCount() != nXSize )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Cell record is %d long, but we expected %d, the number\n"
"of pixels in a scanline. Raster access failed.\n",
poCVLS->GetRepeatCount(), nXSize );
return FALSE;
}
/* -------------------------------------------------------------------- */
/* Does the CVLS field consist of exactly 1 B(16) field? */
/* -------------------------------------------------------------------- */
if( poCVLS->GetDataSize() < nBytesPerValue * nXSize
|| poCVLS->GetDataSize() > nBytesPerValue * nXSize + 1 )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Cell record is not of expected format. Raster access "
"failed.\n" );
return FALSE;
}
/* -------------------------------------------------------------------- */
/* Copy the data to the application buffer, and byte swap if */
/* required. */
/* -------------------------------------------------------------------- */
memcpy( pData, poCVLS->GetData(), nXSize * nBytesPerValue );
#ifdef CPL_LSB
if( nBytesPerValue == 2 )
{
for( int i = 0; i < nXSize; i++ )
//.........这里部分代码省略.........
示例2: Open
//.........这里部分代码省略.........
if( poCATD->GetModuleFilePath("RSDF") == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't find RSDF entry in CATD module ... "
"can't treat as raster.\n" );
return FALSE;
}
if( !oRSDF.Open( poCATD->GetModuleFilePath("RSDF") ) )
return FALSE;
/* -------------------------------------------------------------------- */
/* Read each record, till we find what we want. */
/* -------------------------------------------------------------------- */
while( (poRecord = oRSDF.ReadRecord() ) != NULL )
{
if( poRecord->GetIntSubfield("LYID",0,"RCID",0) == nLDEF_RCID )
break;
}
if( poRecord == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't find LDEF:%d record in RSDF file.\n",
nLDEF_RCID );
return FALSE;
}
/* -------------------------------------------------------------------- */
/* Establish the raster pixel/line to georef transformation. */
/* -------------------------------------------------------------------- */
double dfZ;
if( poRecord->FindField( "SADR" ) == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't find SADR field in RSDF record.\n" );
return FALSE;
}
poIREF->GetSADR( poRecord->FindField( "SADR" ), 1,
adfTransform + 0, adfTransform + 3, &dfZ );
adfTransform[1] = poIREF->dfXRes;
adfTransform[2] = 0.0;
adfTransform[4] = 0.0;
adfTransform[5] = -1 * poIREF->dfYRes;
/* -------------------------------------------------------------------- */
/* If the origin is the center of the pixel, then shift it back */
/* half a pixel to the top left of the top left. */
/* -------------------------------------------------------------------- */
if( EQUAL(szINTR,"CE") )
{
adfTransform[0] -= adfTransform[1] * 0.5;
adfTransform[3] -= adfTransform[5] * 0.5;
}
/* -------------------------------------------------------------------- */
/* Verify some other assumptions. */
/* -------------------------------------------------------------------- */
const char *pszString;
pszString = poRecord->GetStringSubfield( "RSDF", 0, "OBRP", 0);
if( !EQUAL(pszString,"G2") )
{
示例3:
DDFField *SDTSAttrReader::GetNextRecord( SDTSModId * poModId,
DDFRecord ** ppoRecord,
int bDuplicate )
{
DDFRecord *poRecord;
DDFField *poATTP;
/* -------------------------------------------------------------------- */
/* Fetch a record. */
/* -------------------------------------------------------------------- */
if( ppoRecord != NULL )
*ppoRecord = NULL;
if( oDDFModule.GetFP() == NULL )
return NULL;
poRecord = oDDFModule.ReadRecord();
if( poRecord == NULL )
return NULL;
/* -------------------------------------------------------------------- */
/* Make a copy of the record for persistent use if requested by */
/* the caller. */
/* -------------------------------------------------------------------- */
if( bDuplicate )
poRecord = poRecord->Clone();
/* -------------------------------------------------------------------- */
/* Find the ATTP field. */
/* -------------------------------------------------------------------- */
poATTP = poRecord->FindField( "ATTP", 0 );
if( poATTP == NULL )
{
poATTP = poRecord->FindField( "ATTS", 0 );
}
if( poATTP == NULL )
return NULL;
/* -------------------------------------------------------------------- */
/* Update the module ID if required. */
/* -------------------------------------------------------------------- */
if( poModId != NULL )
{
DDFField *poATPR = poRecord->FindField( "ATPR" );
if( poATPR == NULL )
poATPR = poRecord->FindField( "ATSC" );
if( poATPR != NULL )
poModId->Set( poATPR );
}
/* -------------------------------------------------------------------- */
/* return proper answer. */
/* -------------------------------------------------------------------- */
if( ppoRecord != NULL )
*ppoRecord = poRecord;
return poATTP;
}