本文整理汇总了C++中DDFModule::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ DDFModule::Create方法的具体用法?C++ DDFModule::Create怎么用?C++ DDFModule::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDFModule
的用法示例。
在下文中一共展示了DDFModule::Create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mk_catalog
void mk_catalog()
{
DDFModule oModule;
DDFFieldDefn *poFDefn;
oModule.Initialize();
/* -------------------------------------------------------------------- */
/* Create the '0000' definition. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "0000", "", "0001CATD",
dsc_elementary,
dtc_char_string );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the '0000' definition. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "0001", "ISO 8211 Record Identifier", "",
dsc_elementary, dtc_bit_string,
"(b12)" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the CATD field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "CATD", "Catalog Directory field", "",
dsc_vector, dtc_mixed_data_type );
poFDefn->AddSubfield( "RCNM", "A(2)" );
poFDefn->AddSubfield( "RCID", "I(10)" );
poFDefn->AddSubfield( "FILE", "A" );
poFDefn->AddSubfield( "LFIL", "A" );
poFDefn->AddSubfield( "VOLM", "A" );
poFDefn->AddSubfield( "IMPL", "A(3)" );
poFDefn->AddSubfield( "SLAT", "R" );
poFDefn->AddSubfield( "WLON", "R" );
poFDefn->AddSubfield( "NLAT", "R" );
poFDefn->AddSubfield( "ELON", "R" );
poFDefn->AddSubfield( "CRCS", "A" );
poFDefn->AddSubfield( "COMT", "A" );
oModule.AddField( poFDefn );
oModule.Dump( stdout );
oModule.Create( "out.ddf" );
/* -------------------------------------------------------------------- */
/* Create a record. */
/* -------------------------------------------------------------------- */
DDFRecord *poRec = new DDFRecord( &oModule );
DDFField *poField;
poField = poRec->AddField( oModule.FindFieldDefn( "0001" ) );
poRec->SetFieldRaw( poField, 0, "\0\0\036", 3 );
poField = poRec->AddField( oModule.FindFieldDefn( "CATD" ) );
poRec->SetStringSubfield( "CATD", 0, "RCNM", 0, "CD" );
poRec->SetIntSubfield ( "CATD", 0, "RCID", 0, 1 );
poRec->SetStringSubfield( "CATD", 0, "FILE", 0, "CATALOG.030" );
poRec->SetStringSubfield( "CATD", 0, "VOLM", 0, "V01X01" );
poRec->SetStringSubfield( "CATD", 0, "IMPL", 0, "ASC" );
poRec->SetStringSubfield( "CATD", 0, "COMT", 0,
"Exchange Set Catalog file" );
poRec->Write();
delete poRec;
/* -------------------------------------------------------------------- */
/* Create a record. */
/* -------------------------------------------------------------------- */
poRec = new DDFRecord( &oModule );
poField = poRec->AddField( oModule.FindFieldDefn( "0001" ) );
poRec->SetFieldRaw( poField, 0, "\1\0\036", 3 );
poField = poRec->AddField( oModule.FindFieldDefn( "CATD" ) );
poRec->SetStringSubfield( "CATD", 0, "RCNM", 0, "CD" );
poRec->SetIntSubfield ( "CATD", 0, "RCID", 0, 2 );
poRec->SetStringSubfield( "CATD", 0, "FILE", 0, "No410810.000" );
poRec->SetStringSubfield( "CATD", 0, "VOLM", 0, "V01X01" );
poRec->SetStringSubfield( "CATD", 0, "IMPL", 0, "BIN" );
poRec->SetFloatSubfield ( "CATD", 0, "SLAT", 0, 59.000005 );
poRec->SetFloatSubfield ( "CATD", 0, "WLON", 0, 4.999996 );
poRec->SetFloatSubfield ( "CATD", 0, "NLAT", 0, 59.500003 );
poRec->SetFloatSubfield ( "CATD", 0, "ELON", 0, 5.499997 );
poRec->SetStringSubfield( "CATD", 0, "CRCS", 0, "555C3AD4" );
poRec->Write();
delete poRec;
}
示例2: mk_s57
void mk_s57()
{
DDFModule oModule;
DDFFieldDefn *poFDefn;
oModule.Initialize();
/* -------------------------------------------------------------------- */
/* Create the '0000' definition. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "0000", "", "0001DSIDDSIDDSSI0001DSPM0001VRIDVRIDATTVVRIDVRPCVRIDVRPTVRIDSGCCVRIDSG2DVRIDSG3D0001FRIDFRIDFOIDFRIDATTFFRIDNATFFRIDFFPCFRIDFFPTFRIDFSPCFRIDFSPT", dsc_elementary, dtc_char_string );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the '0001' definition. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "0001", "ISO 8211 Record Identifier", "",
dsc_elementary, dtc_bit_string,
"(b12)" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the DSID field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "DSID", "Data set identification field", "",
dsc_vector, dtc_mixed_data_type );
poFDefn->AddSubfield( "RCNM", "b11" );
poFDefn->AddSubfield( "RCID", "b14" );
poFDefn->AddSubfield( "EXPP", "b11" );
poFDefn->AddSubfield( "INTU", "b11" );
poFDefn->AddSubfield( "DSNM", "A" );
poFDefn->AddSubfield( "EDTN", "A" );
poFDefn->AddSubfield( "UPDN", "A" );
poFDefn->AddSubfield( "UADT", "A(8)" );
poFDefn->AddSubfield( "ISDT", "A(8)" );
poFDefn->AddSubfield( "STED", "R(4)" );
poFDefn->AddSubfield( "PRSP", "b11" );
poFDefn->AddSubfield( "PSDN", "A" );
poFDefn->AddSubfield( "PRED", "A" );
poFDefn->AddSubfield( "PROF", "b11" );
poFDefn->AddSubfield( "AGEN", "b12" );
poFDefn->AddSubfield( "COMT", "A" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the DSSI field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "DSSI", "Data set structure information field", "",
dsc_vector, dtc_mixed_data_type );
poFDefn->AddSubfield( "DSTR", "b11" );
poFDefn->AddSubfield( "AALL", "b11" );
poFDefn->AddSubfield( "NALL", "b11" );
poFDefn->AddSubfield( "NOMR", "b14" );
poFDefn->AddSubfield( "NOCR", "b14" );
poFDefn->AddSubfield( "NOGR", "b14" );
poFDefn->AddSubfield( "NOLR", "b14" );
poFDefn->AddSubfield( "NOIN", "b14" );
poFDefn->AddSubfield( "NOCN", "b14" );
poFDefn->AddSubfield( "NOED", "b14" );
poFDefn->AddSubfield( "NOFA", "b14" );
oModule.AddField( poFDefn );
/* -------------------------------------------------------------------- */
/* Create the DSPM field. */
/* -------------------------------------------------------------------- */
poFDefn = new DDFFieldDefn();
poFDefn->Create( "DSPM", "Data set parameter field", "",
dsc_vector, dtc_mixed_data_type );
poFDefn->AddSubfield( "RCNM", "b11" );
poFDefn->AddSubfield( "RCID", "b14" );
poFDefn->AddSubfield( "HDAT", "b11" );
poFDefn->AddSubfield( "VDAT", "b11" );
poFDefn->AddSubfield( "SDAT", "b11" );
poFDefn->AddSubfield( "CSCL", "b14" );
poFDefn->AddSubfield( "DUNI", "b11" );
poFDefn->AddSubfield( "HUNI", "b11" );
poFDefn->AddSubfield( "PUNI", "b11" );
poFDefn->AddSubfield( "COUN", "b11" );
poFDefn->AddSubfield( "COMF", "b14" );
poFDefn->AddSubfield( "SOMF", "b14" );
poFDefn->AddSubfield( "COMT", "A" );
oModule.AddField( poFDefn );
//.........这里部分代码省略.........
示例3: main
int main(int nArgc, char* papszArgv[])
{
const char *pszFilename = NULL, *pszOutFilename = NULL;
DDFModule oModule;
/* -------------------------------------------------------------------- */
/* Check arguments. */
/* -------------------------------------------------------------------- */
for( int iArg = 1; iArg < nArgc; iArg++ )
{
if( pszFilename == NULL )
pszFilename = papszArgv[iArg];
else if( pszOutFilename == NULL )
pszOutFilename = papszArgv[iArg];
else
{
pszFilename = NULL;
break;
}
}
if( pszFilename == NULL )
{
printf( "Usage: 8211createfromxml filename.xml outfilename\n" );
exit( 1 );
}
CPLXMLNode* poRoot = CPLParseXMLFile( pszFilename );
if( poRoot == NULL )
{
fprintf(stderr, "Cannot parse XML file '%s'\n", pszFilename);
exit( 1 );
}
CPLXMLNode* poXMLDDFModule = CPLSearchXMLNode(poRoot, "=DDFModule");
if( poXMLDDFModule == NULL )
{
fprintf(stderr, "Cannot find DDFModule node in XML file '%s'\n", pszFilename);
exit( 1 );
}
/* Compute the size of the DDFField tag */
CPLXMLNode* psIter = poXMLDDFModule->psChild;
int nSizeFieldTag = 0;
while( psIter != NULL )
{
if( psIter->eType == CXT_Element &&
strcmp(psIter->pszValue, "DDFFieldDefn") == 0 )
{
const char* pszTag = CPLGetXMLValue(psIter, "tag", "");
if( nSizeFieldTag == 0 )
nSizeFieldTag = (int)strlen(pszTag);
else if( nSizeFieldTag != (int)strlen(pszTag) )
{
fprintf(stderr, "All fields have not the same tag size\n");
exit( 1 );
}
}
psIter = psIter->psNext;
}
char chInterchangeLevel = '3';
char chLeaderIden = 'L';
char chCodeExtensionIndicator = 'E';
char chVersionNumber = '1';
char chAppIndicator = ' ';
const char *pszExtendedCharSet = " ! ";
int nSizeFieldLength = 3;
int nSizeFieldPos = 4;
chInterchangeLevel = CPLGetXMLValue(poXMLDDFModule, "_interchangeLevel", CPLSPrintf("%c", chInterchangeLevel))[0];
chLeaderIden = CPLGetXMLValue(poXMLDDFModule, "_leaderIden", CPLSPrintf("%c", chLeaderIden))[0];
chCodeExtensionIndicator = CPLGetXMLValue(poXMLDDFModule, "_inlineCodeExtensionIndicator", CPLSPrintf("%c", chCodeExtensionIndicator))[0];
chVersionNumber = CPLGetXMLValue(poXMLDDFModule, "_versionNumber", CPLSPrintf("%c", chVersionNumber))[0];
chAppIndicator = CPLGetXMLValue(poXMLDDFModule, "_appIndicator", CPLSPrintf("%c", chAppIndicator))[0];
char szExtendedCharSet[4];
snprintf(szExtendedCharSet, sizeof(szExtendedCharSet), "%s", CPLGetXMLValue(poXMLDDFModule, "_extendedCharSet", pszExtendedCharSet));
pszExtendedCharSet = szExtendedCharSet;
nSizeFieldLength = atoi(CPLGetXMLValue(poXMLDDFModule, "_sizeFieldLength", CPLSPrintf("%d", nSizeFieldLength)));
nSizeFieldPos = atoi(CPLGetXMLValue(poXMLDDFModule, "_sizeFieldPos", CPLSPrintf("%d", nSizeFieldPos)));
nSizeFieldTag = atoi(CPLGetXMLValue(poXMLDDFModule, "_sizeFieldTag", CPLSPrintf("%d", nSizeFieldTag)));
oModule.Initialize(chInterchangeLevel,
chLeaderIden,
chCodeExtensionIndicator,
chVersionNumber,
chAppIndicator,
pszExtendedCharSet,
nSizeFieldLength,
nSizeFieldPos,
nSizeFieldTag);
oModule.SetFieldControlLength(atoi(CPLGetXMLValue(poXMLDDFModule, "_fieldControlLength", CPLSPrintf("%d", oModule.GetFieldControlLength()))));
int bCreated = FALSE;
/* Create DDFFieldDefn and DDFRecord elements */
psIter = poXMLDDFModule->psChild;
while( psIter != NULL )
{
if( psIter->eType == CXT_Element &&
//.........这里部分代码省略.........