本文整理汇总了C++中DDFRecord::GetStringSubfield方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFRecord::GetStringSubfield方法的具体用法?C++ DDFRecord::GetStringSubfield怎么用?C++ DDFRecord::GetStringSubfield使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFRecord
的用法示例。
在下文中一共展示了DDFRecord::GetStringSubfield方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
int SDTSRasterReader::Open( SDTS_CATD * poCATD, SDTS_IREF * poIREF,
const char * pszModule )
{
strncpy( szModule, pszModule, sizeof(szModule) );
szModule[sizeof(szModule) - 1] = '\0';
/* ==================================================================== */
/* Search the LDEF module for the requested cell module. */
/* ==================================================================== */
DDFModule oLDEF;
DDFRecord *poRecord;
/* -------------------------------------------------------------------- */
/* Open the LDEF module, and report failure if it is missing. */
/* -------------------------------------------------------------------- */
if( poCATD->GetModuleFilePath("LDEF") == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't find LDEF entry in CATD module ... "
"can't treat as raster.\n" );
return FALSE;
}
if( !oLDEF.Open( poCATD->GetModuleFilePath("LDEF") ) )
return FALSE;
/* -------------------------------------------------------------------- */
/* Read each record, till we find what we want. */
/* -------------------------------------------------------------------- */
while( (poRecord = oLDEF.ReadRecord() ) != NULL )
{
if( EQUAL(poRecord->GetStringSubfield("LDEF",0,"CMNM",0), pszModule) )
break;
}
if( poRecord == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Can't find module `%s' in LDEF file.\n",
pszModule );
return FALSE;
}
/* -------------------------------------------------------------------- */
/* Extract raster dimensions, and origin offset (0/1). */
/* -------------------------------------------------------------------- */
nXSize = poRecord->GetIntSubfield( "LDEF", 0, "NCOL", 0 );
nYSize = poRecord->GetIntSubfield( "LDEF", 0, "NROW", 0 );
nXStart = poRecord->GetIntSubfield( "LDEF", 0, "SOCI", 0 );
nYStart = poRecord->GetIntSubfield( "LDEF", 0, "SORI", 0 );
/* -------------------------------------------------------------------- */
/* Get the point in the pixel that the origin defines. We only */
/* support top left and center. */
/* -------------------------------------------------------------------- */
strcpy( szINTR, poRecord->GetStringSubfield( "LDEF", 0, "INTR", 0 ) );
if( EQUAL(szINTR,"") )
strcpy( szINTR, "CE" );
if( !EQUAL(szINTR,"CE") && !EQUAL(szINTR,"TL") )
{
CPLError( CE_Warning, CPLE_AppDefined,
"Unsupported INTR value of `%s', assume CE.\n"
"Positions may be off by one pixel.\n",
szINTR );
strcpy( szINTR, "CE" );
}
/* -------------------------------------------------------------------- */
/* Record the LDEF record number we used so we can find the */
/* corresponding RSDF record. */
/* -------------------------------------------------------------------- */
int nLDEF_RCID;
nLDEF_RCID = poRecord->GetIntSubfield( "LDEF", 0, "RCID", 0 );
oLDEF.Close();
/* ==================================================================== */
/* Search the RSDF module for the requested cell module. */
/* ==================================================================== */
DDFModule oRSDF;
/* -------------------------------------------------------------------- */
/* Open the RSDF module, and report failure if it is missing. */
/* -------------------------------------------------------------------- */
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;
/* -------------------------------------------------------------------- */
//.........这里部分代码省略.........
示例2: if
//.........这里部分代码省略.........
/* -------------------------------------------------------------------- */
/* Create band information objects. */
/* -------------------------------------------------------------------- */
poDS->nBands = 1;
poDS->papoBands = reinterpret_cast<GDALRasterBand **>(
VSICalloc( sizeof(GDALRasterBand *), poDS->nBands ) );
for( int i = 0; i < poDS->nBands; i++ )
poDS->SetBand( i+1, new SDTSRasterBand( poDS, i+1, poRL ) );
/* -------------------------------------------------------------------- */
/* Try to establish the projection string. For now we only */
/* support UTM and GEO. */
/* -------------------------------------------------------------------- */
OGRSpatialReference oSRS;
SDTS_XREF *poXREF = poTransfer->GetXREF();
if( EQUAL(poXREF->pszSystemName,"UTM") )
{
oSRS.SetUTM( poXREF->nZone );
}
else if( EQUAL(poXREF->pszSystemName,"GEO") )
{
/* we set datum later */
}
else
oSRS.SetLocalCS( poXREF->pszSystemName );
if( oSRS.IsLocal() )
/* don't try to set datum. */;
else if( EQUAL(poXREF->pszDatum,"NAS") )
oSRS.SetWellKnownGeogCS( "NAD27" );
else if( EQUAL(poXREF->pszDatum, "NAX") )
oSRS.SetWellKnownGeogCS( "NAD83" );
else if( EQUAL(poXREF->pszDatum, "WGC") )
oSRS.SetWellKnownGeogCS( "WGS72" );
else if( EQUAL(poXREF->pszDatum, "WGE") )
oSRS.SetWellKnownGeogCS( "WGS84" );
else
oSRS.SetWellKnownGeogCS( "WGS84" );
oSRS.Fixup();
poDS->pszProjection = NULL;
if( oSRS.exportToWkt( &poDS->pszProjection ) != OGRERR_NONE )
poDS->pszProjection = CPLStrdup("");
/* -------------------------------------------------------------------- */
/* Get metadata from the IDEN file. */
/* -------------------------------------------------------------------- */
const char* pszIDENFilePath = poTransfer->GetCATD()->GetModuleFilePath("IDEN");
if (pszIDENFilePath)
{
DDFModule oIDENFile;
if( oIDENFile.Open( pszIDENFilePath ) )
{
DDFRecord* poRecord;
while( (poRecord = oIDENFile.ReadRecord()) != NULL )
{
if( poRecord->GetStringSubfield( "IDEN", 0, "MODN", 0 ) == NULL )
continue;
static const char* const fields[][2] = { { "TITL", "TITLE" },
{ "DAID", "DATASET_ID" },
{ "DAST", "DATA_STRUCTURE" },
{ "MPDT", "MAP_DATE" },
{ "DCDT", "DATASET_CREATION_DATE" } };
for ( int i = 0;
i < static_cast<int>( sizeof(fields) )
/ static_cast<int>( sizeof(fields[0] ) );
i++)
{
const char* pszFieldValue =
poRecord->GetStringSubfield( "IDEN", 0, fields[i][0], 0 );
if ( pszFieldValue )
poDS->SetMetadataItem(fields[i][1], pszFieldValue);
}
break;
}
}
}
/* -------------------------------------------------------------------- */
/* Initialize any PAM information. */
/* -------------------------------------------------------------------- */
poDS->SetDescription( poOpenInfo->pszFilename );
poDS->TryLoadXML();
/* -------------------------------------------------------------------- */
/* Check for external overviews. */
/* -------------------------------------------------------------------- */
poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename, poOpenInfo->GetSiblingFiles() );
return poDS;
}